Skip to content

Open source personal finance application

refactor(StatFilterSelector): add chip and swap wallets and categories icons

Ilya Komichev4b27da404ed5
diff --git a/app/components/stat/filter/Selector.vue b/app/components/stat/filter/Selector.vue
index 65aaa20a..ba8122b0 100644
--- a/app/components/stat/filter/Selector.vue
+++ b/app/components/stat/filter/Selector.vue
@@ -18,26 +18,26 @@ const modals = ref({
<template>
<div class="flex gap-1">
<BottomSheetOrDropdown
- v-if="props.isShowCategories"
- :title="t('categories.filter')"
- :isOpen="modals.categories"
+ v-if="props.isShowWallets"
+ :title="t('wallets.filter')"
+ :isOpen="modals.wallets"
isShowCloseBtn
- @onOpenModal="modals.categories = true"
- @onCloseModal="modals.categories = false"
+ @onOpenModal="modals.wallets = true"
+ @onCloseModal="modals.wallets = false"
>
<template #trigger>
- <UTooltip :text="t('categories.filter')">
+ <UTooltip :text="t('wallets.filter')">
<UChip
- :show="filter?.categoriesIds.value.length > 0"
+ :show="filter?.walletsIds.value.length > 0"
color="secondary"
inset
size="xs"
>
<UButton
- :aria-label="t('categories.filter')"
+ :aria-label="t('wallets.filter')"
class="text-muted"
color="neutral"
- icon="hugeicons:folder-library"
+ icon="hugeicons:wallet-01"
size="lg"
square
variant="ghost"
@@ -48,19 +48,15 @@ const modals = ref({
<template #custom="{ close }">
<div class="grid h-full max-h-[60dvh] grid-rows-[1fr_auto] overflow-hidden">
- <div class="scrollerBlock overflow-y-auto">
- <CategoriesSelector
- :selectedIds="filter?.categoriesIds.value"
- class="min-w-80 px-3"
- @filter="filter.toggleCategoryId"
- @onSelected="filter.toggleCategoryId"
- @setCategories="filter.setCategories"
- />
- </div>
+ <WalletsSelector
+ :selectedIds="filter?.walletsIds.value"
+ class="min-w-80 px-3"
+ @onSelected="filter.toggleWalletId"
+ />
<div class="px-3 py-2">
<UiButtonAccent @click="close">
- {{ t('base.close') }}
+ {{ t('base.apply') }}
</UiButtonAccent>
</div>
</div>
@@ -68,26 +64,26 @@ const modals = ref({
</BottomSheetOrDropdown>
<BottomSheetOrDropdown
- v-if="props.isShowWallets"
- :title="t('wallets.filter')"
- :isOpen="modals.wallets"
+ v-if="props.isShowCategories"
+ :title="t('categories.filter')"
+ :isOpen="modals.categories"
isShowCloseBtn
- @onOpenModal="modals.wallets = true"
- @onCloseModal="modals.wallets = false"
+ @onOpenModal="modals.categories = true"
+ @onCloseModal="modals.categories = false"
>
<template #trigger>
- <UTooltip :text="t('wallets.filter')">
+ <UTooltip :text="t('categories.filter')">
<UChip
- :show="filter?.walletsIds.value.length > 0"
+ :show="filter?.categoriesIds.value.length > 0"
color="secondary"
inset
size="xs"
>
<UButton
- :aria-label="t('wallets.filter')"
+ :aria-label="t('categories.filter')"
class="text-muted"
color="neutral"
- icon="hugeicons:wallet-01"
+ icon="hugeicons:folder-library"
size="lg"
square
variant="ghost"
@@ -98,15 +94,19 @@ const modals = ref({
<template #custom="{ close }">
<div class="grid h-full max-h-[60dvh] grid-rows-[1fr_auto] overflow-hidden">
- <WalletsSelector
- :selectedIds="filter?.walletsIds.value"
- class="min-w-80 px-3"
- @onSelected="filter.toggleWalletId"
- />
+ <div class="scrollerBlock overflow-y-auto">
+ <CategoriesSelector
+ :selectedIds="filter?.categoriesIds.value"
+ class="min-w-80 px-3"
+ @filter="filter.toggleCategoryId"
+ @onSelected="filter.toggleCategoryId"
+ @setCategories="filter.setCategories"
+ />
+ </div>
<div class="px-3 py-2">
<UiButtonAccent @click="close">
- {{ t('base.apply') }}
+ {{ t('base.close') }}
</UiButtonAccent>
</div>
</div>