From a7ca394864434a6e6d9cccf256bce5266f6083ed Mon Sep 17 00:00:00 2001
From: MaysWind
Date: Fri, 21 Apr 2023 22:20:11 +0800
Subject: [PATCH] code refactor
---
.eslintrc.js | 4 ++--
.../mobile/DateTimeSelectionSheet.vue | 20 +++++++++----------
src/components/mobile/InformationSheet.vue | 2 +-
.../mobile/TransactionTagSelectionSheet.vue | 2 +-
src/consts/timezone.js | 3 ++-
src/lib/i18n.js | 8 ++++----
src/views/mobile/ExchangeRates.vue | 2 +-
src/views/mobile/tags/List.vue | 1 -
src/views/mobile/users/TwoFactorAuth.vue | 2 +-
9 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/.eslintrc.js b/.eslintrc.js
index 221c4d85..e6ac97b1 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -8,7 +8,7 @@ module.exports = {
'plugin:vue/vue3-essential'
],
'rules': {
- "vue/multi-word-component-names": "off",
- "vue/no-use-v-if-with-v-for": "off"
+ 'vue/multi-word-component-names': 'off',
+ 'vue/no-use-v-if-with-v-for': 'off'
}
}
diff --git a/src/components/mobile/DateTimeSelectionSheet.vue b/src/components/mobile/DateTimeSelectionSheet.vue
index 2c3825b3..1e5fc9a4 100644
--- a/src/components/mobile/DateTimeSelectionSheet.vue
+++ b/src/components/mobile/DateTimeSelectionSheet.vue
@@ -11,22 +11,22 @@
-
+
{{ $t(`datetime.${text}.short`) }}
{{ $t(`datetime.${text}.short`) }}
-
+
diff --git a/src/components/mobile/InformationSheet.vue b/src/components/mobile/InformationSheet.vue
index 71c7f020..428e6cc7 100644
--- a/src/components/mobile/InformationSheet.vue
+++ b/src/components/mobile/InformationSheet.vue
@@ -15,7 +15,7 @@
v-if="enableCopy"
>
-
+
diff --git a/src/components/mobile/TransactionTagSelectionSheet.vue b/src/components/mobile/TransactionTagSelectionSheet.vue
index b3a1bc24..f30b74fd 100644
--- a/src/components/mobile/TransactionTagSelectionSheet.vue
+++ b/src/components/mobile/TransactionTagSelectionSheet.vue
@@ -17,12 +17,12 @@
diff --git a/src/consts/timezone.js b/src/consts/timezone.js
index 54caf8ec..9cd45f48 100644
--- a/src/consts/timezone.js
+++ b/src/consts/timezone.js
@@ -593,5 +593,6 @@ const allAvailableTimezones = [
];
export default {
- all: allAvailableTimezones
+ all: allAvailableTimezones,
+ utcTimezoneName: 'Etc/GMT'
};
diff --git a/src/lib/i18n.js b/src/lib/i18n.js
index 98da4a35..9a131e02 100644
--- a/src/lib/i18n.js
+++ b/src/lib/i18n.js
@@ -1,7 +1,7 @@
import { defaultLanguage, allLanguages } from '../locales/index.js';
import timezone from "../consts/timezone.js";
import currency from "../consts/currency.js";
-import settings from "./settings";
+import settings from "./settings.js";
import utils from './utils.js';
const apiNotFoundErrorCode = 100001;
@@ -259,7 +259,7 @@ export function getAllTimezones(includeSystemDefault, translateFn) {
for (let i = 0; i < allTimezones.length; i++) {
allTimezoneInfos.push({
name: allTimezones[i].timezoneName,
- utcOffset: (allTimezones[i].timezoneName !== 'Etc/GMT' ? utils.getTimezoneOffset(allTimezones[i].timezoneName) : ''),
+ utcOffset: (allTimezones[i].timezoneName !== timezone.utcTimezoneName ? utils.getTimezoneOffset(allTimezones[i].timezoneName) : ''),
utcOffsetMinutes: utils.getTimezoneOffsetMinutes(allTimezones[i].timezoneName),
displayName: translateFn(`timezone.${allTimezones[i].displayName}`)
});
@@ -274,7 +274,7 @@ export function getAllTimezones(includeSystemDefault, translateFn) {
});
}
- allTimezoneInfos.sort(function(c1, c2){
+ allTimezoneInfos.sort(function(c1, c2) {
const utcOffset1 = parseInt(c1.utcOffset.replace(':', ''));
const utcOffset2 = parseInt(c2.utcOffset.replace(':', ''));
@@ -303,7 +303,7 @@ export function getAllCurrencies(translateFn) {
});
}
- allCurrencies.sort(function(c1, c2){
+ allCurrencies.sort(function(c1, c2) {
return c1.displayName.localeCompare(c2.displayName);
})
diff --git a/src/views/mobile/ExchangeRates.vue b/src/views/mobile/ExchangeRates.vue
index 67c7e2ed..740f8cf8 100644
--- a/src/views/mobile/ExchangeRates.vue
+++ b/src/views/mobile/ExchangeRates.vue
@@ -144,7 +144,7 @@ export default {
});
}
- availableExchangeRates.sort(function(c1, c2){
+ availableExchangeRates.sort(function(c1, c2) {
return c1.currencyDisplayName.localeCompare(c2.currencyDisplayName);
})
diff --git a/src/views/mobile/tags/List.vue b/src/views/mobile/tags/List.vue
index 6f2db74f..df8139bf 100644
--- a/src/views/mobile/tags/List.vue
+++ b/src/views/mobile/tags/List.vue
@@ -30,7 +30,6 @@
-
-