Skip to content

Commit

Permalink
tweak 36c922f
Browse files Browse the repository at this point in the history
  • Loading branch information
noridev committed Oct 5, 2024
1 parent 301876c commit 28b9205
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions packages/frontend/src/boot/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export async function common(createVue: () => App<Element>) {
let isClientMigrated = false;
const showPushNotificationDialog = miLocalStorage.getItem('showPushNotificationDialog');

if (miLocalStorage.getItem('ui') === null) miLocalStorage.setItem('ui', 'friendly');

if (instance.swPublickey && ('PushManager' in window) && $i && $i.token && showPushNotificationDialog == null) {
popup(defineAsyncComponent(() => import('@/components/MkPushNotification.vue')), {}, {}, 'closed');
}
Expand Down
9 changes: 6 additions & 3 deletions packages/frontend/src/pages/settings/navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ import { defaultStore } from '@/store.js';
import { reloadAsk } from '@/scripts/reload-ask.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { miLocalStorage } from '@/local-storage.js';
const isFriendly = ref(miLocalStorage.getItem('ui') === 'friendly');
const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.default));
Expand Down Expand Up @@ -152,11 +155,11 @@ function reset() {
}
function resetButtomNavbar() {
defaultStore.set('showHomeButtonInNavbar', true);
defaultStore.set('showExploreButtonInNavbar', true);
defaultStore.set('showHomeButtonInNavbar', !isFriendly.value);
defaultStore.set('showExploreButtonInNavbar', isFriendly.value);
defaultStore.set('showSearchButtonInNavbar', false);
defaultStore.set('showNotificationButtonInNavbar', true);
defaultStore.set('showMessageButtonInNavbar', true);
defaultStore.set('showMessageButtonInNavbar', isFriendly.value);
defaultStore.set('showWidgetButtonInNavbar', true);
}
Expand Down
8 changes: 5 additions & 3 deletions packages/frontend/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export const noteViewInterruptors: NoteViewInterruptor[] = [];
export const notePostInterruptors: NotePostInterruptor[] = [];
export const pageViewInterruptors: PageViewInterruptor[] = [];

const isFriendly = ref(miLocalStorage.getItem('ui') === 'friendly');

// TODO: それぞれいちいちwhereとかdefaultというキーを付けなきゃいけないの冗長なのでなんとかする(ただ型定義が面倒になりそう)
// あと、現行の定義の仕方なら「whereが何であるかに関わらずキー名の重複不可」という制約を付けられるメリットもあるからそのメリットを引き継ぐ方法も考えないといけない
export const defaultStore = markRaw(new Storage('base', {
Expand Down Expand Up @@ -658,15 +660,15 @@ export const defaultStore = markRaw(new Storage('base', {
// - Settings/Navigation bar
showMenuButtonInNavbar: {
where: 'device',
default: true,
default: !isFriendly.value,
},
showHomeButtonInNavbar: {
where: 'device',
default: true,
},
showExploreButtonInNavbar: {
where: 'device',
default: true,
default: isFriendly.value,
},
showSearchButtonInNavbar: {
where: 'device',
Expand All @@ -678,7 +680,7 @@ export const defaultStore = markRaw(new Storage('base', {
},
showMessageButtonInNavbar: {
where: 'device',
default: true,
default: isFriendly.value,
},
showWidgetButtonInNavbar: {
where: 'device',
Expand Down

0 comments on commit 28b9205

Please sign in to comment.