code refactor

This commit is contained in:
MaysWind
2025-05-07 00:37:37 +08:00
parent dbbbe6805d
commit 0d8c5f3dbe
2 changed files with 4 additions and 9 deletions
@@ -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<number>(() => getTimezoneOffsetMinutes(settingsStore.appSettings.timeZone));
const firstDayOfWeek = computed<number>(() => userStore.currentUserFirstDayOfWeek);
const dayNames = computed<string[]>(() => arrangeArrayWithNewStartIndex(getAllLongWeekdayNames(), firstDayOfWeek.value));
const defaultCurrency = computed<string>(() => getUnifiedSelectedAccountsCurrencyOrDefaultCurrency(allAccountsMap.value, queryAllFilterAccountIds.value, userStore.currentUserDefaultCurrency));
const showTotalAmountInTransactionListPage = computed<boolean>(() => settingsStore.appSettings.showTotalAmountInTransactionListPage);
const showTagInTransactionListPage = computed<boolean>(() => settingsStore.appSettings.showTagInTransactionListPage);
@@ -324,7 +318,6 @@ export function useTransactionListPageBase() {
// computed states
currentTimezoneOffsetMinutes,
firstDayOfWeek,
dayNames,
defaultCurrency,
showTotalAmountInTransactionListPage,
showTagInTransactionListPage,
+4 -2
View File
@@ -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<boolean>(false);
const showFilterTagDialog = ref<boolean>(false);
const isDarkMode = computed<boolean>(() => theme.global.name.value === ThemeType.Dark);
const dayNames = computed<string[]>(() => arrangeArrayWithNewStartIndex(getAllLongWeekdayNames(), firstDayOfWeek.value));
const recentMonthDateRanges = computed<LocalizedRecentMonthDateRange[]>(() => getAllRecentMonthDateRanges(pageType.value === TransactionListPageType.List.type, true));