Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui,browser): load panel sizes from storage on initial load #7265

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ui/client/components/BrowserIframe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const marginLeft = computed(() => {
<div h="full" flex="~ col">
<div p="3" h-10 flex="~ gap-2" items-center bg-header border="b base">
<IconButton
v-show="panels.navigation <= 2"
v-show="panels.navigation <= 15"
v-tooltip.bottom="'Show Navigation Panel'"
title="Show Navigation Panel"
rotate-180
Expand Down
9 changes: 3 additions & 6 deletions packages/ui/client/components/explorer/Explorer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { RecycleScroller } from 'vue-virtual-scroller'
import { config } from '~/composables/client'
import { useSearch } from '~/composables/explorer/search'

import { panels } from '~/composables/navigation'
import { activeFileId } from '~/composables/params'

import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
Expand Down Expand Up @@ -46,12 +45,10 @@ const {

const filterClass = ref<string>('grid-cols-2')
const filterHeaderClass = ref<string>('grid-col-span-2')
const testExplorerRef = ref<HTMLInputElement | undefined>()

const { width: windowWidth } = useWindowSize()

watch(() => windowWidth.value * (panels.navigation / 100), (width) => {
if (width < 420) {
const testExplorerRef = ref<HTMLElement | undefined>()
useResizeObserver(() => testExplorerRef.value, ([{ contentRect }]) => {
if (contentRect.width < 420) {
filterClass.value = 'grid-cols-2'
filterHeaderClass.value = 'grid-col-span-2'
}
Expand Down
6 changes: 0 additions & 6 deletions packages/ui/client/composables/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,10 @@ export const coverageEnabled = computed(() => {
export const mainSizes = useLocalStorage<[left: number, right: number]>(
'vitest-ui_splitpanes-mainSizes',
[33, 67],
{
initOnMounted: true,
},
)
export const detailSizes = useLocalStorage<[left: number, right: number]>(
'vitest-ui_splitpanes-detailSizes',
[33, 67],
{
initOnMounted: true,
},
)

// live sizes of panels in percentage
Expand Down
12 changes: 0 additions & 12 deletions packages/ui/client/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@ const resizingMain = useDebounceFn((event: { size: number }[]) => {
preventBrowserEvents()
}, 0)

function resizeMain() {
const width = window.innerWidth
const panelWidth = Math.min(width / 3, 300)
mainSizes.value[0] = (100 * panelWidth) / width
mainSizes.value[1] = 100 - mainSizes.value[0]
recordMainResize([
{ size: mainSizes.value[0] },
{ size: mainSizes.value[1] },
])
}

function recordMainResize(event: { size: number }[]) {
panels.navigation = event[0].size
panels.details.size = event[1].size
Expand Down Expand Up @@ -82,7 +71,6 @@ function allowBrowserEvents() {
class="pt-4px"
@resized="onMainResized"
@resize="resizingMain"
@ready="resizeMain"
>
<Pane :size="mainSizes[0]">
<Navigation />
Expand Down
Loading