mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 09:44:26 +08:00
code refactor
This commit is contained in:
@@ -19,10 +19,6 @@ import type { TransactionCategory } from '@/models/transaction_category.ts';
|
|||||||
import type { TransactionTag } from '@/models/transaction_tag.ts';
|
import type { TransactionTag } from '@/models/transaction_tag.ts';
|
||||||
import type { Transaction } from '@/models/transaction.ts';
|
import type { Transaction } from '@/models/transaction.ts';
|
||||||
|
|
||||||
import {
|
|
||||||
arrangeArrayWithNewStartIndex
|
|
||||||
} from '@/lib/common.ts';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getUtcOffsetByUtcOffsetMinutes,
|
getUtcOffsetByUtcOffsetMinutes,
|
||||||
getTimezoneOffset,
|
getTimezoneOffset,
|
||||||
@@ -72,7 +68,6 @@ export class TransactionListPageType implements TypeAndName {
|
|||||||
export function useTransactionListPageBase() {
|
export function useTransactionListPageBase() {
|
||||||
const {
|
const {
|
||||||
tt,
|
tt,
|
||||||
getAllLongWeekdayNames,
|
|
||||||
getAllDateRanges,
|
getAllDateRanges,
|
||||||
formatUnixTimeToLongDateTime,
|
formatUnixTimeToLongDateTime,
|
||||||
formatUnixTimeToLongDate,
|
formatUnixTimeToLongDate,
|
||||||
@@ -97,7 +92,6 @@ export function useTransactionListPageBase() {
|
|||||||
|
|
||||||
const currentTimezoneOffsetMinutes = computed<number>(() => getTimezoneOffsetMinutes(settingsStore.appSettings.timeZone));
|
const currentTimezoneOffsetMinutes = computed<number>(() => getTimezoneOffsetMinutes(settingsStore.appSettings.timeZone));
|
||||||
const firstDayOfWeek = computed<number>(() => userStore.currentUserFirstDayOfWeek);
|
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 defaultCurrency = computed<string>(() => getUnifiedSelectedAccountsCurrencyOrDefaultCurrency(allAccountsMap.value, queryAllFilterAccountIds.value, userStore.currentUserDefaultCurrency));
|
||||||
const showTotalAmountInTransactionListPage = computed<boolean>(() => settingsStore.appSettings.showTotalAmountInTransactionListPage);
|
const showTotalAmountInTransactionListPage = computed<boolean>(() => settingsStore.appSettings.showTotalAmountInTransactionListPage);
|
||||||
const showTagInTransactionListPage = computed<boolean>(() => settingsStore.appSettings.showTagInTransactionListPage);
|
const showTagInTransactionListPage = computed<boolean>(() => settingsStore.appSettings.showTagInTransactionListPage);
|
||||||
@@ -324,7 +318,6 @@ export function useTransactionListPageBase() {
|
|||||||
// computed states
|
// computed states
|
||||||
currentTimezoneOffsetMinutes,
|
currentTimezoneOffsetMinutes,
|
||||||
firstDayOfWeek,
|
firstDayOfWeek,
|
||||||
dayNames,
|
|
||||||
defaultCurrency,
|
defaultCurrency,
|
||||||
showTotalAmountInTransactionListPage,
|
showTotalAmountInTransactionListPage,
|
||||||
showTagInTransactionListPage,
|
showTagInTransactionListPage,
|
||||||
|
|||||||
@@ -676,7 +676,8 @@ import type { TransactionTemplate } from '@/models/transaction_template.ts';
|
|||||||
import {
|
import {
|
||||||
isObject,
|
isObject,
|
||||||
isString,
|
isString,
|
||||||
isNumber
|
isNumber,
|
||||||
|
arrangeArrayWithNewStartIndex
|
||||||
} from '@/lib/common.ts';
|
} from '@/lib/common.ts';
|
||||||
import {
|
import {
|
||||||
getCurrentUnixTime,
|
getCurrentUnixTime,
|
||||||
@@ -765,6 +766,7 @@ const theme = useTheme();
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
tt,
|
tt,
|
||||||
|
getAllLongWeekdayNames,
|
||||||
getAllRecentMonthDateRanges,
|
getAllRecentMonthDateRanges,
|
||||||
getAllTransactionTagFilterTypes,
|
getAllTransactionTagFilterTypes,
|
||||||
getMonthShortName,
|
getMonthShortName,
|
||||||
@@ -779,7 +781,6 @@ const {
|
|||||||
currentCalendarDate,
|
currentCalendarDate,
|
||||||
currentTimezoneOffsetMinutes,
|
currentTimezoneOffsetMinutes,
|
||||||
firstDayOfWeek,
|
firstDayOfWeek,
|
||||||
dayNames,
|
|
||||||
defaultCurrency,
|
defaultCurrency,
|
||||||
showTotalAmountInTransactionListPage,
|
showTotalAmountInTransactionListPage,
|
||||||
showTagInTransactionListPage,
|
showTagInTransactionListPage,
|
||||||
@@ -860,6 +861,7 @@ const showFilterCategoryDialog = ref<boolean>(false);
|
|||||||
const showFilterTagDialog = ref<boolean>(false);
|
const showFilterTagDialog = ref<boolean>(false);
|
||||||
|
|
||||||
const isDarkMode = computed<boolean>(() => theme.global.name.value === ThemeType.Dark);
|
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));
|
const recentMonthDateRanges = computed<LocalizedRecentMonthDateRange[]>(() => getAllRecentMonthDateRanges(pageType.value === TransactionListPageType.List.type, true));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user