From a29ff0d553311fc4ee40c331e713d041626ad4b8 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 9 Mar 2025 20:15:04 +0800 Subject: [PATCH] show add transaction button in desktop navigation bar (#59) --- src/core/setting.ts | 2 ++ src/locales/de.json | 2 ++ src/locales/en.json | 2 ++ src/locales/es.json | 2 ++ src/locales/ja.json | 2 ++ src/locales/ru.json | 2 ++ src/locales/vi.json | 2 ++ src/locales/zh_Hans.json | 2 ++ src/stores/desktopPage.ts | 22 +++++++++++++ src/stores/setting.ts | 6 ++++ src/views/desktop/MainLayout.vue | 16 +++++++++- .../app/settings/tabs/AppBasicSettingTab.vue | 27 ++++++++++++++++ src/views/desktop/transactions/ListPage.vue | 32 ++++++++++++++----- 13 files changed, 110 insertions(+), 9 deletions(-) create mode 100644 src/stores/desktopPage.ts diff --git a/src/core/setting.ts b/src/core/setting.ts index dcf64c4e..9dc4ec8e 100644 --- a/src/core/setting.ts +++ b/src/core/setting.ts @@ -29,6 +29,7 @@ export interface ApplicationSettings extends BaseApplicationSetting { autoUpdateExchangeRatesData: boolean; autoSaveTransactionDraft: string; autoGetCurrentGeoLocation: boolean; + showAddTransactionButtonInDesktopNavbar: boolean; showAmountInHomePage: boolean; timezoneUsedForStatisticsInHomePage: number; itemsCountInTransactionListPage: number; @@ -74,6 +75,7 @@ export const DEFAULT_APPLICATION_SETTINGS: ApplicationSettings = { autoUpdateExchangeRatesData: true, autoSaveTransactionDraft: 'disabled', autoGetCurrentGeoLocation: false, + showAddTransactionButtonInDesktopNavbar: true, showAmountInHomePage: true, timezoneUsedForStatisticsInHomePage: TimezoneTypeForStatistics.Default.type, itemsCountInTransactionListPage: 15, diff --git a/src/locales/de.json b/src/locales/de.json index 9014c784..2b979da8 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -1789,6 +1789,8 @@ "Show Account Balance": "Kontostand anzeigen", "Hide Account Balance": "Kontostand verbergen", "Page Settings": "Seiteneinstellungen", + "Navigation Bar": "Navigation Bar", + "Show Add Transaction Button": "Show Add Transaction Button", "Overview Page": "Übersichtsseite", "Timezone Used for Statistics": "Zeitzone für Statistiken", "Timezone Type": "Zeitzonentyp", diff --git a/src/locales/en.json b/src/locales/en.json index 834f2d7a..736daf80 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1789,6 +1789,8 @@ "Show Account Balance": "Show Account Balance", "Hide Account Balance": "Hide Account Balance", "Page Settings": "Page Settings", + "Navigation Bar": "Navigation Bar", + "Show Add Transaction Button": "Show Add Transaction Button", "Overview Page": "Overview Page", "Timezone Used for Statistics": "Timezone Used for Statistics", "Timezone Type": "Timezone Type", diff --git a/src/locales/es.json b/src/locales/es.json index c620710c..212003a1 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -1789,6 +1789,8 @@ "Show Account Balance": "Mostrar saldo de cuenta", "Hide Account Balance": "Ocultar saldo de cuenta", "Page Settings": "Configuración de página", + "Navigation Bar": "Navigation Bar", + "Show Add Transaction Button": "Show Add Transaction Button", "Overview Page": "Página de descripción general", "Timezone Used for Statistics": "Zona horaria utilizada para estadísticas", "Timezone Type": "Tipo de zona horaria", diff --git a/src/locales/ja.json b/src/locales/ja.json index 2a432dec..e347c5b3 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -1789,6 +1789,8 @@ "Show Account Balance": "口座残高を表示", "Hide Account Balance": "口座残高を非表示", "Page Settings": "ページ設定", + "Navigation Bar": "Navigation Bar", + "Show Add Transaction Button": "Show Add Transaction Button", "Overview Page": "概要ページ", "Timezone Used for Statistics": "統計に使用されるタイムゾーン", "Timezone Type": "タイムゾーンタイプ", diff --git a/src/locales/ru.json b/src/locales/ru.json index b380e147..70b15927 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -1789,6 +1789,8 @@ "Show Account Balance": "Показать баланс счета", "Hide Account Balance": "Скрыть баланс счета", "Page Settings": "Настройки страницы", + "Navigation Bar": "Navigation Bar", + "Show Add Transaction Button": "Show Add Transaction Button", "Overview Page": "Страница обзора", "Timezone Used for Statistics": "Часовой пояс, используемый для статистики", "Timezone Type": "Тип часового пояса", diff --git a/src/locales/vi.json b/src/locales/vi.json index 31ba2322..2e32c968 100644 --- a/src/locales/vi.json +++ b/src/locales/vi.json @@ -1789,6 +1789,8 @@ "Show Account Balance": "Hiển thị số dư tài khoản", "Hide Account Balance": "Ẩn số dư tài khoản", "Page Settings": "Cài đặt trang", + "Navigation Bar": "Navigation Bar", + "Show Add Transaction Button": "Show Add Transaction Button", "Overview Page": "Trang tổng quan", "Timezone Used for Statistics": "Múi giờ được sử dụng cho thống kê", "Timezone Type": "Loại múi giờ", diff --git a/src/locales/zh_Hans.json b/src/locales/zh_Hans.json index fdf47cd4..abecc9e8 100644 --- a/src/locales/zh_Hans.json +++ b/src/locales/zh_Hans.json @@ -1789,6 +1789,8 @@ "Show Account Balance": "显示账户余额", "Hide Account Balance": "隐藏账户余额", "Page Settings": "页面设置", + "Navigation Bar": "导航栏", + "Show Add Transaction Button": "显示添加交易按钮", "Overview Page": "总览页面", "Timezone Used for Statistics": "统计时使用的时区", "Timezone Type": "时区类型", diff --git a/src/stores/desktopPage.ts b/src/stores/desktopPage.ts new file mode 100644 index 00000000..1893b09a --- /dev/null +++ b/src/stores/desktopPage.ts @@ -0,0 +1,22 @@ +import { ref } from 'vue'; +import { defineStore } from 'pinia'; + +export const useDesktopPageStore = defineStore('desktopPages', () => { + const showAddTransactionDialogInTransactionList = ref(false); + + function setShowAddTransactionDialogInTransactionList(): void { + showAddTransactionDialogInTransactionList.value = true; + } + + function resetShowAddTransactionDialogInTransactionList(): void { + showAddTransactionDialogInTransactionList.value = false; + } + + return { + // states + showAddTransactionDialogInTransactionList, + // functions + setShowAddTransactionDialogInTransactionList, + resetShowAddTransactionDialogInTransactionList + } +}); diff --git a/src/stores/setting.ts b/src/stores/setting.ts index a01662c4..e9295d34 100644 --- a/src/stores/setting.ts +++ b/src/stores/setting.ts @@ -54,6 +54,11 @@ export const useSettingsStore = defineStore('settings', () => { appSettings.value.autoGetCurrentGeoLocation = value; } + function setShowAddTransactionButtonInDesktopNavbar(value: boolean): void { + updateApplicationSettingsValue('showAddTransactionButtonInDesktopNavbar', value); + appSettings.value.showAddTransactionButtonInDesktopNavbar = value; + } + function setShowAmountInHomePage(value: boolean): void { updateApplicationSettingsValue('showAmountInHomePage', value); appSettings.value.showAmountInHomePage = value; @@ -166,6 +171,7 @@ export const useSettingsStore = defineStore('settings', () => { setAutoUpdateExchangeRatesData, setAutoSaveTransactionDraft, setAutoGetCurrentGeoLocation, + setShowAddTransactionButtonInDesktopNavbar, setShowAmountInHomePage, setTimezoneUsedForStatisticsInHomePage, setItemsCountInTransactionListPage, diff --git a/src/views/desktop/MainLayout.vue b/src/views/desktop/MainLayout.vue index ec93d867..c3c61c51 100644 --- a/src/views/desktop/MainLayout.vue +++ b/src/views/desktop/MainLayout.vue @@ -29,7 +29,13 @@