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 2db191a commit bc44409
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 10 deletions.
1 change: 1 addition & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ _lang_: "English"
widgets: "Widgets"
postNote: "Post note"
bottomNavbar: "Bottom navigation bar"
bottomNavbarDescription: "This setting is only available in a mobile environment."
scheduledNoteDelete: "Schedule note deletion"
getQRCode: "Get QR code"
customSplashText: "Custom splash text"
Expand Down
4 changes: 4 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export interface Locale extends ILocale {
* 下のナビゲーションバー
*/
"bottomNavbar": string;
/**
* この設定は、モバイル環境でのみ使用できます。
*/
"bottomNavbarDescription": string;
/**
* ノートの削除を予約
*/
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ _lang_: "日本語"
widgets: "ウィジェット"
postNote: "ノートを作成"
bottomNavbar: "下のナビゲーションバー"
bottomNavbarDescription: "この設定は、モバイル環境でのみ使用できます。"
scheduledNoteDelete: "ノートの削除を予約"
getQRCode: "QRコードを取得"
customSplashText: "カスタムスプラッシュテキスト"
Expand Down
1 change: 1 addition & 0 deletions locales/ko-KR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ _lang_: "한국어"
widgets: "위젯"
postNote: "노트 작성"
bottomNavbar: "하단 내비게이션 바"
bottomNavbarDescription: "이 설정은 모바일 환경에서만 사용할 수 있어요."
scheduledNoteDelete: "노트 삭제 예약"
getQRCode: "QR 코드 생성"
customSplashText: "사용자 정의 스플래시 텍스트"
Expand Down
35 changes: 25 additions & 10 deletions packages/frontend/src/pages/settings/navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,20 @@ SPDX-License-Identifier: AGPL-3.0-only

<FormSection>
<template #label>{{ i18n.ts.bottomNavbar }}</template>
<template v-if="!isMobile" #description>{{ i18n.ts.cannotBeUsedFunc }} <a class="_link" @click="learnMoreBottomNavbar">{{ i18n.ts.learnMore }}</a></template>
<div class="_gaps_m">
<MkSwitch v-model="showMenuButtonInNavbar"><i class="ti ti-menu-2"></i> {{ i18n.ts.menu }}</MkSwitch>
<MkSwitch v-model="showHomeButtonInNavbar"><i class="ti ti-home"></i> {{ i18n.ts.home }}</MkSwitch>
<MkSwitch v-model="showExploreButtonInNavbar"><i class="ti ti-hash"></i> {{ i18n.ts.explore }}</MkSwitch>
<MkSwitch v-model="showSearchButtonInNavbar"><i class="ti ti-search"></i> {{ i18n.ts.search }}</MkSwitch>
<MkSwitch v-model="showNotificationButtonInNavbar"><i class="ti ti-bell"></i> {{ i18n.ts.notifications }}</MkSwitch>
<MkSwitch v-model="showMessageButtonInNavbar"><i class="ti ti-messages"></i> {{ i18n.ts.messaging }}</MkSwitch>
<MkSwitch v-model="showWidgetButtonInNavbar"><i class="ti ti-apps"></i> {{ i18n.ts.widgets }}</MkSwitch>
<MkSwitch v-model="showPostButtonInNavbar"><i class="ti ti-pencil"></i> {{ i18n.ts.postNote }}</MkSwitch>
<MkSwitch v-model="showMenuButtonInNavbar" :disabled="!isMobile"><i class="ti ti-menu-2"></i> {{ i18n.ts.menu }}</MkSwitch>
<MkSwitch v-model="showHomeButtonInNavbar" :disabled="!isMobile"><i class="ti ti-home"></i> {{ i18n.ts.home }}</MkSwitch>
<MkSwitch v-model="showExploreButtonInNavbar" :disabled="!isMobile"><i class="ti ti-hash"></i> {{ i18n.ts.explore }}</MkSwitch>
<MkSwitch v-model="showSearchButtonInNavbar" :disabled="!isMobile"><i class="ti ti-search"></i> {{ i18n.ts.search }}</MkSwitch>
<MkSwitch v-model="showNotificationButtonInNavbar" :disabled="!isMobile"><i class="ti ti-bell"></i> {{ i18n.ts.notifications }}</MkSwitch>
<MkSwitch v-model="showMessageButtonInNavbar" :disabled="!isMobile"><i class="ti ti-messages"></i> {{ i18n.ts.messaging }}</MkSwitch>
<MkSwitch v-model="showWidgetButtonInNavbar" :disabled="!isMobile"><i class="ti ti-apps"></i> {{ i18n.ts.widgets }}</MkSwitch>
<MkSwitch v-model="showPostButtonInNavbar" :disabled="!isMobile"><i class="ti ti-pencil"></i> {{ i18n.ts.postNote }}</MkSwitch>
</div>
<div class="_buttons" style="margin-top: 20px;">
<MkButton danger @click="resetButtomNavbar"><i class="ti ti-reload"></i> {{ i18n.ts.default }}</MkButton>
<MkButton primary class="save" @click="reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true })"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
<MkButton :disabled="!isMobile" danger @click="resetButtomNavbar"><i class="ti ti-reload"></i> {{ i18n.ts.default }}</MkButton>
<MkButton :disabled="!isMobile" primary class="save" @click="reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true })"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
</div>
</FormSection>
</div>
Expand All @@ -88,7 +89,14 @@ 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';
import { deviceKind } from '@/scripts/device-kind.js';

const MOBILE_THRESHOLD = 500;

const isMobile = ref(deviceKind === 'smartphone' || window.innerWidth <= MOBILE_THRESHOLD);
window.addEventListener('resize', () => {
isMobile.value = deviceKind === 'smartphone' || window.innerWidth <= MOBILE_THRESHOLD;
});
const isFriendly = ref(miLocalStorage.getItem('ui') === 'friendly');

const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.default));
Expand Down Expand Up @@ -163,6 +171,13 @@ function resetButtomNavbar() {
defaultStore.set('showWidgetButtonInNavbar', true);
}

function learnMoreBottomNavbar() {
os.alert({
type: 'info',
text: i18n.ts.bottomNavbarDescription,
});
}

watch([menuDisplay, bannerDisplay], async () => {
await reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true });
});
Expand Down

0 comments on commit bc44409

Please sign in to comment.