remove hide status setting

This commit is contained in:
pa
2026-03-13 00:29:00 +09:00
parent b10ceb9278
commit fbe290b788
7 changed files with 108 additions and 296 deletions

View File

@@ -79,7 +79,8 @@
</TooltipWrapper> </TooltipWrapper>
<div <div
v-else v-else
class="flex items-center gap-1 px-2 h-[22px] whitespace-nowrap border-r border-border"> class="flex items-center gap-1 px-2 h-[22px] whitespace-nowrap border-r border-border cursor-pointer hover:bg-accent"
@click="vrcStatusStore.openStatusPage()">
<span class="inline-block size-2 rounded-full shrink-0 bg-[#e6a23c]" /> <span class="inline-block size-2 rounded-full shrink-0 bg-[#e6a23c]" />
<span class="text-foreground text-[11px]">{{ t('status_bar.servers') }}</span> <span class="text-foreground text-[11px]">{{ t('status_bar.servers') }}</span>
</div> </div>
@@ -349,9 +350,6 @@
function toggleVisibility(key) { function toggleVisibility(key) {
visibility[key] = !visibility[key]; visibility[key] = !visibility[key];
configRepository.setString(VISIBILITY_KEY, JSON.stringify(visibility)); configRepository.setString(VISIBILITY_KEY, JSON.stringify(visibility));
if (key === 'servers') {
vrcStatusStore.setStatusBarServersVisible(visibility.servers);
}
} }
// --- WebSocket message rate + sparkline --- // --- WebSocket message rate + sparkline ---
@@ -543,12 +541,10 @@
} }
drawSparkline(); drawSparkline();
vrcStatusStore.setStatusBarServersVisible(visibility.servers);
}); });
onBeforeUnmount(() => { onBeforeUnmount(() => {
clearTimeout(serversHoverTimer); clearTimeout(serversHoverTimer);
vrcStatusStore.setStatusBarServersVisible(false);
}); });
watch( watch(

View File

@@ -3,11 +3,7 @@ import { createPinia, setActivePinia } from 'pinia';
const mocks = vi.hoisted(() => ({ const mocks = vi.hoisted(() => ({
execute: vi.fn(), execute: vi.fn(),
formatDateFilter: vi.fn(() => 'formatted-time'), openExternalLink: vi.fn()
openExternalLink: vi.fn(),
toastWarning: vi.fn(() => 'toast-id-1'),
toastSuccess: vi.fn(() => 'toast-id-2'),
toastDismiss: vi.fn()
})); }));
vi.mock('../../services/webapi', () => ({ vi.mock('../../services/webapi', () => ({
@@ -23,27 +19,10 @@ vi.mock('worker-timers', () => ({
clearTimeout: vi.fn() clearTimeout: vi.fn()
})); }));
vi.mock('vue-sonner', () => ({
toast: {
warning: (...args) => mocks.toastWarning(...args),
success: (...args) => mocks.toastSuccess(...args),
dismiss: (...args) => mocks.toastDismiss(...args)
}
}));
vi.mock('../../shared/utils', () => ({ vi.mock('../../shared/utils', () => ({
formatDateFilter: (...args) => mocks.formatDateFilter(...args),
openExternalLink: (...args) => mocks.openExternalLink(...args) openExternalLink: (...args) => mocks.openExternalLink(...args)
})); }));
vi.mock('vue-i18n', () => ({
useI18n: () => ({
t: (key) => key
,
locale: require('vue').ref('en')
})
}));
/** /**
* *
*/ */
@@ -137,130 +116,3 @@ describe('useVrcStatusStore.getVrcStatus', () => {
expect(store.statusText).toBe(''); expect(store.statusText).toBe('');
}); });
}); });
describe('useVrcStatusStore dual-mode notification', () => {
beforeEach(async () => {
mocks.execute.mockResolvedValue({
status: 200,
data: JSON.stringify({
page: { updated_at: '2026-01-01T00:00:00.000Z' },
status: { description: 'All Systems Operational' }
})
});
setActivePinia(createPinia());
useVrcStatusStore();
await flushPromises();
vi.clearAllMocks();
});
test('does not show toast before initialized (startup race prevention)', async () => {
const store = useVrcStatusStore();
// Do NOT call setStatusBarServersVisible — initialized remains false
mocks.execute
.mockResolvedValueOnce({
status: 200,
data: JSON.stringify({
page: { updated_at: '2026-01-02T00:00:00.000Z' },
status: { description: 'Partial System Outage' }
})
})
.mockResolvedValueOnce({
status: 200,
data: JSON.stringify({
components: [{ name: 'API', status: 'major_outage' }]
})
});
await store.getVrcStatus();
await flushPromises();
expect(mocks.toastWarning).not.toHaveBeenCalled();
});
test('shows toast when statusBarServersVisible is false and initialized', async () => {
const store = useVrcStatusStore();
// Initialize via action (simulates StatusBar onMounted with servers=false)
store.setStatusBarServersVisible(false);
mocks.execute
.mockResolvedValueOnce({
status: 200,
data: JSON.stringify({
page: { updated_at: '2026-01-02T00:00:00.000Z' },
status: { description: 'Partial System Outage' }
})
})
.mockResolvedValueOnce({
status: 200,
data: JSON.stringify({
components: [{ name: 'API', status: 'major_outage' }]
})
});
await store.getVrcStatus();
await flushPromises();
expect(mocks.toastWarning).toHaveBeenCalled();
expect(mocks.toastWarning.mock.calls[0][0]).toBe(
'status_bar.servers_issue'
);
});
test('does NOT show toast when statusBarServersVisible is true', async () => {
const store = useVrcStatusStore();
store.setStatusBarServersVisible(true);
mocks.execute
.mockResolvedValueOnce({
status: 200,
data: JSON.stringify({
page: { updated_at: '2026-01-02T00:00:00.000Z' },
status: { description: 'Partial System Outage' }
})
})
.mockResolvedValueOnce({
status: 200,
data: JSON.stringify({
components: [{ name: 'API', status: 'major_outage' }]
})
});
await store.getVrcStatus();
await flushPromises();
expect(mocks.toastWarning).not.toHaveBeenCalled();
});
test('triggers toast when switching from StatusBar mode to toast mode with active issue', async () => {
const store = useVrcStatusStore();
store.setStatusBarServersVisible(true);
// Create an issue while in StatusBar mode
mocks.execute
.mockResolvedValueOnce({
status: 200,
data: JSON.stringify({
page: { updated_at: '2026-01-02T00:00:00.000Z' },
status: { description: 'Major Outage' }
})
})
.mockResolvedValueOnce({
status: 200,
data: JSON.stringify({
components: [{ name: 'API', status: 'major_outage' }]
})
});
await store.getVrcStatus();
await flushPromises();
expect(mocks.toastWarning).not.toHaveBeenCalled();
// Switch to toast mode - should trigger notification
store.setStatusBarServersVisible(false);
await flushPromises();
expect(mocks.toastWarning).toHaveBeenCalledTimes(1);
});
});

