diff --git a/src/consts/timezone.ts b/src/consts/timezone.ts index 58b24adb..ebe35d70 100644 --- a/src/consts/timezone.ts +++ b/src/consts/timezone.ts @@ -205,10 +205,7 @@ export const ALL_TIMEZONES: TimezoneInfo[] = [ timezoneName: 'Atlantic/Cape_Verde' }, // UTC - { - displayName: 'Coordinated Universal Time', - timezoneName: 'Etc/GMT' - }, + UTC_TIMEZONE, // UTC+00:00 { displayName: 'Dublin, Edinburgh, Lisbon, London', diff --git a/src/lib/category.js b/src/lib/category.js index d78f9052..d53116db 100644 --- a/src/lib/category.js +++ b/src/lib/category.js @@ -77,12 +77,10 @@ export function allTransactionCategoriesWithVisibleCount(allTransactionCategorie || allowCategoryTypes[CategoryType.Expense.toString()] || allowCategoryTypes[CategoryType.Transfer.toString()]); - for (let key in CategoryType) { - if (!Object.prototype.hasOwnProperty.call(CategoryType, key)) { - continue; - } + const allCategoryTypes = [ CategoryType.Income, CategoryType.Expense, CategoryType.Transfer ]; - const categoryType = CategoryType[key]; + for (let i = 0; i < allCategoryTypes.length; i++) { + const categoryType = allCategoryTypes[i]; if (!allTransactionCategories[categoryType]) { continue; diff --git a/src/lib/i18n.js b/src/lib/i18n.js index 71fdfd93..59687cab 100644 --- a/src/lib/i18n.js +++ b/src/lib/i18n.js @@ -206,11 +206,11 @@ function getCurrentLanguageDisplayName(i18nGlobal) { return currentLanguageInfo.displayName; } -function getLocalizedDisplayNameAndType(nameAndTypes, translateFn) { +function getLocalizedDisplayNameAndType(typeAndNames, translateFn) { const ret = []; - for (let i = 0; i < nameAndTypes.length; i++) { - const nameAndType = nameAndTypes[i]; + for (let i = 0; i < typeAndNames.length; i++) { + const nameAndType = typeAndNames[i]; ret.push({ type: nameAndType.type, diff --git a/src/lib/session.ts b/src/lib/session.ts index a16af5cb..e47e0e0f 100644 --- a/src/lib/session.ts +++ b/src/lib/session.ts @@ -1,6 +1,6 @@ import uaParser from 'ua-parser-js'; -import { CliUserAgent, type TokenInfoResponse, SessionInfo } from '@/models/token.ts'; +import { TOKEN_CLI_USER_AGENT, type TokenInfoResponse, SessionInfo } from '@/models/token.ts'; interface UserAgentInfo { device: { @@ -39,7 +39,7 @@ function parseUserAgent(ua: string): UserAgentInfo { } function isSessionUserAgentCreatedByCli(ua: string): boolean { - return ua === CliUserAgent; + return ua === TOKEN_CLI_USER_AGENT; } function parseDeviceInfo(uaInfo: UserAgentInfo): string { diff --git a/src/models/token.ts b/src/models/token.ts index fef3056c..72114502 100644 --- a/src/models/token.ts +++ b/src/models/token.ts @@ -1,4 +1,4 @@ -export const CliUserAgent: string = 'ezbookkeeping Cli'; +export const TOKEN_CLI_USER_AGENT: string = 'ezbookkeeping Cli'; export interface TokenInfoResponse { readonly tokenId: string; diff --git a/src/views/mobile/settings/CategoryFilterSettingsPage.vue b/src/views/mobile/settings/CategoryFilterSettingsPage.vue index ba2c9789..10d82650 100644 --- a/src/views/mobile/settings/CategoryFilterSettingsPage.vue +++ b/src/views/mobile/settings/CategoryFilterSettingsPage.vue @@ -166,8 +166,6 @@ export default { 'f7router' ], data: function () { - const self = this; - return { loading: true, loadingError: null, @@ -175,7 +173,17 @@ export default { allowCategoryTypes: null, filterCategoryIds: {}, showHidden: false, - collapseStates: self.getCollapseStates(), + collapseStates: { + [CategoryType.Income]: { + opened: true + }, + [CategoryType.Expense]: { + opened: true + }, + [CategoryType.Transfer]: { + opened: true + } + }, showMoreActionSheet: false } }, @@ -367,23 +375,6 @@ export default { }, isSubCategoriesHasButNotAllChecked(category, filterCategoryIds) { return isSubCategoriesHasButNotAllChecked(category, filterCategoryIds); - }, - getCollapseStates() { - const collapseStates = {}; - - for (const categoryTypeField in CategoryType) { - if (!Object.prototype.hasOwnProperty.call(CategoryType, categoryTypeField)) { - continue; - } - - const categoryType = CategoryType[categoryTypeField]; - - collapseStates[categoryType] = { - opened: true - }; - } - - return collapseStates; } } }