Skip to content

Open source personal finance application

feat: improve stat categories - persist config, show filtered category across periods

Ilya Komichevbf61d51f3603
diff --git a/app/components/categories/ItemBody.vue b/app/components/categories/ItemBody.vue
index a3eb90f8..fa4eaf8a 100644
--- a/app/components/categories/ItemBody.vue
+++ b/app/components/categories/ItemBody.vue
@@ -5,13 +5,13 @@ import { useCategoriesStore } from '~/components/categories/useCategoriesStore'
const props = defineProps<{
activeItemId?: string | 0 | false | null
- alt?: boolean
category: CategoryItem
categoryId: CategoryId
class?: string
insideClasses?: string
isShowParent?: boolean
lineWidth?: number
+ stacked?: boolean
to?: string
}>()
@@ -47,11 +47,10 @@ const parentCategory = computed(() => categoriesStore.items[props.category?.pare
<div class="grid grow gap-0.5">
<CategoriesName
- :alt="props.alt"
+ :stacked="props.stacked"
:category="props.category"
:parentCategory="parentCategory"
- :hasChildren="childCategoriesIds.length > 0"
- :showChildrenCount="childCategoriesIds.length"
+ :childrenCount="childCategoriesIds.length"
:isShowParent="props.isShowParent"
/>
</div>
diff --git a/app/components/categories/SelectorGrid.vue b/app/components/categories/SelectorGrid.vue
index 0307a76c..896426ab 100644
--- a/app/components/categories/SelectorGrid.vue
+++ b/app/components/categories/SelectorGrid.vue
@@ -33,7 +33,7 @@ function select(id: CategoryId) {
:class="itemClasses"
:category="categoriesStore.items[categoryId]!"
isShowParent
- alt
+ stacked
@click="select(categoryId)"
/>
</div>
diff --git a/app/components/layout/Sidebar.vue b/app/components/layout/Sidebar.vue
index 66443c80..65378de8 100644
--- a/app/components/layout/Sidebar.vue
+++ b/app/components/layout/Sidebar.vue
@@ -1,9 +1,11 @@
<script setup lang="ts">
+import type { CategoryId } from '~/components/categories/types'
+import type { WalletId } from '~/components/wallets/types'
+
+import { useCategoriesStore } from '~/components/categories/useCategoriesStore'
import { useWalletContextMenu } from '~/components/wallets/useWalletContextMenu'
import { useWalletsStore } from '~/components/wallets/useWalletsStore'
-import type { WalletId } from '../wallets/types'
-
const props = defineProps<{
isShowSidebar?: boolean
}>()
@@ -15,9 +17,13 @@ const emit = defineEmits<{
const route = useRoute()
const { t } = useI18n()
const walletsStore = useWalletsStore()
+const categoriesStore = useCategoriesStore()
const isShowLogoMenu = ref(false)
const { getWalletContextMenuItems } = useWalletContextMenu()
+
+type SidebarTab = 'categories' | 'wallets'
+const activeTab = ref<SidebarTab>('wallets')
</script>
<template>
@@ -69,43 +75,56 @@ const { getWalletContextMenuItems } = useWalletContextMenu()
<LayoutSidebarMenu class="px-2 pb-2" />
- <div v-if="walletsStore.sortedIds.length > 0" class="px-2 pb-6">
- <UiTitleSection class="!text-4 pb-2 pl-3">
- {{ t('wallets.title') }}
- </UiTitleSection>
+ <div class="px-2 pb-6">
+ <div class="flex gap-1 pb-2 pl-1">
+ <UiTabsItemPill
+ variant="outline"
+ :isActive="activeTab === 'wallets'"
+ @click="activeTab = 'wallets'"
+ >
+ {{ t('wallets.name') }}
+ </UiTabsItemPill>
+ <UiTabsItemPill
+ variant="outline"
+ :isActive="activeTab === 'categories'"
+ @click="activeTab = 'categories'"
+ >
+ {{ t('categories.name') }}
+ </UiTabsItemPill>
+ </div>
- <WalletsList
- :limit="10"
- isShowToggle
- >
- <template #default="{ walletsIdsSorted, walletsItemsLimited }">
- <WalletsItem
- v-for="(walletItem, walletId) in walletsItemsLimited"
- :key="walletId"
- :activeItemId="(route.params.id as string)"
- :contextMenuItems="getWalletContextMenuItems(walletId as WalletId)"
- :lineWidth="1"
- :wallet="walletItem"
- :walletId
- class="group"
- isShowCreditLimit
- isShowRate
- isShowIcon
- :to="walletId === route.params.id ? '/dashboard' : `/wallets/${walletId}`"
- />
+ <!-- Wallets -->
+ <template v-if="activeTab === 'wallets' && walletsStore.recentWalletIds.length > 0">
+ <WalletsItem
+ v-for="walletId in walletsStore.recentWalletIds.slice(0, 10)"
+ :key="walletId"
+ :activeItemId="(route.params.id as string)"
+ :contextMenuItems="getWalletContextMenuItems(walletId as WalletId)"
+ :lineWidth="1"
+ :wallet="walletsStore.itemsComputed[walletId]!"
+ :walletId
+ class="group"
+ isShowCreditLimit
+ isShowRate
+ isShowIcon
+ :to="walletId === route.params.id ? '/dashboard' : `/wallets/${walletId}`"
+ />
+ </template>
- <div
- v-if="walletsIdsSorted.length === 0"
- class="flex-center flex-col py-4"
- >
- <NuxtLink to="/wallets/new">
- <UiButtonAccent rounded>
- {{ t('wallets.new') }}
- </UiButtonAccent>
- </NuxtLink>
- </div>
- </template>
- </WalletsList>
+ <!-- Categories -->
+ <template v-if="activeTab === 'categories' && categoriesStore.recentCategoriesIds.length > 0">
+ <CategoriesItem
+ v-for="categoryId in categoriesStore.recentCategoriesIds.slice(0, 10)"
+ :key="categoryId"
+ :activeItemId="(route.params.id as string)"
+ :categoryId="(categoryId as CategoryId)"
+ :category="categoriesStore.items[categoryId]!"
+ :lineWidth="1"
+ isShowParent
+ stacked
+ :to="categoryId === route.params.id ? '/dashboard' : `/categories/${categoryId}`"
+ />
+ </template>
</div>
</div>
diff --git a/app/components/stat/Header.vue b/app/components/stat/Header.vue
index a2a819df..c0c22283 100644
--- a/app/components/stat/Header.vue
+++ b/app/components/stat/Header.vue
@@ -40,40 +40,38 @@ const isPopoverOpen = ref(false)
<slot name="title" />
<template #actions>
- <div class="ml-auto flex items-center gap-1">
- <StatFilterSelector
- v-if="filterCategories || filterWallets"
- :isShowCategories="!!filterCategories"
- :isShowWallets="!!filterWallets"
- />
+ <StatFilterSelector
+ v-if="filterCategories || filterWallets"
+ :isShowCategories="!!filterCategories"
+ :isShowWallets="!!filterWallets"
+ />
- <StatConfigModal
- :isShowWallets="!!configWallets"
- />
+ <StatConfigModal
+ :isShowWallets="!!configWallets"
+ />
- <BottomSheetOrDropdown
- v-if="$slots.popover"
- :isOpen="isPopoverOpen"
- isShowCloseBtn
- @openModal="isPopoverOpen = true"
- @closeModal="isPopoverOpen = false"
- >
- <template #trigger>
- <UiActionButton :ariaLabel="$t('base.moreOptions')">
- <Icon name="lucide:ellipsis-vertical" size="20" />
- </UiActionButton>
- </template>
+ <BottomSheetOrDropdown
+ v-if="$slots.popover"
+ :isOpen="isPopoverOpen"
+ isShowCloseBtn
+ @openModal="isPopoverOpen = true"
+ @closeModal="isPopoverOpen = false"
+ >
+ <template #trigger>
+ <UiActionButton :ariaLabel="$t('base.moreOptions')">
+ <Icon name="lucide:ellipsis-vertical" size="20" />
+ </UiActionButton>
+ </template>
- <template #content>
- <div class="min-w-52 p-1 pt-4 pb-3">
- <slot
- name="popover"
- :close="() => isPopoverOpen = false"
- />
- </div>
- </template>
- </BottomSheetOrDropdown>
- </div>
+ <template #content>
+ <div class="min-w-52 p-1 pt-4 pb-3">
+ <slot
+ name="popover"
+ :close="() => isPopoverOpen = false"
+ />
+ </div>
+ </template>
+ </BottomSheetOrDropdown>
</template>
<template v-if="activeTab" #selected>
@@ -96,7 +94,7 @@ const isPopoverOpen = ref(false)
:walletId
:wallet="walletsStore.itemsComputed?.[walletId]!"
insideClasses="!min-h-[38px]"
- alt
+ compact
@click="onClickWallet(walletId)"
/>
</div>
diff --git a/app/components/stat/Item.vue b/app/components/stat/Item.vue
index 5aebcd34..27262e87 100644
--- a/app/components/stat/Item.vue
+++ b/app/components/stat/Item.vue
@@ -139,20 +139,24 @@ function onClickSumItemWrap(type: SeriesSlugSelected) {
@clickAverage="statConfig.updateConfig('statAverage', { isShow: !isShowAverage })"
/>
- <div class="_min-h-dvh grid min-w-0 content-start items-start gap-4">
- <StatCategoriesRoundSection
- v-if="isRoundShow && hasCategoriesData"
- :filteredCategoriesIds
- :isOneCategory="isOneCategory"
- :preCategoriesIds="props.preCategoriesIds || categoriesStore.favoriteCategoriesIds"
- :selectedTrnsIds
- @clickCategory="onClickCategory"
- @setCategoryFilter="onSetCategoryFilter"
- />
+ <StatCategoriesRoundSection
+ v-if="isRoundShow && hasCategoriesData && (selectedTrnsIds.length > 0 || filteredCategoriesIds.length > 0)"
+ :filteredCategoriesIds
+ :isOneCategory="isOneCategory"
+ :preCategoriesIds="props.preCategoriesIds"
+ :selectedTrnsIds
+ @clickCategory="onClickCategory"
+ @setCategoryFilter="onSetCategoryFilter"
+ />
+
+ <div
+ v-if="selectedTrnsIds.length > 0"
+ class="_min-h-dvh grid min-w-0 content-start items-start gap-4"
+ >
<div
:class="{
- 'grid gap-5 @3xl/page:grid-cols-2 @3xl/page:gap-6': shouldUseTwoColumnLayout,
+ 'grid gap-5 @3xl/stat:grid-cols-2 @3xl/stat:gap-6': shouldUseTwoColumnLayout,
}"
>
<StatCategoriesDetailedSection
@@ -171,10 +175,16 @@ function onClickSumItemWrap(type: SeriesSlugSelected) {
:isPeriodOneDay="isPeriodOneDay"
:selectedTrnsIds="selectedAndFilteredTrnsIds"
:storageKey="statItemStorageKey"
- class="@3xl/page:order-1"
+ class="@3xl/stat:order-1"
/>
</div>
</div>
+
+ <div v-else class="mx-auto grid w-full max-w-150 content-start justify-items-center gap-4">
+ <TrnsNoTrns />
+
+ <StatCategoriesRoundSectionRecent />
+ </div>
</div>
<BottomSheetModal
diff --git a/app/components/stat/categories/RoundSection.vue b/app/components/stat/categories/RoundSection.vue
index 3d186672..fb0ccaeb 100644
--- a/app/components/stat/categories/RoundSection.vue
+++ b/app/components/stat/categories/RoundSection.vue
@@ -2,6 +2,7 @@
import type { CategoryId } from '~/components/categories/types'
import type { TrnId } from '~/components/trns/types'
+import { useCategoriesStore } from '~/components/categories/useCategoriesStore'
import { useStatCategories } from '~/components/stat/categories/useStatCategories'
import { statConfigKey } from '~/components/stat/injectionKeys'
@@ -17,57 +18,118 @@ const emit = defineEmits<{
setCategoryFilter: [categoryId: CategoryId]
}>()
+const { t } = useI18n()
const visibleCategoriesLimit = 12
const { computeCategoriesWithData } = useStatCategories()
+const categoriesStore = useCategoriesStore()
const statConfig = inject(statConfigKey)!
-const isExpanded = ref(false)
+const isMenuOpen = ref(false)
+const isExpanded = computed(() => statConfig.config.value.catsRound.isExpanded)
const isGrouped = computed(() => statConfig.config.value.catsRound.isGrouped)
-const roundCategories = computed(() => computeCategoriesWithData(props.selectedTrnsIds ?? [], isGrouped.value, props.preCategoriesIds))
+const isShowFavorites = computed(() => statConfig.config.value.catsRound.isShowFavorites)
+const isShowRecent = computed(() => statConfig.config.value.catsRound.isShowRecent)
+
+const mergedPreCategoriesIds = computed(() => {
+ const ids: CategoryId[] = []
+ const seen = new Set<CategoryId>()
+
+ function addId(id: CategoryId) {
+ if (!seen.has(id)) {
+ seen.add(id)
+ ids.push(id)
+ }
+ }
+
+ if (props.preCategoriesIds) {
+ for (const id of props.preCategoriesIds)
+ addId(id)
+ }
+
+ if (isShowFavorites.value) {
+ for (const id of categoriesStore.favoriteCategoriesIds)
+ addId(id)
+ }
+
+ if (isShowRecent.value) {
+ for (const id of categoriesStore.recentCategoriesIds)
+ addId(id)
+ }
+
+ for (const id of props.filteredCategoriesIds)
+ addId(id)
+
+ return ids
+})
+
+const roundCategories = computed(() => computeCategoriesWithData(props.selectedTrnsIds ?? [], isGrouped.value, mergedPreCategoriesIds.value))
const visibleCategories = computed(() => isExpanded.value ? roundCategories.value : roundCategories.value.slice(0, visibleCategoriesLimit))
const filteredSet = computed(() => new Set(props.filteredCategoriesIds))
</script>
<template>
- <div class="flex flex-wrap gap-1 gap-y-2">
- <StatCategoriesRound2lines
- v-for="item in visibleCategories"
- :key="item.id"
- :item="item"
- :class="{
- 'opacity-60': filteredSet.size > 0 && !filteredSet.has(item.id),
- 'opacity-50': !filteredSet.has(item.id) && item.value === 0,
- '!border-(--ui-primary)': filteredSet.has(item.id),
- }"
- class="transition-opacity"
- isShowAmount
- @click="emit('setCategoryFilter', item.id)"
- />
-
- <div
- v-if="!props.isOneCategory"
- class="flex items-center"
- >
- <UiTabsBar>
+ <div class="flex items-start gap-1">
+ <div class="flex min-w-0 flex-1 flex-wrap justify-center gap-1 gap-y-2 @2xl/stat:justify-start">
+ <StatCategoriesRound2lines
+ v-for="item in visibleCategories"
+ :key="item.id"
+ :item="item"
+ :class="{
+ 'opacity-60': filteredSet.size > 0 && !filteredSet.has(item.id),
+ 'opacity-50': !filteredSet.has(item.id) && item.value === 0,
+ '!border-(--ui-primary)': filteredSet.has(item.id),
+ }"
+ class="transition-opacity"
+ isShowAmount
+ :isShowParent="false"
+ @click="emit('setCategoryFilter', item.id)"
+ />
+ </div>
+
+ <div class="sticky top-0 shrink-0">
+ <UPopover
+ v-model:open="isMenuOpen"
+ :content="{
+ align: 'end',
+ side: 'bottom',
+ }"
+ >
<UiActionButton
- v-if="roundCategories.length > visibleCategoriesLimit"
- :ariaLabel="$t('base.toggleExpand')"
+ :ariaLabel="t('base.moreOptions')"
+ class="aspect-square"
size="sm"
- @click="isExpanded = !isExpanded"
>
- <Icon
- :name="isExpanded ? 'lucide:chevron-up' : 'lucide:chevron-down'"
- :size="20"
- />
+ <Icon name="lucide:ellipsis" :size="20" />
</UiActionButton>
- <StatCategoriesGroupingToggle
- :isGrouped="isGrouped"
- size="sm"
- @toggle="statConfig.config.value.catsRound.isGrouped = !isGrouped"
- />
- </UiTabsBar>
+ <template #content>
+ <div class="min-w-52 p-1">
+ <UiSwitchItem
+ :checkboxValue="isGrouped"
+ :title="t('stat.config.categories.rounds.groupByParent')"
+ @click="statConfig.updateConfig('catsRound', { isGrouped: !isGrouped })"
+ />
+ <UiSwitchItem
+ :checkboxValue="isShowFavorites"
+ :title="t('stat.config.categories.rounds.showFavorites')"
+ @click="statConfig.updateConfig('catsRound', { isShowFavorites: !isShowFavorites })"
+ />
+ <UiSwitchItem
+ :checkboxValue="isShowRecent"
+ :title="t('stat.config.categories.rounds.showRecent')"
+ @click="statConfig.updateConfig('catsRound', { isShowRecent: !isShowRecent })"
+ />
+
+ <UiSwitchItem
+ v-if="roundCategories.length > visibleCategoriesLimit"
+ :checkboxValue="isExpanded"
+ :title="t('base.toggleExpand')"
+ @click="statConfig.updateConfig('catsRound', { isExpanded: !isExpanded })"
+ />
+ </div>
+ </template>
+ </UPopover>
</div>
</div>
</template>
diff --git a/app/components/stat/categories/RoundSectionRecent.vue b/app/components/stat/categories/RoundSectionRecent.vue
new file mode 100644
index 00000000..76118313
--- /dev/null
+++ b/app/components/stat/categories/RoundSectionRecent.vue
@@ -0,0 +1,80 @@
+<script setup lang="ts">
+import type { CategoryId } from '~/components/categories/types'
+
+import { useCategoriesStore } from '~/components/categories/useCategoriesStore'
+import { compareCategoryIds } from '~/components/categories/utils'
+import { useTrnsFormStore } from '~/components/trnForm/useTrnsFormStore'
+
+const categoriesStore = useCategoriesStore()
+const trnsFormStore = useTrnsFormStore()
+
+const categoryIds = computed(() => {
+ const seen = new Set<CategoryId>()
+ const ids: CategoryId[] = []
+
+ for (const id of categoriesStore.favoriteCategoriesIds) {
+ if (!seen.has(id)) {
+ seen.add(id)
+ ids.push(id)
+ }
+ }
+
+ for (const id of categoriesStore.recentCategoriesIds) {
+ if (!seen.has(id)) {
+ seen.add(id)
+ ids.push(id)
+ }
+ }
+
+ return ids.sort((a, b) => compareCategoryIds(a, b, categoriesStore.items))
+})
+
+function onClick(categoryId: CategoryId) {
+ if (!categoriesStore.isTransactible(categoryId))
+ return
+
+ trnsFormStore.openFormForCreate()
+ trnsFormStore.$patch((state) => {
+ state.values.amount = [0, 0, 0]
+ state.values.amountRaw = ['', '', '']
+ state.values.categoryId = categoryId
+ state.ui.isShow = true
+ state.values.date = Date.now()
+ })
+}
+</script>
+
+<template>
+ <div class="flex flex-wrap justify-center gap-1 gap-y-2">
+ <div
+ v-for="categoryId in categoryIds"
+ :key="categoryId"
+ class="dark:bg-item-3 relative flex cursor-default items-center gap-2 overflow-hidden rounded-2xl border border-transparent p-1 pr-3 hover:bg-(--item-5)"
+ @click="onClick(categoryId)"
+ >
+ <div
+ :style="{ backgroundColor: categoriesStore.items[categoryId]?.color }"
+ class="absolute inset-0 size-full opacity-10"
+ />
+
+ <div class="size-6">
+ <UiIconBase
+ :name="categoriesStore.items[categoryId]?.icon"
+ :color="categoriesStore.items[categoryId]?.color"
+ :size="14"
+ class="!w-6 p-1"
+ invert
+ />
+ </div>
+
+ <CategoriesName
+ v-if="categoriesStore.items[categoryId]"
+ :category="categoriesStore.items[categoryId]!"
+ :isShowParent="!!categoriesStore.items[categoryId]?.parentId"
+ :parentCategory="categoriesStore.items[categoryId]?.parentId ? categoriesStore.items[categoriesStore.items[categoryId]!.parentId] : undefined"
+ stacked
+ size="xs"
+ />
+ </div>
+ </div>
+</template>
diff --git a/app/components/stat/filter/Selected.vue b/app/components/stat/filter/Selected.vue
index 4ed73e20..3ca2fc57 100644
--- a/app/components/stat/filter/Selected.vue
+++ b/app/components/stat/filter/Selected.vue
@@ -24,7 +24,7 @@ const itemClasses = 'bg-item-3 rounded-sm'
:walletId="walletId"
:wallet="walletsStore.itemsComputed[walletId]!"
insideClasses="!min-h-[38px]"
- alt
+ compact
isShowCreditLimit
@click="filter.removeWalletId(walletId)"
/>
@@ -37,7 +37,7 @@ const itemClasses = 'bg-item-3 rounded-sm'
:category="categoriesStore.items[categoryId]!"
:categoryId="categoryId"
:class="itemClasses"
- alt
+ stacked
insideClasses="!min-h-[38px]"
@click="filter.removeCategoryId(categoryId)"
/>
diff --git a/app/components/stat/useStatConfig.ts b/app/components/stat/useStatConfig.ts
index c4f0bdc2..8a42c113 100644
--- a/app/components/stat/useStatConfig.ts
+++ b/app/components/stat/useStatConfig.ts
@@ -18,8 +18,11 @@ export const ConfigSchema = z.object({
isShow: z.boolean(),
}),
catsRound: z.object({
+ isExpanded: z.boolean(),
isGrouped: z.boolean(),
isShow: z.boolean(),
+ isShowFavorites: z.boolean(),
+ isShowRecent: z.boolean(),
}),
catsView: z.enum(['list', 'round']),
chart: z.object({
@@ -72,8 +75,11 @@ export function useStatConfig({ props, storageKey }: StatConfigParams) {
isShow: true,
},
catsRound: {
+ isExpanded: true,
isGrouped: false,
isShow: true,
+ isShowFavorites: false,
+ isShowRecent: false,
},
catsView: 'list',
chart: {
diff --git a/app/components/trnForm/SelectionWalletsFast.vue b/app/components/trnForm/SelectionWalletsFast.vue
index a1b95bf9..687c0b00 100644
--- a/app/components/trnForm/SelectionWalletsFast.vue
+++ b/app/components/trnForm/SelectionWalletsFast.vue
@@ -1,8 +1,22 @@
<script setup lang="ts">
+import type { WalletId } from '~/components/wallets/types'
+
import { useTrnsFormStore } from '~/components/trnForm/useTrnsFormStore'
+import { useWalletsStore } from '~/components/wallets/useWalletsStore'
const { t } = useI18n()
const trnsFormStore = useTrnsFormStore()
+const walletsStore = useWalletsStore()
+
+const recentWallets = computed(() => {
+ const ids = walletsStore.recentWalletIds.slice(0, 5)
+ return ids.reduce((acc, id) => {
+ const wallet = walletsStore.itemsComputed[id]
+ if (wallet)
+ acc[id] = wallet
+ return acc
+ }, {} as Record<WalletId, typeof walletsStore.itemsComputed[WalletId]>)
+})
</script>
<template>
@@ -11,22 +25,18 @@ const trnsFormStore = useTrnsFormStore()
{{ t('wallets.title') }}
</UiTitleModal>
- <WalletsList
- v-slot="{ walletsItemsLimited }"
- :limit="5"
- class="grid grid-cols-2 gap-1 px-3 pt-1"
- >
+ <div class="grid grid-cols-2 gap-1 px-3 pt-1">
<WalletsItem
- v-for="(wallet, walletId) in walletsItemsLimited"
+ v-for="(wallet, walletId) in recentWallets"
:key="walletId"
:activeItemId="trnsFormStore.values.walletId"
- :walletId
+ :walletId="(walletId as WalletId)"
:wallet
isShowIcon
isShowCreditLimit
- alt
- @click="trnsFormStore.values.walletId = walletId"
+ compact
+ @click="trnsFormStore.values.walletId = (walletId as WalletId)"
/>
- </WalletsList>
+ </div>
</div>
</template>
diff --git a/app/components/trnForm/SelectorCategory.vue b/app/components/trnForm/SelectorCategory.vue
index b6c32188..8f9993ad 100644
--- a/app/components/trnForm/SelectorCategory.vue
+++ b/app/components/trnForm/SelectorCategory.vue
@@ -29,7 +29,8 @@ const isShow = ref(false)
<CategoriesItem
:category="props.category"
:categoryId="props.categoryId"
- alt
+ stacked
+ isShowParent
insideClasses="bg-item-3 min-h-[42px] py-2"
/>
</template>
diff --git a/app/components/trnForm/SelectorWallet.vue b/app/components/trnForm/SelectorWallet.vue
index 01611eb8..aafd2d6f 100644
--- a/app/components/trnForm/SelectorWallet.vue
+++ b/app/components/trnForm/SelectorWallet.vue
@@ -35,7 +35,7 @@ const isShow = ref(false)
insideClasses="!min-h-[46px]"
isShowIcon
isShowCreditLimit
- alt
+ compact
/>
</template>
diff --git a/app/components/trns/Item.vue b/app/components/trns/Item.vue
index 0ec02d4e..349c516f 100644
--- a/app/components/trns/Item.vue
+++ b/app/components/trns/Item.vue
@@ -4,7 +4,7 @@ import type { TrnItemFull } from '~/components/trns/types'
import { TrnType } from '~/components/trns/types'
const props = defineProps<{
- alt?: boolean
+ compact?: boolean
date?: string
trnItem: TrnItemFull
}>()
@@ -17,11 +17,11 @@ const emit = defineEmits<{
<template>
<UiElement
v-if="props.trnItem"
- :lineWidth="props.alt ? 3 : 0"
- :insideClasses="props.alt ? 'py-2 min-h-[32px]' : 'py-3 min-h-[38px]'"
+ :lineWidth="props.compact ? 3 : 0"
+ :insideClasses="props.compact ? 'py-2 min-h-[32px]' : 'py-3 min-h-[38px]'"
@click="emit('click')"
>
- <template v-if="!alt" #leftIcon>
+ <template v-if="!compact" #leftIcon>
<UiIconBase
:name="props.trnItem.category?.icon"
:color="props.trnItem.category?.color"
@@ -32,7 +32,7 @@ const emit = defineEmits<{
<div class="grid grow gap-1 pr-1">
<div class="flex grow items-center gap-3">
<!-- Alt -->
- <template v-if="alt">
+ <template v-if="compact">
<div
v-if="date"
class="text-2xs min-w-10 truncate leading-none"
@@ -60,13 +60,11 @@ const emit = defineEmits<{
class="grid grow gap-1"
>
<div
- v-if="!alt"
+ v-if="!compact"
class="grid grow gap-0.5"
>
<CategoriesName
:category="trnItem.category"
- :parentCategory="trnItem.categoryParent"
- isShowDots
/>
</div>
diff --git a/app/components/trns/List.vue b/app/components/trns/List.vue
index 21b6d575..58ce9bb6 100644
--- a/app/components/trns/List.vue
+++ b/app/components/trns/List.vue
@@ -10,7 +10,7 @@ import { TrnType } from '~/components/trns/types'
import { useTrnsStore } from '~/components/trns/useTrnsStore'
const {
- alt,
+ compact,
isShowDates,
isShowExpense,
isShowFilterByDesc,
@@ -22,7 +22,7 @@ const {
size = 30,
trnsIds = [],
} = defineProps<{
- alt?: boolean
+ compact?: boolean
isShowDates?: boolean
isShowExpense?: boolean
isShowFilterByDesc?: boolean
@@ -252,7 +252,7 @@ function onOpenTrnForm(date: number) {
<template v-for="trnId in paginatedTrnsIds" :key="trnId">
<TrnsItemWrap
v-if="trnItemsMap.get(trnId)"
- :alt="alt"
+ :compact="compact"
:date="(formatDate(trnItemsMap.get(trnId)!.date, 'trnItem') as string)"
:trnId="trnId"
:trnItem="trnItemsMap.get(trnId)!"
@@ -313,7 +313,7 @@ function onOpenTrnForm(date: number) {
<template v-for="trnId in groupTrnsIds" :key="trnId">
<TrnsItemWrap
v-if="trnItemsMap.get(trnId)"
- :alt="alt"
+ :compact="compact"
:trnId="trnId"
:trnItem="trnItemsMap.get(trnId)!"
:date="(formatDate(trnItemsMap.get(trnId)!.date, 'trnItem') as string)"
diff --git a/app/components/trns/itemWrap.vue b/app/components/trns/itemWrap.vue
index d474cbc6..f54895f5 100644
--- a/app/components/trns/itemWrap.vue
+++ b/app/components/trns/itemWrap.vue
@@ -7,7 +7,7 @@ import { useTrnsStore } from '~/components/trns/useTrnsStore'
defineOptions({ inheritAttrs: false })
const props = defineProps<{
- alt?: boolean
+ compact?: boolean
date?: string
trnId: TrnId
trnItem: TrnItemFull
@@ -57,7 +57,7 @@ function handleDeleteConfirm() {
<template>
<UContextMenu v-bind="$attrs" :items="contextMenuItems">
<TrnsItem
- :alt="props.alt"
+ :compact="props.compact"
:trnItem
:date
@click="click"
diff --git a/app/components/wallets/ItemBody.vue b/app/components/wallets/ItemBody.vue
index b754f4fc..36ae104f 100644
--- a/app/components/wallets/ItemBody.vue
+++ b/app/components/wallets/ItemBody.vue
@@ -9,7 +9,7 @@ import { getCreditAvailable } from '~/components/wallets/types'
const props = defineProps<{
activeItemId?: WalletId | null
- alt?: boolean
+ compact?: boolean
insideClasses?: string
isShowBaseRate?: boolean
isShowCreditLimit?: boolean
@@ -31,7 +31,7 @@ const currenciesStore = useCurrenciesStore()
const classes = computed(() => ([
'relative',
{
- 'bg-item-3 rounded-sm': props.alt,
+ 'bg-item-3 rounded-sm': props.compact,
},
{
group: props.isSort,
@@ -88,7 +88,7 @@ if (!props.isSort) {
</template>
<!-- Main -->
- <template v-if="!props.alt">
+ <template v-if="!props.compact">
<div class="grid grow gap-1">
<div class="text-muted text-sm leading-none font-medium tracking-wide text-nowrap">
{{ wallet.name }}
@@ -161,7 +161,7 @@ if (!props.isSort) {
</template>
<!-- Alternative -->
- <template v-if="props.alt">
+ <template v-if="props.compact">
<div class="grid grow gap-0.5">
<div class="text-2 text-xs leading-none whitespace-nowrap">
{{ wallet.name }}
diff --git a/app/components/wallets/SortModal.vue b/app/components/wallets/SortModal.vue
index 1f7ed445..4f88519b 100644
--- a/app/components/wallets/SortModal.vue
+++ b/app/components/wallets/SortModal.vue
@@ -29,7 +29,7 @@ function saveWalletsOrder(close: () => void) {
:key="walletId"
:walletId
:wallet="walletsStore.itemsComputed[walletId]!"
- alt
+ compact
isSort
isShowIcon
/>