change default clock count to 2

This commit is contained in:
pa
2026-03-22 22:24:27 +09:00
parent 59d8a19c37
commit deb27c3fa6
3 changed files with 36 additions and 18 deletions
+27 -9
View File
@@ -51,12 +51,19 @@
</div> </div>
</TooltipWrapper> </TooltipWrapper>
<HoverCard v-if="!isMacOS && visibility.vrchat" v-model:open="gameHoverOpen" :open-delay="50" :close-delay="50"> <HoverCard
v-if="!isMacOS && visibility.vrchat"
v-model:open="gameHoverOpen"
:open-delay="50"
:close-delay="50">
<HoverCardTrigger as-child> <HoverCardTrigger as-child>
<div class="flex items-center gap-1 px-2 h-[22px] whitespace-nowrap border-r border-border"> <div
class="flex items-center gap-1 px-2 h-[22px] whitespace-nowrap border-r border-border">
<span <span
class="inline-block size-2 rounded-full shrink-0" class="inline-block size-2 rounded-full shrink-0"
:class="gameStore.isGameRunning ? 'bg-status-online' : 'bg-status-offline-alt'" /> :class="
gameStore.isGameRunning ? 'bg-status-online' : 'bg-status-offline-alt'
" />
<span class="text-foreground text-[11px]">{{ t('status_bar.game') }}</span> <span class="text-foreground text-[11px]">{{ t('status_bar.game') }}</span>
<span v-if="gameStore.isGameRunning" class="text-[10px] text-foreground">{{ <span v-if="gameStore.isGameRunning" class="text-[10px] text-foreground">{{
gameSessionText gameSessionText
@@ -71,11 +78,15 @@
:side-offset="4"> :side-offset="4">
<div class="flex flex-col gap-1"> <div class="flex flex-col gap-1">
<div class="flex items-center justify-between gap-3"> <div class="flex items-center justify-between gap-3">
<span class="text-[11px] text-muted-foreground">{{ t('status_bar.game_started_at') }}</span> <span class="text-[11px] text-muted-foreground">{{
t('status_bar.game_started_at')
}}</span>
<span class="text-[11px] text-foreground">{{ gameStartedAtText }}</span> <span class="text-[11px] text-foreground">{{ gameStartedAtText }}</span>
</div> </div>
<div class="flex items-center justify-between gap-3"> <div class="flex items-center justify-between gap-3">
<span class="text-[11px] text-muted-foreground">{{ t('status_bar.game_session_duration') }}</span> <span class="text-[11px] text-muted-foreground">{{
t('status_bar.game_session_duration')
}}</span>
<span class="text-[11px] text-foreground">{{ gameSessionDetailText }}</span> <span class="text-[11px] text-foreground">{{ gameSessionDetailText }}</span>
</div> </div>
</div> </div>
@@ -88,11 +99,15 @@
:side-offset="4"> :side-offset="4">
<div class="flex flex-col gap-1"> <div class="flex flex-col gap-1">
<div class="flex items-center justify-between gap-3"> <div class="flex items-center justify-between gap-3">
<span class="text-[11px] text-muted-foreground">{{ t('status_bar.game_last_session') }}</span> <span class="text-[11px] text-muted-foreground">{{
t('status_bar.game_last_session')
}}</span>
<span class="text-[11px] text-foreground">{{ lastSessionText }}</span> <span class="text-[11px] text-foreground">{{ lastSessionText }}</span>
</div> </div>
<div class="flex items-center justify-between gap-3"> <div class="flex items-center justify-between gap-3">
<span class="text-[11px] text-muted-foreground">{{ t('status_bar.game_last_offline') }}</span> <span class="text-[11px] text-muted-foreground">{{
t('status_bar.game_last_offline')
}}</span>
<span class="text-[11px] text-foreground">{{ lastOfflineTimeText }}</span> <span class="text-[11px] text-foreground">{{ lastOfflineTimeText }}</span>
</div> </div>
</div> </div>
@@ -269,7 +284,10 @@
@update:model-value="toggleVisibility('proxy')"> @update:model-value="toggleVisibility('proxy')">
{{ t('status_bar.proxy') }} {{ t('status_bar.proxy') }}
</ContextMenuCheckboxItem> </ContextMenuCheckboxItem>
<ContextMenuCheckboxItem :model-value="visibility.ws" @select.prevent @update:model-value="toggleVisibility('ws')"> <ContextMenuCheckboxItem
:model-value="visibility.ws"
@select.prevent
@update:model-value="toggleVisibility('ws')">
WebSocket WebSocket
</ContextMenuCheckboxItem> </ContextMenuCheckboxItem>
<ContextMenuCheckboxItem <ContextMenuCheckboxItem
@@ -542,7 +560,7 @@
const defaultClocks = [{ offset: localOffset }, { offset: 0 }, { offset: localOffset < 0 ? 9 : -5 }]; const defaultClocks = [{ offset: localOffset }, { offset: 0 }, { offset: localOffset < 0 ? 9 : -5 }];
const clocks = ref(defaultClocks.map((c) => ({ ...c }))); const clocks = ref(defaultClocks.map((c) => ({ ...c })));
const clockCount = ref(3); const clockCount = ref(2);
const clockPopoverOpen = reactive([false, false, false]); const clockPopoverOpen = reactive([false, false, false]);
const visibleClocks = computed(() => clocks.value.slice(0, clockCount.value)); const visibleClocks = computed(() => clocks.value.slice(0, clockCount.value));
@@ -268,8 +268,8 @@ describe('loadClockCount', () => {
storage = createMockStorage(); storage = createMockStorage();
}); });
test('returns 3 when storage is empty', () => { test('returns 2 when storage is empty', () => {
expect(loadClockCount(storage)).toBe(3); expect(loadClockCount(storage)).toBe(2);
}); });
test.each([0, 1, 2, 3])('returns valid stored count %i', (n) => { test.each([0, 1, 2, 3])('returns valid stored count %i', (n) => {
@@ -277,17 +277,17 @@ describe('loadClockCount', () => {
expect(loadClockCount(storage)).toBe(n); expect(loadClockCount(storage)).toBe(n);
}); });
test('returns 3 for out-of-range values', () => { test('returns 2 for out-of-range values', () => {
storage.setItem('VRCX_statusBarClockCount', '4'); storage.setItem('VRCX_statusBarClockCount', '4');
expect(loadClockCount(storage)).toBe(3); expect(loadClockCount(storage)).toBe(2);
storage.setItem('VRCX_statusBarClockCount', '-1'); storage.setItem('VRCX_statusBarClockCount', '-1');
expect(loadClockCount(storage)).toBe(3); expect(loadClockCount(storage)).toBe(2);
}); });
test('returns 3 for non-numeric values', () => { test('returns 2 for non-numeric values', () => {
storage.setItem('VRCX_statusBarClockCount', 'abc'); storage.setItem('VRCX_statusBarClockCount', 'abc');
expect(loadClockCount(storage)).toBe(3); expect(loadClockCount(storage)).toBe(2);
}); });
}); });
+2 -2
View File
@@ -131,7 +131,7 @@ export function loadClocks(storage, defaults) {
/** /**
* Load the clock count (0-3) from a Storage-like object. * Load the clock count (0-3) from a Storage-like object.
* Returns 3 when stored data is absent or invalid. * Returns 2 when stored data is absent or invalid.
* @param {Storage} storage * @param {Storage} storage
* @returns {number} * @returns {number}
*/ */
@@ -145,7 +145,7 @@ export function loadClockCount(storage) {
} catch { } catch {
// ignore // ignore
} }
return 3; return 2;
} }
/** /**