Skip to content

Open source personal finance application

feat(stat): add wallet icon toggle to stat config

Ilya Komichevec9c16d20cb4
diff --git a/app/app/components/stat/Header.vue b/app/app/components/stat/Header.vue
index e8e30a40..00b06a4c 100644
--- a/app/app/components/stat/Header.vue
+++ b/app/app/components/stat/Header.vue
@@ -113,14 +113,15 @@ function onClickWallet(walletId: WalletId) {
v-if="statConfig.config.value.wallets.isShow"
#after
>
- <div class="grid gap-2 px-2 pb-0 lg:px-4 2xl:px-8">
- <div class="flex max-w-6xl gap-1 overflow-x-auto py-px">
+ <div class="flex overflow-x-auto px-2 py-2 lg:px-4 2xl:px-8">
+ <div class="flex shrink-0 gap-2">
<WalletsItem
v-for="walletId in sortedFilterWalletsIds"
:key="walletId"
:activeItemId="filter.walletsIds.value.includes(`${walletId}`) ? walletId : null"
:walletId
:wallet="walletsStore.itemsComputed?.[walletId]!"
+ :isShowIcon="statConfig.config.value.wallets.isShowIcon"
insideClasses="!min-h-[38px]"
compact
@click="onClickWallet(walletId)"
diff --git a/app/app/components/stat/configPanels/Wallets.vue b/app/app/components/stat/configPanels/Wallets.vue
index f1d9eccf..cffc8c54 100644
--- a/app/app/components/stat/configPanels/Wallets.vue
+++ b/app/app/components/stat/configPanels/Wallets.vue
@@ -2,6 +2,7 @@
import { statConfigKey } from '~/components/stat/injectionKeys'
import { useWalletsStore } from '~/components/wallets/useWalletsStore'
+const { t } = useI18n()
const statConfig = inject(statConfigKey)!
const walletsStore = useWalletsStore()
</script>
@@ -17,5 +18,11 @@ const walletsStore = useWalletsStore()
:max="walletsStore.sortedIds.length"
@update:modelValue="value => statConfig.updateConfig('wallets', { count: value })"
/>
+
+ <StatConfigSwitch
+ configKey="wallets"
+ field="isShowIcon"
+ :title="t('stat.config.wallets.showIcon')"
+ />
</div>
</template>
diff --git a/app/app/components/stat/useStatConfig.ts b/app/app/components/stat/useStatConfig.ts
index ba831d66..b8c7b8c6 100644
--- a/app/app/components/stat/useStatConfig.ts
+++ b/app/app/components/stat/useStatConfig.ts
@@ -62,6 +62,7 @@ export const ConfigSchema = z.object({
wallets: z.object({
count: z.number(),
isShow: z.boolean(),
+ isShowIcon: z.boolean(),
}),
})
@@ -127,6 +128,7 @@ export function useStatConfig({ props, storageKey }: StatConfigParams) {
wallets: {
count: 6,
isShow: false,
+ isShowIcon: true,
},
}, localStorage, {
mergeDefaults: (storageValue, defaults) => defu(storageValue, defaults),
diff --git a/app/i18n/locales/en-US.js b/app/i18n/locales/en-US.js
index 96a314c1..bc0a8fe4 100644
--- a/app/i18n/locales/en-US.js
+++ b/app/i18n/locales/en-US.js
@@ -375,6 +375,7 @@ export default {
wallets: {
description: 'Quick access to the first N wallets from the full list. Order is set on the Wallets page.',
label: 'Show wallets',
+ showIcon: 'Show wallet icon',
subtitle: 'Top {count}',
title: 'Wallets',
},
diff --git a/app/i18n/locales/ru-RU.js b/app/i18n/locales/ru-RU.js
index 3bfeb07d..1a8b7a21 100644
--- a/app/i18n/locales/ru-RU.js
+++ b/app/i18n/locales/ru-RU.js
@@ -375,6 +375,7 @@ export default {
wallets: {
description: 'Быстрый доступ к первым N кошелькам из общего списка. Порядок задаётся на странице «Кошельки».',
label: 'Показывать кошельки',
+ showIcon: 'Показывать иконку кошелька',
subtitle: 'Топ {count}',
title: 'Кошельки',
},