View File

@@ -109,7 +109,6 @@ export const useAppearanceSettingsStore = defineStore(
const isDataTableStriped = ref(false); const isDataTableStriped = ref(false);
const showPointerOnHover = ref(false); const showPointerOnHover = ref(false);
const showStatusBar = ref(true);
const tableLimitsDialog = ref({ const tableLimitsDialog = ref({
visible: false, visible: false,
maxTableSize: 500, maxTableSize: 500,
@@ -168,7 +167,6 @@ export const useAppearanceSettingsStore = defineStore(
navIsCollapsedConfig, navIsCollapsedConfig,
dataTableStripedConfig, dataTableStripedConfig,
showPointerOnHoverConfig, showPointerOnHoverConfig,
showStatusBarConfig,
appFontFamilyConfig, appFontFamilyConfig,
lastDarkThemeConfig lastDarkThemeConfig
] = await Promise.all([ ] = await Promise.all([
@@ -232,7 +230,6 @@ export const useAppearanceSettingsStore = defineStore(
configRepository.getBool('VRCX_navIsCollapsed', false), configRepository.getBool('VRCX_navIsCollapsed', false),
configRepository.getBool('VRCX_dataTableStriped', false), configRepository.getBool('VRCX_dataTableStriped', false),
configRepository.getBool('VRCX_showPointerOnHover', false), configRepository.getBool('VRCX_showPointerOnHover', false),
configRepository.getBool('VRCX_showStatusBar', true),
configRepository.getString( configRepository.getString(
'VRCX_fontFamily', 'VRCX_fontFamily',
APP_FONT_DEFAULT_KEY APP_FONT_DEFAULT_KEY
@@ -333,7 +330,6 @@ export const useAppearanceSettingsStore = defineStore(
isNavCollapsed.value = navIsCollapsedConfig; isNavCollapsed.value = navIsCollapsedConfig;
isDataTableStriped.value = dataTableStripedConfig; isDataTableStriped.value = dataTableStripedConfig;
showPointerOnHover.value = showPointerOnHoverConfig; showPointerOnHover.value = showPointerOnHoverConfig;
showStatusBar.value = showStatusBarConfig;
applyPointerHoverClass(); applyPointerHoverClass();
@@ -567,13 +563,6 @@ export const useAppearanceSettingsStore = defineStore(
showInstanceIdInLocation.value showInstanceIdInLocation.value
); );
} }
/**
*
*/
function setShowStatusBar() {
showStatusBar.value = !showStatusBar.value;
configRepository.setBool('VRCX_showStatusBar', showStatusBar.value);
}
/** /**
* *
*/ */
@@ -1105,7 +1094,6 @@ export const useAppearanceSettingsStore = defineStore(
isNavCollapsed, isNavCollapsed,
isDataTableStriped, isDataTableStriped,
showPointerOnHover, showPointerOnHover,
showStatusBar,
tableLimitsDialog, tableLimitsDialog,
TABLE_MAX_SIZE_MIN, TABLE_MAX_SIZE_MIN,
TABLE_MAX_SIZE_MAX, TABLE_MAX_SIZE_MAX,
@@ -1116,7 +1104,6 @@ export const useAppearanceSettingsStore = defineStore(
setDisplayVRCPlusIconsAsAvatar, setDisplayVRCPlusIconsAsAvatar,
setHideNicknames, setHideNicknames,
setShowInstanceIdInLocation, setShowInstanceIdInLocation,
setShowStatusBar,
setIsAgeGatedInstancesVisible, setIsAgeGatedInstancesVisible,
setSortFavorites, setSortFavorites,
setInstanceUsersSortAlphabetical, setInstanceUsersSortAlphabetical,

View File

@@ -1,9 +1,7 @@
import { computed, ref, watch } from 'vue'; import { computed, ref } from 'vue';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { toast } from 'vue-sonner';
import { useI18n } from 'vue-i18n';
import { formatDateFilter, openExternalLink } from '../shared/utils'; import { openExternalLink } from '../shared/utils';
import webApiService from '../services/webapi'; import webApiService from '../services/webapi';
@@ -18,14 +16,6 @@ export const useVrcStatusStore = defineStore('VrcStatus', () => {
const lastTimeFetched = ref(0); const lastTimeFetched = ref(0);
const pollingInterval = ref(0); const pollingInterval = ref(0);
const statusBarServersVisible = ref(false);
const initialized = ref(false);
const alertRef = ref(null);
const lastStatusText = ref('');
const { t } = useI18n();
const statusText = computed(() => { const statusText = computed(() => {
if (lastStatus.value && lastStatusSummary.value) { if (lastStatus.value && lastStatusSummary.value) {
return `${lastStatus.value}: ${lastStatusSummary.value}`; return `${lastStatus.value}: ${lastStatusSummary.value}`;
@@ -35,17 +25,6 @@ export const useVrcStatusStore = defineStore('VrcStatus', () => {
const hasIssue = computed(() => !!lastStatus.value); const hasIssue = computed(() => !!lastStatus.value);
/**
* @returns {void}
*/
function dismissAlert() {
if (!alertRef.value) {
return;
}
toast.dismiss(alertRef.value);
alertRef.value = null;
}
/** /**
* @returns {void} * @returns {void}
*/ */
@@ -53,75 +32,6 @@ export const useVrcStatusStore = defineStore('VrcStatus', () => {
openExternalLink('https://status.vrchat.com'); openExternalLink('https://status.vrchat.com');
} }
/**
* @param {boolean} visible
* @returns {void}
*/
function setStatusBarServersVisible(visible) {
statusBarServersVisible.value = visible;
if (!initialized.value) {
initialized.value = true;
}
}
/**
* @param {string} text
* @returns {void}
*/
function showWarningToast(text) {
dismissAlert();
alertRef.value = toast.warning(t('status_bar.servers_issue'), {
description: `${formatDateFilter(lastStatusTime.value, 'short')}: ${text}`,
duration: Infinity,
closeButton: true,
position: 'bottom-right',
action: {
label: 'Open',
onClick: () => openStatusPage()
}
});
}
watch(statusText, (newVal) => {
if (statusBarServersVisible.value || !initialized.value) {
return;
}
if (lastStatusText.value === newVal) {
return;
}
lastStatusText.value = newVal;
if (!newVal) {
if (alertRef.value) {
dismissAlert();
alertRef.value = toast.success(t('status_bar.servers_issue'), {
description: `${formatDateFilter(lastStatusTime.value, 'short')}: ${t('status_bar.servers_ok')}`,
position: 'bottom-right',
action: {
label: 'Open',
onClick: () => openStatusPage()
}
});
}
return;
}
showWarningToast(newVal);
});
watch(statusBarServersVisible, (visible) => {
if (!visible && hasIssue.value && statusText.value) {
lastStatusText.value = '';
showWarningToast(statusText.value);
lastStatusText.value = statusText.value;
}
if (visible) {
dismissAlert();
lastStatusText.value = '';
}
});
/** /**
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
@@ -210,8 +120,6 @@ export const useVrcStatusStore = defineStore('VrcStatus', () => {
lastStatusSummary, lastStatusSummary,
statusText, statusText,
hasIssue, hasIssue,
statusBarServersVisible,
setStatusBarServersVisible,
openStatusPage, openStatusPage,
onBrowserFocus, onBrowserFocus,
getVrcStatus getVrcStatus

View File

@@ -53,7 +53,7 @@
</ResizablePanelGroup> </ResizablePanelGroup>
</SidebarInset> </SidebarInset>
</SidebarProvider> </SidebarProvider>
<StatusBar v-if="showStatusBar" /> <StatusBar />
</div> </div>
<!-- ## Dialogs ## --> <!-- ## Dialogs ## -->
@@ -119,7 +119,7 @@
const router = useRouter(); const router = useRouter();
const appearanceSettingsStore = useAppearanceSettingsStore(); const appearanceSettingsStore = useAppearanceSettingsStore();
const { navWidth, isNavCollapsed, showStatusBar } = storeToRefs(appearanceSettingsStore); const { navWidth, isNavCollapsed } = storeToRefs(appearanceSettingsStore);
const sidebarOpen = computed(() => !isNavCollapsed.value); const sidebarOpen = computed(() => !isNavCollapsed.value);

View File

@@ -2,38 +2,113 @@ import { describe, expect, it, vi } from 'vitest';
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import { ref } from 'vue'; import { ref } from 'vue';
const mocks = vi.hoisted(() => ({ replace: vi.fn(), setNavCollapsed: vi.fn(), setNavWidth: vi.fn() })); const mocks = vi.hoisted(() => ({
replace: vi.fn(),
setNavCollapsed: vi.fn(),
setNavWidth: vi.fn()
}));
vi.mock('pinia', async (i) => ({ ...(await i()), storeToRefs: (s) => s })); vi.mock('pinia', async (i) => ({ ...(await i()), storeToRefs: (s) => s }));
vi.mock('vue-router', () => ({ useRouter: () => ({ replace: (...a) => mocks.replace(...a) }) })); vi.mock('vue-router', () => ({
vi.mock('../../../services/watchState', () => ({ watchState: { isLoggedIn: false } })); useRouter: () => ({ replace: (...a) => mocks.replace(...a) })
vi.mock('../../../stores', () => ({ useAppearanceSettingsStore: () => ({ navWidth: ref(240), isNavCollapsed: ref(false), showStatusBar: ref(false), setNavCollapsed: (...a) => mocks.setNavCollapsed(...a), setNavWidth: (...a) => mocks.setNavWidth(...a) }) })); }));
vi.mock('../../../composables/useMainLayoutResizable', () => ({ useMainLayoutResizable: () => ({ asideDefaultSize: 30, asideMinSize: 0, asideMaxPx: 480, mainDefaultSize: 70, handleLayout: vi.fn(), isAsideCollapsed: () => false, isAsideCollapsedStatic: false, isSideBarTabShow: ref(true) }) })); vi.mock('../../../services/watchState', () => ({
vi.mock('../../../components/ui/resizable', () => ({ ResizablePanelGroup: { template: '<div><slot :layout="[]" /></div>' }, ResizablePanel: { template: '<div><slot /></div>' }, ResizableHandle: { template: '<div />' } })); watchState: { isLoggedIn: false }
vi.mock('../../../components/ui/sidebar', () => ({ SidebarProvider: { template: '<div><slot /></div>' }, SidebarInset: { template: '<div><slot /></div>' } })); }));
vi.mock('../../../components/nav-menu/NavMenu.vue', () => ({ default: { template: '<div />' } })); vi.mock('../../../stores', () => ({
vi.mock('../../Sidebar/Sidebar.vue', () => ({ default: { template: '<div />' } })); useAppearanceSettingsStore: () => ({
vi.mock('../../../components/StatusBar.vue', () => ({ default: { template: '<div />' } })); navWidth: ref(240),
vi.mock('../../../components/dialogs/MainDialogContainer.vue', () => ({ default: { template: '<div />' } })); isNavCollapsed: ref(false),
vi.mock('../../../components/FullscreenImagePreview.vue', () => ({ default: { template: '<div />' } })); setNavCollapsed: (...a) => mocks.setNavCollapsed(...a),
vi.mock('../../../components/dialogs/ChooseFavoriteGroupDialog.vue', () => ({ default: { template: '<div />' } })); setNavWidth: (...a) => mocks.setNavWidth(...a)
vi.mock('../../../components/dialogs/LaunchDialog.vue', () => ({ default: { template: '<div />' } })); })
vi.mock('../../Settings/dialogs/LaunchOptionsDialog.vue', () => ({ default: { template: '<div />' } })); }));
vi.mock('../../Favorites/dialogs/FriendImportDialog.vue', () => ({ default: { template: '<div />' } })); vi.mock('../../../composables/useMainLayoutResizable', () => ({
vi.mock('../../Favorites/dialogs/WorldImportDialog.vue', () => ({ default: { template: '<div />' } })); useMainLayoutResizable: () => ({
vi.mock('../../Favorites/dialogs/AvatarImportDialog.vue', () => ({ default: { template: '<div />' } })); asideDefaultSize: 30,
vi.mock('../../../components/dialogs/GroupDialog/GroupMemberModerationDialog.vue', () => ({ default: { template: '<div />' } })); asideMinSize: 0,
vi.mock('../../../components/dialogs/InviteGroupDialog.vue', () => ({ default: { template: '<div />' } })); asideMaxPx: 480,
vi.mock('../../Settings/dialogs/VRChatConfigDialog.vue', () => ({ default: { template: '<div />' } })); mainDefaultSize: 70,
vi.mock('../../Settings/dialogs/PrimaryPasswordDialog.vue', () => ({ default: { template: '<div />' } })); handleLayout: vi.fn(),
vi.mock('../../../components/dialogs/SendBoopDialog.vue', () => ({ default: { template: '<div />' } })); isAsideCollapsed: () => false,
vi.mock('../../Settings/dialogs/ChangelogDialog.vue', () => ({ default: { template: '<div />' } })); isAsideCollapsedStatic: false,
isSideBarTabShow: ref(true)
})
}));
vi.mock('../../../components/ui/resizable', () => ({
ResizablePanelGroup: { template: '<div><slot :layout="[]" /></div>' },
ResizablePanel: { template: '<div><slot /></div>' },
ResizableHandle: { template: '<div />' }
}));
vi.mock('../../../components/ui/sidebar', () => ({
SidebarProvider: { template: '<div><slot /></div>' },
SidebarInset: { template: '<div><slot /></div>' }
}));
vi.mock('../../../components/nav-menu/NavMenu.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../../Sidebar/Sidebar.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../../../components/StatusBar.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../../../components/dialogs/MainDialogContainer.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../../../components/FullscreenImagePreview.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../../../components/dialogs/ChooseFavoriteGroupDialog.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../../../components/dialogs/LaunchDialog.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../../Settings/dialogs/LaunchOptionsDialog.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../../Favorites/dialogs/FriendImportDialog.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../../Favorites/dialogs/WorldImportDialog.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../../Favorites/dialogs/AvatarImportDialog.vue', () => ({
default: { template: '<div />' }
}));
vi.mock(
'../../../components/dialogs/GroupDialog/GroupMemberModerationDialog.vue',
() => ({ default: { template: '<div />' } })
);
vi.mock('../../../components/dialogs/InviteGroupDialog.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../../Settings/dialogs/VRChatConfigDialog.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../../Settings/dialogs/PrimaryPasswordDialog.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../../../components/dialogs/SendBoopDialog.vue', () => ({
default: { template: '<div />' }
}));
vi.mock('../../Settings/dialogs/ChangelogDialog.vue', () => ({
default: { template: '<div />' }
}));
import MainLayout from '../MainLayout.vue'; import MainLayout from '../MainLayout.vue';
describe('MainLayout.vue', () => { describe('MainLayout.vue', () => {
it('redirects to login when not logged in', () => { it('redirects to login when not logged in', () => {
mount(MainLayout, { global: { stubs: { RouterView: { template: '<div />' }, KeepAlive: { template: '<div><slot /></div>' } } } }); mount(MainLayout, {
global: {
stubs: {
RouterView: { template: '<div />' },
KeepAlive: { template: '<div><slot /></div>' }
}
}
});
expect(mocks.replace).toHaveBeenCalledWith({ name: 'login' }); expect(mocks.replace).toHaveBeenCalledWith({ name: 'login' });
}); });
}); });

View File

@@ -82,10 +82,6 @@
:label="t('view.settings.appearance.appearance.show_instance_id')" :label="t('view.settings.appearance.appearance.show_instance_id')"
:value="showInstanceIdInLocation" :value="showInstanceIdInLocation"
@change="setShowInstanceIdInLocation" /> @change="setShowInstanceIdInLocation" />
<simple-switch
:label="t('view.settings.appearance.appearance.show_status_bar')"
:value="showStatusBar"
@change="setShowStatusBar" />
<simple-switch <simple-switch
:label="t('view.settings.appearance.appearance.nicknames')" :label="t('view.settings.appearance.appearance.nicknames')"
:value="!hideNicknames" :value="!hideNicknames"
@@ -393,8 +389,7 @@
notificationIconDot, notificationIconDot,
tablePageSizes, tablePageSizes,
isDataTableStriped, isDataTableStriped,
showPointerOnHover, showPointerOnHover
showStatusBar
} = storeToRefs(appearanceSettingsStore); } = storeToRefs(appearanceSettingsStore);
const appLanguageDisplayName = computed(() => getLanguageName(String(appLanguage.value))); const appLanguageDisplayName = computed(() => getLanguageName(String(appLanguage.value)));
@@ -403,7 +398,6 @@
setDisplayVRCPlusIconsAsAvatar, setDisplayVRCPlusIconsAsAvatar,
setHideNicknames, setHideNicknames,
setShowInstanceIdInLocation, setShowInstanceIdInLocation,
setShowStatusBar,
setIsAgeGatedInstancesVisible, setIsAgeGatedInstancesVisible,
setInstanceUsersSortAlphabetical, setInstanceUsersSortAlphabetical,
setDtHour12, setDtHour12,