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
+1 -149
View File
@@ -3,11 +3,7 @@ import { createPinia, setActivePinia } from 'pinia';
const mocks = vi.hoisted(() => ({
execute: vi.fn(),
formatDateFilter: vi.fn(() => 'formatted-time'),
openExternalLink: vi.fn(),
toastWarning: vi.fn(() => 'toast-id-1'),
toastSuccess: vi.fn(() => 'toast-id-2'),
toastDismiss: vi.fn()
openExternalLink: vi.fn()
}));
vi.mock('../../services/webapi', () => ({
@@ -23,27 +19,10 @@ vi.mock('worker-timers', () => ({
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', () => ({
formatDateFilter: (...args) => mocks.formatDateFilter(...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('');
});
});
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);
});
});
-13
View File
@@ -109,7 +109,6 @@ export const useAppearanceSettingsStore = defineStore(
const isDataTableStriped = ref(false);
const showPointerOnHover = ref(false);
const showStatusBar = ref(true);
const tableLimitsDialog = ref({
visible: false,
maxTableSize: 500,
@@ -168,7 +167,6 @@ export const useAppearanceSettingsStore = defineStore(
navIsCollapsedConfig,
dataTableStripedConfig,
showPointerOnHoverConfig,
showStatusBarConfig,
appFontFamilyConfig,
lastDarkThemeConfig
] = await Promise.all([
@@ -232,7 +230,6 @@ export const useAppearanceSettingsStore = defineStore(
configRepository.getBool('VRCX_navIsCollapsed', false),
configRepository.getBool('VRCX_dataTableStriped', false),
configRepository.getBool('VRCX_showPointerOnHover', false),
configRepository.getBool('VRCX_showStatusBar', true),
configRepository.getString(
'VRCX_fontFamily',
APP_FONT_DEFAULT_KEY
@@ -333,7 +330,6 @@ export const useAppearanceSettingsStore = defineStore(
isNavCollapsed.value = navIsCollapsedConfig;
isDataTableStriped.value = dataTableStripedConfig;
showPointerOnHover.value = showPointerOnHoverConfig;
showStatusBar.value = showStatusBarConfig;
applyPointerHoverClass();
@@ -567,13 +563,6 @@ export const useAppearanceSettingsStore = defineStore(
showInstanceIdInLocation.value
);
}
/**
*
*/
function setShowStatusBar() {
showStatusBar.value = !showStatusBar.value;
configRepository.setBool('VRCX_showStatusBar', showStatusBar.value);
}
/**
*
*/
@@ -1105,7 +1094,6 @@ export const useAppearanceSettingsStore = defineStore(
isNavCollapsed,
isDataTableStriped,
showPointerOnHover,
showStatusBar,
tableLimitsDialog,
TABLE_MAX_SIZE_MIN,
TABLE_MAX_SIZE_MAX,
@@ -1116,7 +1104,6 @@ export const useAppearanceSettingsStore = defineStore(
setDisplayVRCPlusIconsAsAvatar,
setHideNicknames,
setShowInstanceIdInLocation,
setShowStatusBar,
setIsAgeGatedInstancesVisible,
setSortFavorites,
setInstanceUsersSortAlphabetical,
+2 -94
View File
@@ -1,9 +1,7 @@
import { computed, ref, watch } from 'vue';
import { computed, ref } from 'vue';
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';
@@ -18,14 +16,6 @@ export const useVrcStatusStore = defineStore('VrcStatus', () => {
const lastTimeFetched = 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(() => {
if (lastStatus.value && lastStatusSummary.value) {
return `${lastStatus.value}: ${lastStatusSummary.value}`;
@@ -35,17 +25,6 @@ export const useVrcStatusStore = defineStore('VrcStatus', () => {
const hasIssue = computed(() => !!lastStatus.value);
/**
* @returns {void}
*/
function dismissAlert() {
if (!alertRef.value) {
return;
}
toast.dismiss(alertRef.value);
alertRef.value = null;
}
/**
* @returns {void}
*/
@@ -53,75 +32,6 @@ export const useVrcStatusStore = defineStore('VrcStatus', () => {
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>}
*/
@@ -210,8 +120,6 @@ export const useVrcStatusStore = defineStore('VrcStatus', () => {
lastStatusSummary,
statusText,
hasIssue,
statusBarServersVisible,
setStatusBarServersVisible,
openStatusPage,
onBrowserFocus,
getVrcStatus