Skip to content

Open source personal finance application

refactor: enhance category and wallet selection components

Ilya Komichev51d5e0fabdef
diff --git a/app/app.config.ts b/app/app.config.ts
index 8e87b5c1..addc4bf9 100644
--- a/app/app.config.ts
+++ b/app/app.config.ts
@@ -28,6 +28,7 @@ export default defineAppConfig({
ring: '!ring-2 !ring-item-4',
trigger: '!w-full !block !cursor-default',
},
+
primary: 'pink',
strategy: 'merge',
},
diff --git a/app/components/bottomSheet/BottomSheetOrDropdown.vue b/app/components/bottomSheet/BottomSheetOrDropdown.vue
index 248470ee..df52f070 100644
--- a/app/components/bottomSheet/BottomSheetOrDropdown.vue
+++ b/app/components/bottomSheet/BottomSheetOrDropdown.vue
@@ -20,13 +20,13 @@ const isLaptop = computed(() => width.value >= 766 && pointerType.value === 'mou
</script>
<template>
- <div>
+ <div class="grow">
<UPopover
v-if="isLaptop"
:popper="{
placement: props.placement ?? 'bottom-start',
}"
- class="group grow"
+ class="popoverGroup grow"
>
<slot name="trigger" />
@@ -41,10 +41,12 @@ const isLaptop = computed(() => width.value >= 766 && pointerType.value === 'mou
</template>
</UPopover>
- <template v-else>
- <div @click="emit('onOpenModal')">
- <slot name="trigger" />
- </div>
+ <div
+ v-else
+ class="grow"
+ @click="emit('onOpenModal')"
+ >
+ <slot name="trigger" />
<Teleport to="body">
<BottomSheet
@@ -72,6 +74,6 @@ const isLaptop = computed(() => width.value >= 766 && pointerType.value === 'mou
</template>
</BottomSheet>
</Teleport>
- </template>
+ </div>
</div>
</template>
diff --git a/app/components/categories/Form.vue b/app/components/categories/Form.vue
index c6681294..d7422894 100644
--- a/app/components/categories/Form.vue
+++ b/app/components/categories/Form.vue
@@ -192,15 +192,15 @@ async function onSave() {
<UiCheckbox
v-if="categoriesStore.getChildsIds(props.categoryId).length === 0"
- :checkboxValue="props.categoryForm.showInLastUsed"
- :title="t('categories.form.lastUsed')"
- @click="emit('updateValue', 'showInLastUsed', !props.categoryForm.showInLastUsed)"
+ :checkboxValue="props.categoryForm.showInQuickSelector"
+ :title="t('categories.form.favoriteCategory')"
+ @click="emit('updateValue', 'showInQuickSelector', !props.categoryForm.showInQuickSelector)"
/>
<UiCheckbox
v-if="categoriesStore.getChildsIds(props.categoryId).length === 0"
- :checkboxValue="props.categoryForm.showInQuickSelector"
- :title="t('categories.form.quickSelector')"
- @click="emit('updateValue', 'showInQuickSelector', !props.categoryForm.showInQuickSelector)"
+ :checkboxValue="props.categoryForm.showInLastUsed"
+ :title="t('categories.form.recentCategory')"
+ @click="emit('updateValue', 'showInLastUsed', !props.categoryForm.showInLastUsed)"
/>
</div>
</div>
@@ -309,7 +309,7 @@ async function onSave() {
:key="icon"
:class="[{ '!border-accent-1': icon === props.categoryForm.icon }]"
:style="{ background: props.categoryForm.color }"
- class="flex-center size-10 cursor-pointer rounded-full border-2 border-transparent text-icon-primary"
+ class="flex-center text-icon-primary size-10 cursor-pointer rounded-full border-2 border-transparent"
@click="emit('updateValue', 'icon', icon)"
>
<Icon :name="icon" size="20" />
diff --git a/app/components/categories/Selector.vue b/app/components/categories/Selector.vue
index 4f91b7b4..41ab8bd5 100644
--- a/app/components/categories/Selector.vue
+++ b/app/components/categories/Selector.vue
@@ -64,16 +64,16 @@ onMounted(() => {
<div
v-for="categoryId in categoriesStore.categoriesRootIds"
:key="categoryId"
- class="group"
+ class="group/item"
:class="{
- 'relative mb-2 rounded-md bg-item-3': opened.includes(categoryId),
- 'rounded-md bg-item-3': isChildsSelected(categoryId),
- 'border !border-accent-1/60': isEveryChildsSelected(categoryId),
+ 'bg-item-3 relative mb-2 rounded-md': opened.includes(categoryId),
+ 'bg-item-3 rounded-md': isChildsSelected(categoryId),
+ '!border-accent-1/60 border': isEveryChildsSelected(categoryId),
}"
>
<CategoriesItem
:categoryId
- :lineWidth="1"
+ :lineWidth="4"
:category="categoriesStore.items[categoryId]"
:activeItemId="props.selectedIds?.includes(categoryId) ? categoryId : null"
@click="select(categoryId, false)"
diff --git a/app/components/categories/page/List.vue b/app/components/categories/page/List.vue
index c296d6a7..d132af80 100644
--- a/app/components/categories/page/List.vue
+++ b/app/components/categories/page/List.vue
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { useStorage } from '@vueuse/core'
+import defu from 'defu'
import type { CategoryId } from '~/components/categories/types'
@@ -12,7 +13,9 @@ useHead({
const router = useRouter()
const categoriesStore = useCategoriesStore()
-const categoriesView = useStorage<'list' | 'grid'>('finapp.categoriesView', 'list')
+const categoriesView = useStorage<'list' | 'grid'>('finapp.categoriesView', 'list', localStorage, {
+ mergeDefaults: (storageValue, defaults) => defu(storageValue, defaults),
+})
</script>
<template>
diff --git a/app/components/date/useStatDate.ts b/app/components/date/useStatDate.ts
index 698e193f..6d5fe2d0 100644
--- a/app/components/date/useStatDate.ts
+++ b/app/components/date/useStatDate.ts
@@ -1,5 +1,6 @@
import { useStorage } from '@vueuse/core'
import { differenceInDays } from 'date-fns'
+import defu from 'defu'
import type { Grouped, IntervalGroupedLabel, Range, StatDateParams, StatDateParamsQuery } from '~/components/date/types'
@@ -26,7 +27,7 @@ export function useStatDate({
rangeDuration: 3,
rangeOffset: 0,
}, localStorage, {
- mergeDefaults: true,
+ mergeDefaults: (storageValue, defaults) => defu(storageValue, defaults),
})
const modals = ref({
diff --git a/app/components/filter/FilterSelector.vue b/app/components/filter/FilterSelector.vue
index 3d32b12a..04e66c5c 100644
--- a/app/components/filter/FilterSelector.vue
+++ b/app/components/filter/FilterSelector.vue
@@ -38,11 +38,11 @@ const modals = ref({
@close="close"
>
<CategoriesSelector
- class="min-w-72"
:selectedIds="filter?.categoriesIds.value"
+ class="min-w-80"
+ @filter="filter.toggleCategoryId"
@onSelected="filter.toggleCategoryId"
@setCategories="filter.setCategories"
- @filter="filter.toggleCategoryId"
/>
</UiPopoverWrap>
</template>
@@ -114,7 +114,7 @@ const modals = ref({
>
<WalletsSelector
:selectedIds="filter?.walletsIds.value"
- class="min-w-72 px-2"
+ class="min-w-80 px-2"
@onSelected="filter.toggleWalletId"
/>
</UiPopoverWrap>
@@ -149,8 +149,8 @@ const modals = ref({
<div class="scrollerBlock bottomSheetContentInside">
<WalletsSelector
- class="min-w-72"
:selectedIds="filter?.walletsIds.value"
+ class="min-w-80"
@onSelected="filter.toggleWalletId"
/>
</div>
diff --git a/app/components/stat/CategoriesButtons.vue b/app/components/stat/CategoriesButtons.vue
index b0ae8f71..c7b2c3f5 100644
--- a/app/components/stat/CategoriesButtons.vue
+++ b/app/components/stat/CategoriesButtons.vue
@@ -3,50 +3,9 @@ import defu from 'defu'
import type { StatConfigProvider } from '~/components/stat/useStatConfig'
-const props = defineProps<{
- catsLength: number
- isShowFavorites?: boolean
- isShowGrouped?: boolean
- isShowRecent?: boolean
- openedStatus: unknown
-}>()
-
-const emit = defineEmits(['toggleOpened'])
-
const { t } = useI18n()
const statConfig = inject('statConfig') as StatConfigProvider
-const grouping = {
- isGrouped: computed(() => {
- if (statConfig.config.value.catsView === 'list')
- return statConfig.config.value.catsList.isGrouped
-
- if (statConfig.config.value.catsView === 'round')
- return statConfig.config.value.catsRound.isGrouped
-
- return false
- }),
-
- set(value: boolean) {
- statConfig.updateConfig('vertical', { isGrouped: value })
- statConfig.updateConfig('catsRound', { isGrouped: value })
- statConfig.updateConfig('catsList', { isGrouped: value })
- },
-
- toggle: () => {
- if (statConfig.config.value.catsView === 'list') {
- // statConfig.updateConfig('vertical', { isGrouped: !statConfig.config.value.catsList.isGrouped })
- statConfig.updateConfig('catsList', { isGrouped: !statConfig.config.value.catsList.isGrouped })
- return
- }
-
- if (statConfig.config.value.catsView === 'round') {
- // statConfig.updateConfig('vertical', { isGrouped: !statConfig.config.value.catsRound.isGrouped })
- statConfig.updateConfig('catsRound', { isGrouped: !statConfig.config.value.catsRound.isGrouped })
- }
- },
-}
-
const favorites = computed(() => ({
isShow: computed(() => {
if (statConfig.config.value.catsView === 'list')
@@ -98,6 +57,7 @@ const viewPresets = computed(() => ({
catsList: {
isItemsBg: false,
isLines: false,
+ isOpened: false,
isRoundIcon: false,
},
},
@@ -133,328 +93,136 @@ function onChangeViewOptions(newViewOptions: any) {
const c = defu(newViewOptions.catsList, statConfig.config.value.catsList)
statConfig.updateConfig('catsList', c)
}
-
-const isShow = ref(false)
</script>
<template>
- <div class="relative flex rounded-md">
- <UiItem1
- v-if="statConfig.config.value.catsView === 'list'"
- @click="emit('toggleOpened')"
- >
- <Icon
- v-if="props.openedStatus.isAllRootOpen && !props.openedStatus.isAllChildOpen"
- name="lucide:folder-open"
+ <div class="">
+ <!-- List -->
+ <div class="border-item-4 grid gap-3 border-b pb-2 last:border-0">
+ <UiTitleOption>{{ t('listItemsOptions') }}</UiTitleOption>
+ <div class="flex gap-1">
+ <UiItem2
+ v-for="view in viewPresets"
+ :key="view.title"
+ @click="onChangeViewOptions(view.props)"
+ >
+ {{ view.title }}
+ </UiItem2>
+
+ <UiItem2
+ class="!grow-0"
+ @click="isShowMorePresets = !isShowMorePresets"
+ >
+ <Icon
+ :name="isShowMorePresets ? 'lucide:chevron-up' : 'lucide:chevron-down'"
+ size="18"
+ />
+ </UiItem2>
+ </div>
+
+ <div v-if="isShowMorePresets">
+ <UiCheckbox
+ :checkboxValue="statConfig.config.value.catsList.isItemsBg"
+ :title="t('isItemsBg')"
+ @click="statConfig.updateConfig('catsList', { isItemsBg: !statConfig.config.value.catsList.isItemsBg })"
+ />
+
+ <!-- Lines -->
+ <UiCheckbox
+ :checkboxValue="statConfig.config.value.catsList.isLines"
+ :title="t('isLines')"
+ @click="statConfig.updateConfig('catsList', { isLines: !statConfig.config.value.catsList.isLines })"
+ />
+
+ <!-- Round icons -->
+ <UiCheckbox
+ :checkboxValue="statConfig.config.value.catsList.isRoundIcon"
+ :title="t('isRoundIcon')"
+ @click="statConfig.updateConfig('catsList', { isRoundIcon: !statConfig.config.value.catsList.isRoundIcon })"
+ />
+ </div>
+
+ <UiCheckbox
+ :checkboxValue="statConfig.config.value.catsList.isOpened"
+ :title="t('categories.list.showAsRounded')"
+ @click="statConfig.updateConfig('catsList', { isOpened: !statConfig.config.value.catsList.isOpened })"
/>
- <Icon
- v-if="props.openedStatus.isAllRootOpen && props.openedStatus.isAllChildOpen"
- name="lucide:folder-kanban"
- />
- <Icon
- v-if="!props.openedStatus.isAllRootOpen"
- name="lucide:folder"
- />
- </UiItem1>
+ </div>
- <!-- Grouping -->
- <UiItem1
- v-if="props.isShowGrouped"
- @click="grouping.toggle"
+ <!-- TODO: use StatConfig -->
+ <div
+ v-if="false"
+ class="border-item-4 border-b pb-2 last:border-0 last:pb-0"
>
- <Icon
- :name="grouping.isGrouped.value ? 'lucide:folder-tree' : 'lucide:network'"
- size="18"
- />
- </UiItem1>
-
- <!-- View -->
- <UiItem1
- @click="statConfig.updateConfig('catsView', statConfig.config.value.catsView === 'list' ? 'round' : 'list')"
- >
- <Icon
- :name="statConfig.config.value.catsView === 'list' ? 'lucide:layout-grid' : 'lucide:layout-list'"
- size="18"
- />
- </UiItem1>
+ <!-- Favorite -->
+ <UiElement
+ class="text-sm"
+ @click="favorites.toggle"
+ >
+ <template #leftIcon>
+ <Icon
+ name="lucide:heart"
+ size="18"
+ />
+ </template>
+ <div class="grow">
+ {{ t('isShowFavorites') }}
+ </div>
+ <FormSwitch :value="favorites.isShow.value" />
+ </UiElement>
+
+ <!-- Recent -->
+ <UiElement
+ class="text-sm"
+ @click="recent.toggle"
+ >
+ <template #leftIcon>
+ <Icon
+ name="lucide:history"
+ size="18"
+ />
+ </template>
+ <div class="grow">
+ {{ t('isShowRecent') }}
+ </div>
+ <FormSwitch :value="recent.isShow.value" />
+ </UiElement>
+ </div>
- <BottomSheetOrDropdown
- :title="t('stat.config.categories.title')"
- :isOpen="isShow"
- placement="bottom-end"
- @onOpenModal="isShow = true"
- @onCloseModal="isShow = false"
+ <div
+ class="border-item-4 grid gap-3 border-b pb-2 pt-3 last:border-0"
>
- <template #trigger>
- <UiItem1>
- <Icon name="lucide:circle-ellipsis" size="20" />
- </UiItem1>
- </template>
-
- <template #content="{ close }">
- <div class="grid min-w-80 gap-4 px-1 pt-3 md:px-3">
- <BottomSheetClose @click="close" />
- <div class="grid gap-4 border-b border-item-4 pb-3">
- <!-- Grouping -->
- <div class="grid gap-3">
- <UiTitleOption>
- {{ t("stat.config.categories.grouping.label") }}
- </UiTitleOption>
-
- <UiTabs1>
- <UiTabsItem1
- :isActive="grouping.isGrouped.value"
- class="flex gap-1"
- @click="grouping.set(true)"
- >
- <Icon
- name="lucide:network"
- :size="16"
- />
- {{ t('stat.config.categories.grouping.grouped') }}
- </UiTabsItem1>
-
- <UiTabsItem1
- :isActive="!grouping.isGrouped.value"
- class="flex gap-1"
- @click="grouping.set(false)"
- >
- <Icon
- name="lucide:folder-tree"
- :size="16"
- />
- {{ t('stat.config.categories.grouping.ungrouped') }}
- </UiTabsItem1>
- </UiTabs1>
- </div>
-
- <div class="grid gap-3">
- <UiTitleOption>
- {{ t("stat.config.categories.view.label") }}
- </UiTitleOption>
-
- <UiTabs1>
- <UiTabsItem1
- :isActive="statConfig.config.value.catsView === 'list'"
- class="flex gap-1"
- @click="statConfig.updateConfig('catsView', 'list')"
- >
- <Icon
- name="lucide:layout-list"
- :size="16"
- />
- {{ t('stat.config.categories.view.list') }}
- </UiTabsItem1>
-
- <UiTabsItem1
- :isActive="statConfig.config.value.catsView === 'round'"
- class="flex gap-1"
- @click="statConfig.updateConfig('catsView', 'round')"
- >
- <Icon
- name="lucide:layout-grid"
- :size="16"
- />
- {{ t('stat.config.categories.view.round') }}
- </UiTabsItem1>
- </UiTabs1>
- </div>
- </div>
-
- <!-- List -->
- <div
- v-if="statConfig.config.value.catsView === 'list'"
- class="grid gap-3 border-b border-item-4 pb-2 last:border-0"
- >
- <UiTitleOption>{{ t('listItemsOptions') }}</UiTitleOption>
- <div class="flex gap-1">
- <UiItem2
- v-for="view in viewPresets"
- :key="view.title"
- @click="onChangeViewOptions(view.props)"
- >
- {{ view.title }}
- </UiItem2>
-
- <UiItem2
- class="!grow-0"
- @click="isShowMorePresets = !isShowMorePresets"
- >
- <Icon
- :name="isShowMorePresets ? 'lucide:chevron-up' : 'lucide:chevron-down'"
- size="18"
- />
- </UiItem2>
- </div>
-
- <div v-if="isShowMorePresets">
- <UiElement
- v-if="statConfig.config.value.catsView === 'list'"
- class="text-sm"
- @click="statConfig.updateConfig('catsList', {
- ...statConfig.config.value.catsList,
- isItemsBg: !statConfig.config.value.catsList.isItemsBg,
- })"
- >
- <div class="grow">
- {{ t('isItemsBg') }}
- </div>
- <FormSwitch :value="statConfig.config.value.catsList.isItemsBg" />
- </UiElement>
-
- <!-- Lines -->
- <UiElement
- class="text-sm"
- @click="statConfig.updateConfig('catsList', {
- ...statConfig.config.value.catsList,
- isLines: !statConfig.config.value.catsList.isLines,
- })"
- >
- <div class="grow">
- {{ t('isLines') }}
- </div>
- <FormSwitch :value="statConfig.config.value.catsList.isLines" />
- </UiElement>
-
- <!-- Round icons -->
- <UiElement
- class="text-sm"
- @click="statConfig.updateConfig('catsList', {
- ...statConfig.config.value.catsList,
- isRoundIcon: !statConfig.config.value.catsList.isRoundIcon,
- })"
- >
- <div class="grow">
- {{ t('isRoundIcon') }}
- </div>
- <FormSwitch :value="statConfig.config.value.catsList.isRoundIcon" />
- </UiElement>
- </div>
-
- <UiElement
- v-if="statConfig.config.value.catsList.isGrouped"
- class="text-sm"
- @click="statConfig.updateConfig('catsList', { isOpened: !statConfig.config.value.catsList.isOpened })"
- >
- <div class="grow">
- {{ t('categories.list.showAsRounded') }}
- </div>
- <FormSwitch :value="statConfig.config.value.catsList.isOpened" />
- </UiElement>
- </div>
-
- <!-- Vertical -->
- <div
- v-if="props.catsLength > 1"
- class="grid border-b border-item-4 pb-2 last:border-0 md:pb-0"
- >
- <UiTitleOption class="pb-2">
- {{ t('stat.config.categories.vertical.label') }}
- </UiTitleOption>
-
- <UiElement
- class="text-sm"
- @click="statConfig.updateConfig('vertical', { isShow: !statConfig.config.value.vertical.isShow })"
- >
- <template #leftIcon>
- <Icon
- name="lucide:chart-no-axes-column-decreasing"
- size="18"
- />
- </template>
- <div class="grow">
- {{ t('vertical.show') }}
- </div>
- <FormSwitch :value="statConfig.config.value.vertical.isShow" />
- </UiElement>
-
- <!-- Grouping -->
- <UiTabs1
- v-if="statConfig.config.value.vertical.isShow"
- class="mt-3"
- >
- <UiTabsItem1
- :isActive="statConfig.config.value.vertical.isGrouped"
- class="flex gap-1"
- @click="statConfig.updateConfig('vertical', { isGrouped: true })"
- >
- <Icon
- name="lucide:network"
- :size="16"
- />
- {{ t('stat.config.categories.grouping.grouped') }}
- </UiTabsItem1>
-
- <UiTabsItem1
- :isActive="!statConfig.config.value.vertical.isGrouped"
- class="flex gap-1"
- @click="statConfig.updateConfig('vertical', { isGrouped: false })"
- >
- <Icon
- name="lucide:folder-tree"
- :size="16"
- />
- {{ t('stat.config.categories.grouping.ungrouped') }}
- </UiTabsItem1>
- </UiTabs1>
- </div>
-
- <!-- TODO: use StatConfig -->
- <div
- v-if="false"
- class="border-b border-item-4 pb-2 last:border-0 last:pb-0"
- >
- <!-- Favorite -->
- <UiElement
- class="text-sm"
- @click="favorites.toggle"
- >
- <template #leftIcon>
- <Icon
- name="lucide:heart"
- size="18"
- />
- </template>
- <div class="grow">
- {{ t('isShowFavorites') }}
- </div>
- <FormSwitch :value="favorites.isShow.value" />
- </UiElement>
-
- <!-- Recent -->
- <UiElement
- class="text-sm"
- @click="recent.toggle"
- >
- <template #leftIcon>
- <Icon
- name="lucide:history"
- size="18"
- />
- </template>
- <div class="grow">
- {{ t('isShowRecent') }}
- </div>
- <FormSwitch :value="recent.isShow.value" />
- </UiElement>
- </div>
- </div>
- </template>
- </BottomSheetOrDropdown>
+ <UiTitleOption>{{ t('elements') }}</UiTitleOption>
+ <div class="">
+ <UiCheckbox
+ :checkboxValue="statConfig.config.value.vertical.isShow"
+ :title="t('stat.config.categories.vertical.title')"
+ @click="statConfig.updateConfig('vertical', { isShow: !statConfig.config.value.vertical.isShow })"
+ />
+ <UiCheckbox
+ :checkboxValue="statConfig.config.value.catsRound.isShow"
+ :title="t('stat.config.categories.rounds.title')"
+ @click="statConfig.updateConfig('catsRound', { isShow: !statConfig.config.value.catsRound.isShow })"
+ />
+ <UiCheckbox
+ :checkboxValue="statConfig.config.value.catsList.isShow"
+ :title="t('stat.config.categories.list.title')"
+ @click="statConfig.updateConfig('catsList', { isShow: !statConfig.config.value.catsList.isShow })"
+ />
+ </div>
+ </div>
</div>
</template>
<i18n lang="yaml">
en:
+ elements: Elements
isItemsBg: Items background
isLines: Amount lines
isRoundIcon: Rounded categories
vertical:
show: Vertical categories
grouping: Grouping
- isShowEmptyCategories: Show empty categories
- isShowFavorites: Show favorites
- isShowRecent: Show recent
listItemsOptions: List items options
minimal: Minimal
standard: Standard
@@ -464,15 +232,13 @@ en:
showAsRounded: Show as rounded
ru:
+ elements: Элементы
isItemsBg: Фон категорий
isLines: Линии сумм
isRoundIcon: Скруглённые категории
vertical:
show: Вертикальные категории
grouping: Группировать
- isShowEmptyCategories: Показывать пустые категории
- isShowFavorites: Показывать избранные
- isShowRecent: Показывать последние
listItemsOptions: Настройки списка категорий
minimal: Легкий
standard: Стандартный
diff --git a/app/components/stat/Config.vue b/app/components/stat/Config.vue
index 93ec4fce..b7570385 100644
--- a/app/components/stat/Config.vue
+++ b/app/components/stat/Config.vue
@@ -47,7 +47,7 @@ function updateStatAverage(value: number) {
<BottomSheetClose @click="close" />
<!-- Chart -->
- <div class="border-b border-item-3 pb-3">
+ <div class="border-item-3 border-b pb-3">
<UiTitleOption class="pb-2">
{{ t('stat.config.chartShow.title') }}
</UiTitleOption>
@@ -116,11 +116,12 @@ function updateStatAverage(value: number) {
<!-- Showed wallets -->
<div
v-if="props.isShowWallets"
- class="border-b border-item-3 pb-3"
+ class="border-item-3 border-b pb-3"
>
<UiTitleOption class="pb-2">
{{ t('stat.config.wallets.title') }}
</UiTitleOption>
+
<UiCheckbox
:checkboxValue="statConfig.config.value.wallets.isShow"
:title="t('stat.config.wallets.label')"
@@ -161,7 +162,9 @@ function updateStatAverage(value: number) {
</div>
<!-- Statistics -->
- <div class="pb-0">
+ <div
+ class="border-item-3 border-b pb-3"
+ >
<UiTitleOption class="pb-2">
{{ t('statistics.title') }}
</UiTitleOption>
@@ -211,6 +214,8 @@ function updateStatAverage(value: number) {
</div>
</div>
+ <StatCategoriesButtons />
+
<slot />
</div>
</template>
diff --git a/app/components/stat/Item.vue b/app/components/stat/Item.vue
index 0a3f2288..a0d0d7c5 100644
--- a/app/components/stat/Item.vue
+++ b/app/components/stat/Item.vue
@@ -215,7 +215,7 @@ function getIntervalsData(trnsIds: TrnId[], intervalsInRange: Range[]) {
<StatDateQuick v-if="statConfig.config.value.date.isShowQuick" />
</StatChartWrap>
- <div class="grid pb-3 md:max-w-lg">
+ <div class="grid pb-3">
<StatDateNavigation />
</div>
@@ -279,7 +279,7 @@ function getIntervalsData(trnsIds: TrnId[], intervalsInRange: Range[]) {
</StatSumWrap>
<div
- class="grid w-full gap-2"
+ class="@3xl/page:pt-3 grid w-full gap-2 pt-1"
:class="{
'@3xl/page:grid-cols-[1.2fr,1fr] @3xl/page:gap-8': props.activeTab !== 'summary',
}"
diff --git a/app/components/stat/categories/Section.vue b/app/components/stat/categories/Section.vue
index fa655cff..50654eac 100644
--- a/app/components/stat/categories/Section.vue
+++ b/app/components/stat/categories/Section.vue
@@ -18,10 +18,11 @@ const props = defineProps<{
type: StatTabSlug
}>()
-defineEmits<{
+const emit = defineEmits<{
clickCategory: [categoryId: CategoryId]
}>()
+const { t } = useI18n()
const { getCategoriesWithData } = useStatCategories()
const categoriesStore = useCategoriesStore()
const statConfig = inject('statConfig') as StatConfigProvider
@@ -37,8 +38,18 @@ const categoriesWithData = computed<CategoryWithData[]>(() => {
return getCategoriesWithData(props.selectedTrnsIds ?? [], isGrouped, cats)
})
-const verticalCategories = computed<CategoryWithData[]>(() => getCategoriesWithData(props.selectedTrnsIds ?? [], statConfig.config.value.vertical.isGrouped))
+const categoriesStat = computed<{ grouped: CategoryWithData[], ungrouped: CategoryWithData[] }>(() => ({
+ grouped: getCategoriesWithData(props.selectedTrnsIds ?? [], true),
+ ungrouped: getCategoriesWithData(props.selectedTrnsIds ?? [], false),
+}))
+
+const verticalCategories = computed<CategoryWithData[]>(() => categoriesStat.value[statConfig.config.value.vertical.isGrouped ? 'grouped' : 'ungrouped'])
const verticalBiggestCatNumber = computed(() => getBiggestCatNumber(verticalCategories.value))
+
+const linesCategories = computed<CategoryWithData[]>(() => categoriesStat.value[statConfig.config.value.catsList.isGrouped ? 'grouped' : 'ungrouped'])
+const linesBiggestCatNumber = computed(() => getBiggestCatNumber(linesCategories.value))
+
+const roundCategories = computed<CategoryWithData[]>(() => categoriesStat.value[statConfig.config.value.catsRound.isGrouped ? 'grouped' : 'ungrouped'])
const biggestCatNumber = computed(() => getBiggestCatNumber(categoriesWithData.value))
function getBiggestCatNumber(categories: CategoryWithData[]) {
@@ -51,7 +62,6 @@ function getBiggestCatNumber(categories: CategoryWithData[]) {
}
}
-// Simplified type definitions
type CategoryState = {
categories?: CategoryStateInside
show: boolean
@@ -164,188 +174,398 @@ function updateState(
</script>
<template>
- <UiToggle
- :storageKey="`${storageKey}-${type}-cats`"
- :initStatus="true"
- openPadding="pb-3"
- class="md:max-w-lg"
- >
- <template #header="{ toggle, isShown }">
- <div class="flex items-center justify-between md:max-w-lg">
- <UiTitle8 :isShown @click="toggle">
- {{ $t('categories.title') }} {{ (!isShown && categoriesWithData.length > 0) ? categoriesWithData.length : '' }}
- </UiTitle8>
-
- <StatCategoriesButtons
+ <div v-if="categoriesWithData.length > 0">
+ <!-- Vertical -->
+ <UiToggle
+ v-if="statConfig.config.value.vertical.isShow"
+ :storageKey="`${storageKey}-${type}-vertical`"
+ :initStatus="true"
+ class="bg-item-2 @3xl/page:p-3 mb-4 rounded-xl p-2 md:max-w-lg"
+ >
+ <template #header="{ toggle, isShown }">
+ <div class="flex items-center justify-between md:max-w-lg">
+ <UiTitle8 :isShown @click="toggle">
+ {{ t('stat.config.categories.vertical.title') }} {{ (!isShown && verticalCategories.filter(c => c.value !== 0).length > 0) ? verticalCategories.filter(c => c.value !== 0).length : '' }}
+ </UiTitle8>
+
+ <div
+ v-if="isShown"
+ class="flex items-center"
+ >
+ <UiTabs1>
+ <UiItem1
+ :isActive="statConfig.config.value.vertical.isGrouped"
+ @click="statConfig.config.value.vertical.isGrouped = true"
+ >
+ <Icon
+ name="lucide:network"
+ :size="16"
+ />
+ </UiItem1>
+
+ <UiItem1
+ :isActive="!statConfig.config.value.vertical.isGrouped"
+ @click="statConfig.config.value.vertical.isGrouped = false"
+ >
+ <Icon
+ name="lucide:folder-tree"
+ :size="16"
+ />
+ </UiItem1>
+ </UiTabs1>
+
+ <!-- <UiTabs1>
+ <UiTabsItem4
+ :isActive="statConfig.config.value.vertical.isGrouped"
+ class="flex gap-1"
+ @click="statConfig.config.value.vertical.isGrouped = true"
+ >
+ <Icon
+ name="lucide:network"
+ :size="16"
+ />
+ {{ t('stat.config.categories.grouping.grouped') }}
+ </UiTabsItem4>
+
+ <UiTabsItem4
+ :isActive="!statConfig.config.value.vertical.isGrouped"
+ class="flex gap-1"
+ @click="statConfig.config.value.vertical.isGrouped = false"
+ >
+ <Icon
+ name="lucide:folder-tree"
+ :size="16"
+ />
+ {{ t('stat.config.categories.grouping.ungrouped') }}
+ </UiTabsItem4>
+ </UiTabs1> -->
+ </div>
+
+ <!-- <StatCategoriesButtons
+ v-if="isShown"
+ :catsLength="categoriesWithData.length"
+ :isShowGrouped="!props.isOneCategory"
+ :openedStatus
+ @toggleOpened="toggleOpened"
+ /> -->
+ </div>
+
+ <div v-if="isShown" class="grid pt-3">
+ <div class="flex overflow-hidden overflow-x-auto pl-1 pt-2">
+ <StatCategoriesVertical
+ v-for="item in verticalCategories.filter(c => c.value !== 0)"
+ :key="item.id"
+ :item="item"
+ :biggestCatNumber="verticalBiggestCatNumber"
+ @click="emit('clickCategory', item.id)"
+ />
+ </div>
+ </div>
+ </template>
+ </UiToggle>
+
+ <!-- Rounds -->
+ <UiToggle
+ v-if="statConfig.config.value.catsRound.isShow"
+ :storageKey="`${storageKey}-${type}-rounds`"
+ :initStatus="true"
+ class="bg-item-2 @3xl/page:p-3 mb-4 rounded-xl p-2 md:max-w-lg"
+ >
+ <template #header="{ toggle, isShown }">
+ <div class="flex items-center justify-between md:max-w-lg">
+ <UiTitle8 :isShown @click="toggle">
+ {{ t('stat.config.categories.rounds.title') }} {{ (!isShown && categoriesWithData.length > 0) ? categoriesWithData.length : '' }}
+ </UiTitle8>
+
+ <div
+ v-if="isShown"
+ class="flex items-center"
+ >
+ <UiTabs1>
+ <UiItem1
+ :isActive="statConfig.config.value.catsRound.isGrouped"
+ @click="statConfig.config.value.catsRound.isGrouped = true"
+ >
+ <Icon
+ name="lucide:network"
+ :size="16"
+ />
+ </UiItem1>
+
+ <UiItem1
+ :isActive="!statConfig.config.value.catsRound.isGrouped"
+ @click="statConfig.config.value.catsRound.isGrouped = false"
+ >
+ <Icon
+ name="lucide:folder-tree"
+ :size="16"
+ />
+ </UiItem1>
+ </UiTabs1>
+
+ <!-- <UiTabs1>
+ <UiTabsItem4
+ :isActive="statConfig.config.value.catsRound.isGrouped"
+ class="flex gap-1"
+ @click="statConfig.config.value.catsRound.isGrouped = true"
+ >
+ <Icon
+ name="lucide:network"
+ :size="16"
+ />
+ {{ t('stat.config.categories.grouping.grouped') }}
+ </UiTabsItem4>
+
+ <UiTabsItem4
+ :isActive="!statConfig.config.value.catsRound.isGrouped"
+ class="flex gap-1"
+ @click="statConfig.config.value.catsRound.isGrouped = false"
+ >
+ <Icon
+ name="lucide:folder-tree"
+ :size="16"
+ />
+ {{ t('stat.config.categories.grouping.ungrouped') }}
+ </UiTabsItem4>
+ </UiTabs1> -->
+ </div>
+ </div>
+
+ <div
v-if="isShown"
- :catsLength="categoriesWithData.length"
- :isShowGrouped="!props.isOneCategory"
- :openedStatus
- @toggleOpened="toggleOpened"
- />
- </div>
- </template>
-
- <template v-if="categoriesWithData.length > 0">
- <!-- Vertical -->
- <div
- v-if="statConfig.config.value.vertical.isShow && verticalCategories.length > 1"
- class="grid"
- >
- <div class="flex overflow-hidden overflow-x-auto pb-2 pl-1 pt-4">
- <StatCategoriesVertical
- v-for="item in verticalCategories.filter(c => c.value !== 0)"
+ class="@3xl/stat:gap-2 flex flex-wrap gap-1 gap-y-2 pl-1 pt-3 md:max-w-lg"
+ >
+ <StatCategoriesRound
+ v-for="item in roundCategories"
:key="item.id"
:item="item"
- :biggestCatNumber="verticalBiggestCatNumber"
- @click="$emit('clickCategory', item.id)"
+ isShowAmount
+ @click="emit('clickCategory', item.id)"
/>
</div>
- </div>
-
- <!-- Lines -->
- <div
- v-if="statConfig.config.value.catsView === 'list'"
- :class="{
- 'md:max-w-lg': !statConfig.config.value.catsList.isGrouped || !statConfig.config.value.catsList.isOpened,
- 'grid gap-1': statConfig.config.value.catsList.isItemsBg,
- }"
- class="pt-2"
- >
- <UiToggle3
- v-for="item in categoriesWithData"
- :key="item.id"
- :class="{
- group: !statConfig.config.value.catsList.isItemsBg,
- }"
- :isShown="categoriesOpened[item.id]?.show ?? false"
- :openPadding="statConfig.config.value.catsList.isGrouped ? '!pb-3' : ''"
- @click="toggleRoot(item.id)"
- >
- <template #header="{ toggle, isShown }">
- <div class="-mt-px flex items-stretch justify-between">
- <UiToggleAction
- v-if="item.trnsIds.length > 0"
- :isShown="isShown"
- :class="{
- '-mr-2.5': !statConfig.config.value.catsList.isItemsBg,
- }"
- @click="toggle"
+ </template>
+ </UiToggle>
+
+ <!-- List -->
+ <UiToggle
+ v-if="statConfig.config.value.catsList.isShow"
+ :storageKey="`${storageKey}-${type}-list`"
+ :initStatus="true"
+ class="bg-item-2 @3xl/page:p-3 mb-4 rounded-xl p-2 md:max-w-lg"
+ >
+ <template #header="{ toggle, isShown }">
+ <div class="flex items-center justify-between md:max-w-lg">
+ <UiTitle8 :isShown @click="toggle">
+ {{ t('stat.config.categories.list.title') }} {{ (!isShown && categoriesWithData.length > 0) ? categoriesWithData.length : '' }}
+ </UiTitle8>
+
+ <div
+ v-if="isShown"
+ class="flex items-center gap-1"
+ >
+ <UiItem1
+ v-if="statConfig.config.value.catsView === 'list'"
+ @click="toggleOpened"
+ >
+ <Icon
+ v-if="openedStatus.isAllRootOpen && !openedStatus.isAllChildOpen"
+ name="lucide:folder-open"
/>
- <div
- v-else
- :class="{
- 'mr-2 pr-[3px]': statConfig.config.value.catsList.isItemsBg,
- }"
- class="w-8"
+ <Icon
+ v-if="openedStatus.isAllRootOpen && openedStatus.isAllChildOpen"
+ name="lucide:folder-kanban"
/>
-
- <StatCategoriesLine
- :isShowParent="props.isOneCategory ? false : !statConfig.config.value.catsList.isGrouped"
- :item="item"
- :biggestCatNumber="biggestCatNumber"
- :lineWidth="statConfig.config.value.catsList.isLines ? 0 : 1"
- class="grow"
- @click="$emit('clickCategory', item.id)"
+ <Icon
+ v-if="!openedStatus.isAllRootOpen"
+ name="lucide:folder"
/>
- </div>
- </template>
+ </UiItem1>
- <!-- Inside -->
- <div class="ml-5 mt-[-2px] -translate-x-px border-l border-item-4 pl-3">
- <div
- v-if="!item.categories || item.categories.length === 0"
- class="mb-3 ml-11"
- >
- <TrnsList
- :trnsIds="item.trnsIds"
- :size="5"
- alt
- isShowExpense
- isShowIncome
- isShowTransfers
- />
- </div>
+ <UiTabs1>
+ <UiItem1
+ :isActive="statConfig.config.value.catsList.isGrouped"
+ @click="statConfig.config.value.catsList.isGrouped = true"
+ >
+ <Icon
+ name="lucide:network"
+ :size="16"
+ />
+ </UiItem1>
+
+ <UiItem1
+ :isActive="!statConfig.config.value.catsList.isGrouped"
+ @click="statConfig.config.value.catsList.isGrouped = false"
+ >
+ <Icon
+ name="lucide:folder-tree"
+ :size="16"
+ />
+ </UiItem1>
+ </UiTabs1>
+
+ <!-- <UiTabs1>
+ <UiTabsItem4
+ :isActive="statConfig.config.value.catsList.isGrouped"
+ class="flex gap-1"
+ @click="statConfig.config.value.catsList.isGrouped = true"
+ >
+ <Icon
+ name="lucide:network"
+ :size="16"
+ />
+ {{ t('stat.config.categories.grouping.grouped') }}
+ </UiTabsItem4>
+
+ <UiTabsItem4
+ :isActive="!statConfig.config.value.catsList.isGrouped"
+ class="flex gap-1"
+ @click="statConfig.config.value.catsList.isGrouped = false"
+ >
+ <Icon
+ name="lucide:folder-tree"
+ :size="16"
+ />
+ {{ t('stat.config.categories.grouping.ungrouped') }}
+ </UiTabsItem4>
+ </UiTabs1> -->
+ </div>
+ </div>
- <div
- v-if="item.categories && statConfig.config.value.catsList.isGrouped && statConfig.config.value.catsList.isOpened"
- class="flex flex-wrap gap-1 pl-3"
- >
- <StatCategoriesRound
- v-for="itemInside in item.categories"
- :key="itemInside.id"
- :item="itemInside"
- isShowAmount
- @click="$emit('clickCategory', itemInside.id)"
- />
- </div>
+ <div
+ v-if="isShown"
+ :class="{
+ 'md:max-w-lg': !statConfig.config.value.catsList.isGrouped || !statConfig.config.value.catsList.isOpened,
+ 'grid gap-1': statConfig.config.value.catsList.isItemsBg,
+ }"
+ class="pt-2"
+ >
+ <UiToggle3
+ v-for="item in linesCategories"
+ :key="item.id"
+ :class="{
+ group: !statConfig.config.value.catsList.isItemsBg,
+ }"
+ :isShown="categoriesOpened[item.id]?.show ?? false"
+ :openPadding="statConfig.config.value.catsList.isGrouped ? '!pb-3' : ''"
+ @click="toggleRoot(item.id)"
+ >
+ <template #header="{ toggle: toggle2, isShown: isShownRoot }">
+ <div class="-mt-px flex items-stretch justify-between">
+ <UiToggleAction
+ v-if="item.trnsIds.length > 0"
+ :isShown="isShownRoot"
+ :class="{
+ '-mr-2.5': !statConfig.config.value.catsList.isItemsBg,
+ }"
+ @click="toggle2"
+ />
+ <div
+ v-else
+ :class="{
+ 'mr-2 pr-[3px]': statConfig.config.value.catsList.isItemsBg,
+ }"
+ class="w-8"
+ />
+
+ <StatCategoriesLine
+ :isShowParent="props.isOneCategory ? false : !statConfig.config.value.catsList.isGrouped"
+ :item="item"
+ :biggestCatNumber="linesBiggestCatNumber"
+ :lineWidth="statConfig.config.value.catsList.isLines ? 0 : 1"
+ class="grow"
+ @click="emit('clickCategory', item.id)"
+ />
+ </div>
+ </template>
+
+ <!-- Inside -->
+ <div class="border-item-4 ml-5 mt-[-2px] -translate-x-px border-l pl-3">
+ <div
+ v-if="!item.categories || item.categories.length === 0"
+ class="mb-3 ml-11"
+ >
+ <TrnsList
+ :trnsIds="item.trnsIds"
+ :size="5"
+ alt
+ isShowExpense
+ isShowIncome
+ isShowTransfers
+ />
+ </div>
- <div
- v-if="!statConfig.config.value.catsList.isOpened"
- class="_gap-1 grid"
- >
- <UiToggle3
- v-for="itemInside in item.categories"
- :key="itemInside.id"
+ <div
+ v-if="item.categories && statConfig.config.value.catsList.isGrouped && statConfig.config.value.catsList.isOpened"
+ class="flex flex-wrap gap-1 pl-12 pt-2"
+ >
+ <StatCategoriesRound
+ v-for="itemInside in item.categories"
+ :key="itemInside.id"
+ :item="itemInside"
+ isShowAmount
+ @click="emit('clickCategory', itemInside.id)"
+ />
+ </div>
+
+ <div
+ v-if="!statConfig.config.value.catsList.isOpened"
:class="{
- group: !statConfig.config.value.catsList.isItemsBg,
+ 'mt-1': statConfig.config.value.catsList.isItemsBg,
}"
- :isShown="categoriesOpened[item.id]?.categories[itemInside.id]?.show ?? false"
- :openPadding="statConfig.config.value.catsList.isGrouped ? '!pb-3' : ''"
- @click="toggleChild(item.id, itemInside.id)"
+ class="_gap-1 grid"
>
- <template #header="{ toggle: toggleInside, isShown: isShownInside }">
- <div class="flex items-stretch justify-between">
- <UiToggleAction
- v-if="statConfig.config.value.catsList.isGrouped"
- :isShown="isShownInside"
- :class="{
- '-mr-2.5': !statConfig.config.value.catsList.isItemsBg,
- }"
- @click="toggleInside"
- />
-
- <StatCategoriesLine
- :isShowParent="!statConfig.config.value.catsList.isGrouped"
- :item="itemInside"
- :biggestCatNumber="biggestCatNumber"
- :lineWidth="statConfig.config.value.catsList.isLines ? 0 : 1"
- class="grow"
- @click="$emit('clickCategory', itemInside.id)"
+ <UiToggle3
+ v-for="itemInside in item.categories"
+ :key="itemInside.id"
+ :class="{
+ group: !statConfig.config.value.catsList.isItemsBg,
+ }"
+ :isShown="categoriesOpened[item.id]?.categories[itemInside.id]?.show ?? false"
+ :openPadding="statConfig.config.value.catsList.isGrouped ? '!pb-3' : ''"
+ @click="toggleChild(item.id, itemInside.id)"
+ >
+ <template #header="{ toggle: toggleInside, isShown: isShownInside }">
+ <div class="flex items-stretch justify-between">
+ <UiToggleAction
+ v-if="statConfig.config.value.catsList.isGrouped"
+ :isShown="isShownInside"
+ :class="{
+ '-mr-2.5': !statConfig.config.value.catsList.isItemsBg,
+ }"
+ @click="toggleInside"
+ />
+
+ <StatCategoriesLine
+ :isShowParent="!statConfig.config.value.catsList.isGrouped"
+ :item="itemInside"
+ :biggestCatNumber="biggestCatNumber"
+ :lineWidth="statConfig.config.value.catsList.isLines ? 0 : 1"
+ class="grow"
+ :class="{
+ 'my-px': statConfig.config.value.catsList.isItemsBg,
+ }"
+ @click="emit('clickCategory', itemInside.id)"
+ />
+ </div>
+ </template>
+
+ <!-- Inside -->
+ <div class="border-item-4 ml-5 mt-[-2px] -translate-x-px border-l pl-14">
+ <TrnsList
+ :trnsIds="itemInside.trnsIds"
+ :size="5"
+ alt
+ isShowExpense
+ isShowIncome
+ isShowTransfers
/>
</div>
- </template>
-
- <!-- Inside -->
- <div class="ml-5 mt-[-2px] -translate-x-px border-l border-item-4 pl-14">
- <TrnsList
- :trnsIds="itemInside.trnsIds"
- :size="5"
- alt
- isShowExpense
- isShowIncome
- isShowTransfers
- />
- </div>
- </UiToggle3>
+ </UiToggle3>
+ </div>
</div>
- </div>
- </UiToggle3>
- </div>
-
- <!-- Rounds -->
- <div
- v-if="statConfig.config.value.catsView === 'round'"
- class="@3xl/stat:gap-2 flex flex-wrap gap-1 gap-y-2 pl-1 pt-2 md:max-w-lg"
- >
- <StatCategoriesRound
- v-for="item in categoriesWithData"
- :key="item.id"
- :item="item"
- isShowAmount
- @click="$emit('clickCategory', item.id)"
- />
- </div>
- </template>
- </UiToggle>
+ </UiToggle3>
+ </div>
+ </template>
+ </UiToggle>
+ </div>
</template>
diff --git a/app/components/stat/date/Navigation.vue b/app/components/stat/date/Navigation.vue
index 97e1869f..9b02bc11 100644
--- a/app/components/stat/date/Navigation.vue
+++ b/app/components/stat/date/Navigation.vue
@@ -57,18 +57,16 @@ function changeDate(way: 'next' | 'prev' | 'today') {
</script>
<template>
- <div class="items-top @xl/page:pl-2 @xl/page:grid-cols-[auto,1fr] grid grid-cols-[1fr,auto] gap-2 md:max-w-lg">
+ <div class="items-top @xl/page:pl-2 @xl/page:grid-cols-[auto,1fr] grid grow grid-cols-[1fr,auto] gap-2">
<BottomSheetOrDropdown
:title="t('dates.select')"
:isOpen="statDate.modals.value.dateSelector"
- class="@xl/page:order-2 flex gap-1"
+ class="@xl/page:order-2 flex grow gap-1"
@onOpenModal="statDate.modals.value.dateSelector = true"
@onCloseModal="statDate.modals.value.dateSelector = false"
>
<template #trigger>
- <UiTitle8
- isShown
- >
+ <UiTitle8 isShown>
<StatDateRange />
</UiTitle8>
</template>
diff --git a/app/components/stat/date/Selector.vue b/app/components/stat/date/Selector.vue
index bbe67c5c..0e05a5ca 100644
--- a/app/components/stat/date/Selector.vue
+++ b/app/components/stat/date/Selector.vue
@@ -64,8 +64,8 @@ function selectInterval(grouped: Grouped) {
<div class="flex flex-wrap gap-1">
<DateRanges
:statDate
- view="periods"
isShowRangeAdjust
+ view="periods"
@onClose="emit('onClose')"
/>
</div>
@@ -122,11 +122,10 @@ function selectInterval(grouped: Grouped) {
<DatePicker
v-if="tabs.selected.value === 'calendar'"
- mode="range"
:rows="2"
:value="statDate.range.value"
+ mode="range"
@update:modelValue="(v: Range) => {
- console.log('v', v)
statDate.setRangeByCalendar(v);
close();
}"
@@ -136,30 +135,30 @@ function selectInterval(grouped: Grouped) {
<i18n lang="yaml">
en:
+ 12Months: 12m
+ 14Days: 14d
+ 30Days: 30d
+ 7Days: 7d
all: All
allSkipEmpty: Maximum
calendar: Calendar
intervalsGrouped: Grouped by
- ranges: Ranges
- presets: Presets
last: Last
- 7Days: 7d
- 14Days: 14d
- 30Days: 30d
- 12Months: 12m
mini: mini
+ presets: Presets
+ ranges: Ranges
ru:
+ 12Months: 12м
+ 14Days: 14д
+ 30Days: 30д
+ 7Days: 7д
all: Все
allSkipEmpty: Максимально
calendar: Календарь
intervalsGrouped: Группировка
- ranges: Диапазоны
- presets: Пресеты
last: Последние
- 7Days: 7д
- 14Days: 14д
- 30Days: 30д
- 12Months: 12м
mini: мини
+ presets: Пресеты
+ ranges: Диапазоны
</i18n>
diff --git a/app/components/stat/useStatConfig.ts b/app/components/stat/useStatConfig.ts
index 8d3389a1..429219a3 100644
--- a/app/components/stat/useStatConfig.ts
+++ b/app/components/stat/useStatConfig.ts
@@ -15,11 +15,13 @@ export const ConfigSchema = z.object({
isLines: z.boolean(),
isOpened: z.boolean(),
isRoundIcon: z.boolean(),
+ isShow: z.boolean(),
isShowFavorites: z.boolean(),
isShowRecent: z.boolean(),
}),
catsRound: z.object({
isGrouped: z.boolean(),
+ isShow: z.boolean(),
isShowFavorites: z.boolean(),
isShowRecent: z.boolean(),
}),
@@ -66,11 +68,13 @@ export function useStatConfig({ props, storageKey }: StatConfigParams) {
isLines: true,
isOpened: false,
isRoundIcon: true,
+ isShow: false,
isShowFavorites: false,
isShowRecent: false,
},
catsRound: {
isGrouped: false,
+ isShow: false,
isShowFavorites: false,
isShowRecent: false,
},
@@ -103,7 +107,7 @@ export function useStatConfig({ props, storageKey }: StatConfigParams) {
isShow: false,
},
}, localStorage, {
- mergeDefaults: true,
+ mergeDefaults: (storageValue, defaults) => defu(storageValue, defaults),
})
if (props) {
diff --git a/app/components/trnForm/Categories.vue b/app/components/trnForm/Categories.vue
index 886657f0..07738276 100644
--- a/app/components/trnForm/Categories.vue
+++ b/app/components/trnForm/Categories.vue
@@ -46,9 +46,9 @@ onMounted(() => {
<!-- Recent -->
<div class="swiper-slide h-full">
<div
- class="scrollerBlock rounded-t-2xl bg-item-1 px-3 py-4 text-center font-primary text-xl font-semibold"
+ class="scrollerBlock bg-item-1 font-primary rounded-t-2xl px-3 py-4 text-center text-xl font-semibold"
>
- {{ $t("categories.lastUsedTitle") }}
+ {{ $t('categories.recentCategories') }}
</div>
<div class="px-3 pb-1">
<CategoriesList
@@ -63,7 +63,7 @@ onMounted(() => {
<!-- Main -->
<div class="swiper-slide h-full">
<div
- class="scrollerBlock rounded-t-2xl bg-item-1 px-3 py-4 text-center font-primary text-xl font-semibold"
+ class="scrollerBlock bg-item-1 font-primary rounded-t-2xl px-3 py-4 text-center text-xl font-semibold"
>
{{ $t("categories.title") }}
</div>
@@ -79,8 +79,8 @@ onMounted(() => {
<!-- Favorite -->
<div class="swiper-slide h-full">
- <div class="scrollerBlock rounded-t-2xl bg-item-1 px-3 py-4 text-center font-primary text-xl font-semibold">
- {{ $t("categories.favoriteTitle") }}
+ <div class="scrollerBlock bg-item-1 font-primary rounded-t-2xl px-3 py-4 text-center text-xl font-semibold">
+ {{ $t('categories.favoriteCategories') }}
</div>
<div class="px-3 pb-1">
<CategoriesList
@@ -101,7 +101,7 @@ onMounted(() => {
:isActive="sliderObj.activeIndex === 0"
@click="sliderObj.slideTo(0)"
>
- {{ $t("categories.lastUsedTitle") }}
+ {{ $t('categories.recentCategories') }}
</UiTabsItem1>
<UiTabsItem1
@@ -115,7 +115,7 @@ onMounted(() => {
:isActive="sliderObj.activeIndex === 2"
@click="sliderObj.slideTo(2)"
>
- {{ $t("categories.favoriteTitle") }}
+ {{ $t('categories.favoriteCategories') }}
</UiTabsItem1>
</UiTabs1>
</div>
diff --git a/app/components/trnForm/Main.vue b/app/components/trnForm/Main.vue
index 9c0240a7..fdab5629 100644
--- a/app/components/trnForm/Main.vue
+++ b/app/components/trnForm/Main.vue
@@ -96,7 +96,7 @@ const actions = computed(() => ({
/>
<UiTitle3
- class="sticky top-0 z-10 bg-item-1 px-3 pb-3 pt-4 md:text-xl"
+ class="bg-item-1 sticky top-0 z-10 px-3 pb-3 pt-4 md:text-xl"
@click="trnsFormStore.values.trnId = null"
>
{{ trnsFormStore.values.trnId ? t("trnForm.titleEditTrn") : t("trnForm.createTrn") }}
@@ -108,7 +108,7 @@ const actions = computed(() => ({
>
<TrnsItem
:trnItem="trnsStore.computeTrnItem(trnsFormStore.values.trnId)"
- class="group rounded-lg bg-item-3"
+ class="bg-item-3 group rounded-lg"
@click="trnsFormStore.values.trnId = null"
/>
@@ -116,7 +116,7 @@ const actions = computed(() => ({
v-if="showModalConfirm"
class="absolute -bottom-4 left-0 z-10 w-full px-4"
>
- <div class="z-10 grid h-full content-center gap-4 rounded-lg border border-accent-1 bg-item-1 p-3 text-1">
+ <div class="border-accent-1 bg-item-1 text-1 z-10 grid h-full content-center gap-4 rounded-lg border p-3">
{{ t('base.sure') }}
<div class="flex gap-2">
@@ -134,7 +134,7 @@ const actions = computed(() => ({
/>
</template>
- <div class="leading-none text-2">
+ <div class="text-2 leading-none">
{{ item.label }}
</div>
</UiElement>
@@ -157,7 +157,7 @@ const actions = computed(() => ({
/>
</template>
- <div class="leading-none text-2">
+ <div class="text-2 leading-none">
{{ t(item.label) }}
</div>
</UiItem1>
diff --git a/app/components/trnForm/SelectionCategoriesFast.vue b/app/components/trnForm/SelectionCategoriesFast.vue
index a9c370c7..1e554c91 100644
--- a/app/components/trnForm/SelectionCategoriesFast.vue
+++ b/app/components/trnForm/SelectionCategoriesFast.vue
@@ -22,10 +22,10 @@ const trnsFormStore = useTrnsFormStore()
class="pb-6"
>
<UiTitle3
- class="sticky top-0 z-20 bg-item-1 px-3 pb-3 pt-4"
+ class="bg-item-1 sticky top-0 z-20 px-3 pb-3 pt-4"
@click="trnsFormStore.ui.catsRootModal = true"
>
- {{ t("categories.favoriteTitle") }}
+ {{ t('categories.favoriteCategories') }}
</UiTitle3>
<CategoriesSelector2
@@ -40,10 +40,10 @@ const trnsFormStore = useTrnsFormStore()
<!-- Recent categories -->
<div v-if="categoriesStore.recentCategoriesIds.length > 0">
<UiTitle3
- class="sticky top-0 z-20 bg-item-1 px-3 pb-3 pt-4"
+ class="bg-item-1 sticky top-0 z-20 px-3 pb-3 pt-4"
@click="trnsFormStore.ui.catsRootModal = true"
>
- {{ t("categories.lastUsedTitle") }}
+ {{ t('categories.recentCategories') }}
</UiTitle3>
<CategoriesSelector2
diff --git a/app/components/trnForm/SelectionWalletsAll.vue b/app/components/trnForm/SelectionWalletsAll.vue
index 7872be33..4171a768 100644
--- a/app/components/trnForm/SelectionWalletsAll.vue
+++ b/app/components/trnForm/SelectionWalletsAll.vue
@@ -22,7 +22,7 @@ const trnsFormStore = useTrnsFormStore()
<WalletsSelector
:activeItemId="trnsFormStore.values.walletId ?? undefined"
- class="min-w-72 px-2 py-px"
+ class="min-w-80 px-2 py-px"
@onSelected="id => emit('onSelectWallet', id)"
/>
</div>
diff --git a/app/components/trnForm/SelectorWallet.vue b/app/components/trnForm/SelectorWallet.vue
index 2037fe8c..dd72e56a 100644
--- a/app/components/trnForm/SelectorWallet.vue
+++ b/app/components/trnForm/SelectorWallet.vue
@@ -43,7 +43,7 @@ const isShow = ref(false)
<WalletsSelector
:hide="close"
:activeItemId="props.walletId"
- class="min-w-72 md:px-2"
+ class="min-w-80 md:px-2"
@onSelected="id => emit('onSelected', id)"
/>
</template>
diff --git a/app/components/trns/List.vue b/app/components/trns/List.vue
index 093d3211..b3d38cdb 100644
--- a/app/components/trns/List.vue
+++ b/app/components/trns/List.vue
@@ -172,7 +172,7 @@ const groupedTrns = computed(() => paginatedTrnsIds.value
<!-- Filter by type -->
<UiTabs2
v-if="isShowFilterByType && typeFilters.length > 2"
- class="mb-2 ml-1"
+ class="mb-2"
>
<UiTabsItem4
v-for="filterItem in typeFilters"
@@ -187,8 +187,7 @@ const groupedTrns = computed(() => paginatedTrnsIds.value
</UiTabsItem4>
</UiTabs2>
- <!-- With Desc -->
-
+ <!-- With Description -->
<div
v-if="isShowFilterByDesc && isTrnsWithDesc && selectedIds.length > 0"
class="relative pb-2"
@@ -209,7 +208,7 @@ const groupedTrns = computed(() => paginatedTrnsIds.value
<!-- Group Sum -->
<div
v-if="isShowGroupSum && paginatedTrnsIds.length > 1"
- class="border-b border-item-4 pb-2 pr-3"
+ class="border-item-4 border-b pb-2 pr-3"
>
<Amount
v-if="getTotalOfTrnsIds(paginatedTrnsIds).income !== 0"
@@ -252,7 +251,7 @@ const groupedTrns = computed(() => paginatedTrnsIds.value
<div
v-for="(groupTrnsIds, date) in groupedTrns"
:key="date"
- class="overflow-hidden rounded-lg bg-item-2"
+ class="bg-item-2 overflow-hidden rounded-lg"
>
<div
:class="{ 'border-item-4': isShowGroupSum && groupTrnsIds.length > 1 }"
@@ -275,7 +274,7 @@ const groupedTrns = computed(() => paginatedTrnsIds.value
:isShowBaseRate="false"
:type="1"
colorize="income"
- variant="sm"
+ class="text-4"
/>
<Amount
@@ -285,7 +284,7 @@ const groupedTrns = computed(() => paginatedTrnsIds.value
:isShowBaseRate="false"
:type="0"
isShowMinus
- variant="sm"
+ class="text-4"
/>
</div>
</div>
@@ -311,7 +310,7 @@ const groupedTrns = computed(() => paginatedTrnsIds.value
class="flex-center pt-1"
>
<div
- class="flex-center rounded-full bg-item-5 px-5 py-2 text-sm text-2 hocus:bg-item-6"
+ class="flex-center bg-item-5 text-2 hocus:bg-item-6 rounded-full px-5 py-2 text-sm"
@click="pageNumber = ++pageNumber"
>
{{ t("trns.more") }} {{ paginatedTrnsIds.length }} /
diff --git a/app/components/ui/Item1.vue b/app/components/ui/Item1.vue
index a8081386..6611b34c 100644
--- a/app/components/ui/Item1.vue
+++ b/app/components/ui/Item1.vue
@@ -1,7 +1,8 @@
<script setup lang="ts">
import { getStyles } from '~/components/ui/getStyles'
-const { variant = 'icon' } = defineProps<{
+const { isActive = false, variant = 'icon' } = defineProps<{
+ isActive?: boolean
variant?: 'icon' | 'text'
}>()
@@ -12,13 +13,16 @@ const emit = defineEmits<{
<template>
<div
- class="justify-center group-data-[headlessui-state=open]:!bg-item-4" :class="[
+ class="group-data-[headlessui-state=open]:!bg-item-4 justify-center" :class="[
getStyles('item', ['link', 'center', 'minh2', 'minw1', 'rounded']),
{
- 'text-xl': variant === 'icon',
+ 'text-2 text-xl': variant === 'icon',
},
{
- 'px-3 text-sm text-1': variant === 'text',
+ 'text-1 px-3 text-sm': variant === 'text',
+ },
+ {
+ '!bg-item-3': isActive,
},
]"
@click="(e: Event) => emit('click', e)"
diff --git a/app/components/ui/PopoverWrap.vue b/app/components/ui/PopoverWrap.vue
index 6efdf6af..3cebf679 100644
--- a/app/components/ui/PopoverWrap.vue
+++ b/app/components/ui/PopoverWrap.vue
@@ -9,7 +9,7 @@ const emit = defineEmits<{
</script>
<template>
- <div class="grid max-h-[60dvh] grid-rows-[auto,1fr] gap-0">
+ <div class="grid max-h-[60dvh] grid-rows-[auto,1fr] gap-0 ">
<UiTitleModal v-if="props.title">
{{ props.title }}
</UiTitleModal>
diff --git a/app/components/ui/TabsItem1.vue b/app/components/ui/TabsItem1.vue
index 7867aab3..5812dbf5 100644
--- a/app/components/ui/TabsItem1.vue
+++ b/app/components/ui/TabsItem1.vue
@@ -13,7 +13,7 @@ const emit = defineEmits(['click'])
:class="[getStyles('item', ['minh2']), {
'!bg-item-4': isActive,
}]"
- class="flex flex-1 grow select-none items-center justify-center gap-1 rounded-lg px-2 text-sm text-3 hocus:bg-item-5"
+ class="text-3 hocus:bg-item-5 flex flex-1 grow select-none items-center justify-center gap-1 text-nowrap rounded-lg px-2 text-sm"
@click="emit('click')"
>
<slot />
diff --git a/app/components/wallets/Selector.vue b/app/components/wallets/Selector.vue
index 2d7cf5e6..1fd21987 100644
--- a/app/components/wallets/Selector.vue
+++ b/app/components/wallets/Selector.vue
@@ -31,8 +31,8 @@ function onClickWallet(walletId: WalletId) {
:activeItemId="props.activeItemId || (props.selectedIds?.includes(walletId) ? walletId : null)"
:walletId
:wallet
- :lineWidth="2"
- class="group"
+ :lineWidth="4"
+ class="group/item"
isShowIcon
@click="onClickWallet(walletId)"
/>
diff --git a/app/components/layout/usePointerClass.ts b/app/composables/usePointerClass.ts
similarity index 100%
rename from app/components/layout/usePointerClass.ts
rename to app/composables/usePointerClass.ts
diff --git a/app/layouts/center.vue b/app/layouts/center.vue
index 6a038ab4..9fbf5c47 100644
--- a/app/layouts/center.vue
+++ b/app/layouts/center.vue
@@ -5,7 +5,6 @@ import '~/assets/css/tailwind.css'
import { Analytics } from '@vercel/analytics/nuxt'
import { SpeedInsights } from '@vercel/speed-insights/vue'
-import { usePointerClass } from '~/components/layout/usePointerClass'
import { useGuard } from '~/components/user/useGuard'
const { pointerClasses } = usePointerClass()
diff --git a/app/layouts/default.vue b/app/layouts/default.vue
index 7151b063..d5dbae4a 100644
--- a/app/layouts/default.vue
+++ b/app/layouts/default.vue
@@ -10,7 +10,6 @@ import { useAppNav } from '~/components/app/useAppNav'
import { useInitApp } from '~/components/app/useInitApp'
import { useCategoriesStore } from '~/components/categories/useCategoriesStore'
import { useDemo } from '~/components/demo/useDemo'
-import { usePointerClass } from '~/components/layout/usePointerClass'
import { useTrnsFormStore } from '~/components/trnForm/useTrnsFormStore'
import { useTrnsStore } from '~/components/trns/useTrnsStore'
import { useGuard } from '~/components/user/useGuard'
diff --git a/i18n/locales/en-US.js b/i18n/locales/en-US.js
index 308ffc6f..fdc882ae 100644
--- a/i18n/locales/en-US.js
+++ b/i18n/locales/en-US.js
@@ -43,8 +43,7 @@ export default {
allTitle: 'All',
childs: 'Child categories',
createNewTitle: 'Add category',
- favoriteTitle: 'Favorite categories',
-
+ favoriteCategories: 'Favorite categories',
form: {
childColor: 'Apply color to all child categories',
delete: {
@@ -53,12 +52,12 @@ export default {
okWithoutTrns: 'Category deleted',
okWithTrns: `Category deleted and {trns}`,
},
+ favoriteCategory: 'Favorite category',
icon: {
desc: 'Use any icon from',
label: 'Icon',
link: 'Link',
},
- lastUsed: 'Show in last used categories',
name: {
error: 'Write category name',
exist: 'Category with same name is exist',
@@ -69,12 +68,13 @@ export default {
label: 'Parent category',
no: 'Without parent',
},
- quickSelector: 'Show in quick selector',
+ quickSelector: 'Favorite category',
+ recentCategory: 'Recent category',
save: 'Save',
},
- lastUsedTitle: 'Recent categories',
name: 'Categories',
new: 'New category',
+ recentCategories: 'Recent categories',
title: 'Categories',
},
@@ -247,10 +247,17 @@ export default {
label: 'Grouping',
ungrouped: 'Not grouped',
},
+ list: {
+ title: 'List categories',
+ },
+ rounds: {
+ title: 'Rounds categories',
+ },
title: 'Categories config',
vertical: {
grouped: 'Grouped',
label: 'Vertical chart',
+ title: 'Vertical chart',
ungrouped: 'Not grouped',
},
view: {
diff --git a/i18n/locales/ru-RU.js b/i18n/locales/ru-RU.js
index 0619aa0e..00b487ed 100644
--- a/i18n/locales/ru-RU.js
+++ b/i18n/locales/ru-RU.js
@@ -43,8 +43,7 @@ export default {
allTitle: 'Все',
childs: 'Дочерние категории',
createNewTitle: 'Добавить категорию',
- favoriteTitle: 'Избранные категории',
-
+ favoriteCategories: 'Избранные категории',
form: {
childColor: 'Применить цвет ко всем дочерним категориям',
delete: {
@@ -53,12 +52,12 @@ export default {
okWithoutTrns: 'Категория удалена',
okWithTrns: `Категория удалена и {trns}`,
},
+ favoriteCategory: 'Избранная категория',
icon: {
desc: 'Используйте любую иконку из набора',
label: 'Иконка',
link: 'Ссылка',
},
- lastUsed: 'Показывать в списке недавних категорий',
name: {
error: 'Напишите название категории',
exist: 'Категория с таким именем уже существует',
@@ -69,13 +68,12 @@ export default {
label: 'Родительская категория',
no: 'Без родителя',
},
- quickSelector: 'Показывать в быстром выборе',
+ recentCategory: 'Показывать в недавно использованных',
save: 'Сохранить',
},
-
- lastUsedTitle: 'Недавние категории',
name: 'Категории',
new: 'Новая категория',
+ recentCategories: 'Недавние категории',
title: 'Категории',
},
@@ -248,10 +246,17 @@ export default {
label: 'Группировка',
ungrouped: 'Не группировать',
},
+ list: {
+ title: 'Список категорий',
+ },
+ rounds: {
+ title: 'Круглые категории',
+ },
title: 'Настройки категорий',
vertical: {
grouped: 'Группировать',
label: 'Вертикальный график',
+ title: 'Вертикальный график',
ungrouped: 'Не группировать',
},
view: {