From 0d8c5f3dbe4a68fde679b6c456ec438eb9159589 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Wed, 7 May 2025 00:37:37 +0800 Subject: [PATCH] code refactor --- src/views/base/transactions/TransactionListPageBase.ts | 7 ------- src/views/desktop/transactions/ListPage.vue | 6 ++++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/views/base/transactions/TransactionListPageBase.ts b/src/views/base/transactions/TransactionListPageBase.ts index 30cd43b7..9e16527f 100644 --- a/src/views/base/transactions/TransactionListPageBase.ts +++ b/src/views/base/transactions/TransactionListPageBase.ts @@ -19,10 +19,6 @@ import type { TransactionCategory } from '@/models/transaction_category.ts'; import type { TransactionTag } from '@/models/transaction_tag.ts'; import type { Transaction } from '@/models/transaction.ts'; -import { - arrangeArrayWithNewStartIndex -} from '@/lib/common.ts'; - import { getUtcOffsetByUtcOffsetMinutes, getTimezoneOffset, @@ -72,7 +68,6 @@ export class TransactionListPageType implements TypeAndName { export function useTransactionListPageBase() { const { tt, - getAllLongWeekdayNames, getAllDateRanges, formatUnixTimeToLongDateTime, formatUnixTimeToLongDate, @@ -97,7 +92,6 @@ export function useTransactionListPageBase() { const currentTimezoneOffsetMinutes = computed(() => getTimezoneOffsetMinutes(settingsStore.appSettings.timeZone)); const firstDayOfWeek = computed(() => userStore.currentUserFirstDayOfWeek); - const dayNames = computed(() => arrangeArrayWithNewStartIndex(getAllLongWeekdayNames(), firstDayOfWeek.value)); const defaultCurrency = computed(() => getUnifiedSelectedAccountsCurrencyOrDefaultCurrency(allAccountsMap.value, queryAllFilterAccountIds.value, userStore.currentUserDefaultCurrency)); const showTotalAmountInTransactionListPage = computed(() => settingsStore.appSettings.showTotalAmountInTransactionListPage); const showTagInTransactionListPage = computed(() => settingsStore.appSettings.showTagInTransactionListPage); @@ -324,7 +318,6 @@ export function useTransactionListPageBase() { // computed states currentTimezoneOffsetMinutes, firstDayOfWeek, - dayNames, defaultCurrency, showTotalAmountInTransactionListPage, showTagInTransactionListPage, diff --git a/src/views/desktop/transactions/ListPage.vue b/src/views/desktop/transactions/ListPage.vue index a8b8abd1..33385b96 100644 --- a/src/views/desktop/transactions/ListPage.vue +++ b/src/views/desktop/transactions/ListPage.vue @@ -676,7 +676,8 @@ import type { TransactionTemplate } from '@/models/transaction_template.ts'; import { isObject, isString, - isNumber + isNumber, + arrangeArrayWithNewStartIndex } from '@/lib/common.ts'; import { getCurrentUnixTime, @@ -765,6 +766,7 @@ const theme = useTheme(); const { tt, + getAllLongWeekdayNames, getAllRecentMonthDateRanges, getAllTransactionTagFilterTypes, getMonthShortName, @@ -779,7 +781,6 @@ const { currentCalendarDate, currentTimezoneOffsetMinutes, firstDayOfWeek, - dayNames, defaultCurrency, showTotalAmountInTransactionListPage, showTagInTransactionListPage, @@ -860,6 +861,7 @@ const showFilterCategoryDialog = ref(false); const showFilterTagDialog = ref(false); const isDarkMode = computed(() => theme.global.name.value === ThemeType.Dark); +const dayNames = computed(() => arrangeArrayWithNewStartIndex(getAllLongWeekdayNames(), firstDayOfWeek.value)); const recentMonthDateRanges = computed(() => getAllRecentMonthDateRanges(pageType.value === TransactionListPageType.List.type, true));