From 4ab2f16ed327dd0463d2f4353af9d5efee127e75 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 4 Jul 2022 01:37:47 +0900 Subject: [PATCH] enhance(client): tweak statusbar --- .../pages/settings/statusbars.statusbar.vue | 28 ++++--- .../client/src/pages/settings/statusbars.vue | 10 +-- packages/client/src/store.ts | 6 +- .../src/ui/_common_/statusbar-user-list.vue | 2 + .../client/src/ui/_common_/statusbars.vue | 77 ++++++++++--------- 5 files changed, 63 insertions(+), 60 deletions(-) diff --git a/packages/client/src/pages/settings/statusbars.statusbar.vue b/packages/client/src/pages/settings/statusbars.statusbar.vue index ad2fa557a..6b03ad46e 100644 --- a/packages/client/src/pages/settings/statusbars.statusbar.vue +++ b/packages/client/src/pages/settings/statusbars.statusbar.vue @@ -7,7 +7,7 @@ - + @@ -15,14 +15,23 @@ + + + + + + + + +
- save Delete
@@ -109,6 +117,8 @@ watch(() => statusbar.type, () => { } }); +watch(statusbar, save); + async function save() { const i = defaultStore.state.statusbars.findIndex(x => x.id === props._id); const statusbars = JSON.parse(JSON.stringify(defaultStore.state.statusbars)); diff --git a/packages/client/src/pages/settings/statusbars.vue b/packages/client/src/pages/settings/statusbars.vue index 18de11975..bcfff1652 100644 --- a/packages/client/src/pages/settings/statusbars.vue +++ b/packages/client/src/pages/settings/statusbars.vue @@ -6,14 +6,6 @@ add - - - - - - - - @@ -30,7 +22,6 @@ import { unisonReload } from '@/scripts/unison-reload'; import { i18n } from '@/i18n'; import { definePageMetadata } from '@/scripts/page-metadata'; -const statusbarSize = computed(defaultStore.makeGetterSetter('statusbarSize')); const statusbars = defaultStore.reactiveState.statusbars; let userLists = $ref(); @@ -46,6 +37,7 @@ async function add() { id: uuid(), type: null, black: false, + size: 'medium', props: {}, }); } diff --git a/packages/client/src/store.ts b/packages/client/src/store.ts index cde907017..7ddab18f0 100644 --- a/packages/client/src/store.ts +++ b/packages/client/src/store.ts @@ -94,13 +94,11 @@ export const defaultStore = markRaw(new Storage('base', { name: string; id: string; type: string; + size: 'verySmall' | 'small' | 'medium' | 'large' | 'veryLarge'; + black: boolean; props: Record; }[], }, - statusbarSize: { - where: 'deviceAccount', - default: 'medium', - }, widgets: { where: 'deviceAccount', default: [] as { diff --git a/packages/client/src/ui/_common_/statusbar-user-list.vue b/packages/client/src/ui/_common_/statusbar-user-list.vue index 2757e9118..12533d05f 100644 --- a/packages/client/src/ui/_common_/statusbar-user-list.vue +++ b/packages/client/src/ui/_common_/statusbar-user-list.vue @@ -52,6 +52,8 @@ const tick = () => { }); }; +watch(() => props.userListId, tick); + useInterval(tick, Math.max(5000, props.refreshIntervalSec * 1000), { immediate: true, afterMounted: true, diff --git a/packages/client/src/ui/_common_/statusbars.vue b/packages/client/src/ui/_common_/statusbars.vue index c18771c54..c448b0956 100644 --- a/packages/client/src/ui/_common_/statusbars.vue +++ b/packages/client/src/ui/_common_/statusbars.vue @@ -1,14 +1,14 @@