Open source personal finance application
refactor: update component styles and structure for improved UI consistency
Ilya Komichev7f2c5c4fc836
diff --git a/app/components/categories/Form.vue b/app/components/categories/Form.vueindex 673bdf55..0bfe8614 100644--- a/app/components/categories/Form.vue+++ b/app/components/categories/Form.vue@@ -520,7 +520,7 @@ async function onSave() {:key="id"type="button":aria-pressed="selectedChildIds.includes(id)"- :class="cn('flex w-full items-center gap-3 px-3 py-2 text-left transition hover:bg-muted', selectedChildIds.includes(id) && 'bg-muted')"+ :class="cn('flex w-full items-center gap-3 px-3 py-2 text-left transition hover:bg-elevated/50 rounded-sm', selectedChildIds.includes(id) && 'bg-elevated/30')"@click="toggleChildSelection(id)"><div :class="cn('flex size-5 shrink-0 items-center justify-center rounded border transition', selectedChildIds.includes(id) ? 'border-primary bg-primary' : 'border-default')">@@ -531,22 +531,19 @@ async function onSave() {class="text-icon-primary"/></div>+<UiIconBase:color="categoriesStore.items[id]?.color":name="categoriesStore.items[id]?.icon ?? ''"invert/>- <div class="min-w-0 flex-1">- <div class="truncate">- {{ categoriesStore.items[id]?.name }}- </div>- <div- v-if="group === 'fromOther'"- class="text-muted truncate text-xs"- >- {{ t('categories.form.children.currentlyIn', { parent: getParentName(id) }) }}- </div>- </div>++ <CategoriesName+ stacked+ :category="categoriesStore.items[id]!"+ :parentCategory="id ? categoriesStore.items[categoriesStore.items[id]?.parentId as CategoryId] : undefined"+ :isShowParent="!!getParentName(id)"+ /></button></div></template>diff --git a/app/components/categories/StatPage.vue b/app/components/categories/StatPage.vueindex 9d6e3e7f..14fbc3d1 100644--- a/app/components/categories/StatPage.vue+++ b/app/components/categories/StatPage.vue@@ -91,7 +91,6 @@ useHead({ title: category.value?.name })<template #popover="{ close }"><UiHeaderLink- v-if="categoryId !== 'transfer'"icon="lucide:pencil"@click="close(); router.push(`/categories/${categoryId}/edit`)">diff --git a/app/components/categories/page/New.vue b/app/components/categories/page/New.vueindex 544cf1df..5ef037fa 100644--- a/app/components/categories/page/New.vue+++ b/app/components/categories/page/New.vue@@ -24,7 +24,11 @@ useHead({{{ t('categories.createNewTitle') }}</h1>- <UiHeader v-else hideSearch>+ <UiHeader+ v-else+ hideSearch+ backTo="categories"+ ><UiHeaderTitle>{{ t('categories.createNewTitle') }}</UiHeaderTitle>diff --git a/app/components/layout/Sidebar.vue b/app/components/layout/Sidebar.vueindex 8fd0b1bd..44571364 100644--- a/app/components/layout/Sidebar.vue+++ b/app/components/layout/Sidebar.vue@@ -55,9 +55,7 @@ const sidebarCategoryIds = computed(() => {<template><aside- :class="{- 'md:w-72': props.isShowSidebar,- }"+ :class="{ 'md:w-72': props.isShowSidebar }"class="fixed inset-y-0 left-0 z-40 hidden h-dvh w-12 overflow-hidden transition-all duration-300 ease-in-out md:block"><div class="relative h-full overflow-hidden overflow-y-auto overscroll-contain">diff --git a/app/components/stat/Header.vue b/app/components/stat/Header.vueindex ec96c614..23e4aba5 100644--- a/app/components/stat/Header.vue+++ b/app/components/stat/Header.vue@@ -42,7 +42,7 @@ const isPopoverOpen = ref(false)<slot name="title" /><template #actions>- <div class="hidden items-center sm:flex">+ <div class="flex items-center"><StatFilterSelectorv-if="filterCategories || filterWallets":isShowCategories="!!filterCategories"@@ -53,44 +53,6 @@ const isPopoverOpen = ref(false):isShowWallets="!!configWallets"/></div>-- <BottomSheetOrDropdown- :class="$slots.popover ? '' : 'sm:hidden'"- :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="{ close: closeContent }">- <div class="min-w-52 p-1 pt-4 pb-3">- <!-- Mobile: search, filters, config -->- <div class="sm:hidden" :class="[$slots.popover ? 'border-default mb-2 border-b pb-3' : '']">- <StatFilterSelector- v-if="filterCategories || filterWallets"- :isShowCategories="!!filterCategories"- :isShowWallets="!!filterWallets"- labelMode- />-- <StatConfigModal- :isShowWallets="!!configWallets"- labelMode- />- </div>-- <slot- name="popover"- :close="() => { closeContent?.(); isPopoverOpen = false }"- />- </div>- </template>- </BottomSheetOrDropdown></template><template v-if="activeTab && !props.hideTabs" #selected>diff --git a/app/components/stat/categories/ConfigMenu.vue b/app/components/stat/categories/ConfigMenu.vueindex 20d21b72..874f8fb2 100644--- a/app/components/stat/categories/ConfigMenu.vue+++ b/app/components/stat/categories/ConfigMenu.vue@@ -159,7 +159,7 @@ function setGrouping(mode: GroupingMode) {<divv-if="isExpandedChartCard"- class="grid gap-2 p-2 transition-opacity"+ class="p-2 transition-opacity":class="{ 'pointer-events-none opacity-50': !isChartShow }"><StatConfigSwitch@@ -185,43 +185,45 @@ function setGrouping(mode: GroupingMode) {/><!-- Chart: view (md+ only) -->- <div class="hidden gap-2 md:grid">- <UiTitleSection size="sm" class="px-1">- {{ t('stat.config.chartView.label') }}- </UiTitleSection>- <UiTabsBar>- <UiTabsItemPill- v-for="view in chartViewOptions"- :key="view"- variant="outline"- :isActive="statConfig.config.value.chartView === view"- class="grow"- @click="statConfig.updateConfig('chartView', view)"- >- {{ t(`stat.config.chartView.${view}`) }}- </UiTabsItemPill>- </UiTabsBar>- </div>+ <grid class="grid gap-4 pt-4">+ <div class="hidden gap-2 md:grid">+ <UiTitleSection size="sm" class="px-1">+ {{ t('stat.config.chartView.label') }}+ </UiTitleSection>+ <UiTabsBar>+ <UiTabsItemPill+ v-for="view in chartViewOptions"+ :key="view"+ variant="outline"+ :isActive="statConfig.config.value.chartView === view"+ class="grow"+ @click="statConfig.updateConfig('chartView', view)"+ >+ {{ t(`stat.config.chartView.${view}`) }}+ </UiTabsItemPill>+ </UiTabsBar>+ </div>- <!-- Chart: type -->- <div class="grid gap-2">- <UiTitleSection size="sm" class="px-1">- {{ t('stat.config.chart.type.label') }}- </UiTitleSection>- <UiTabsBar>- <UiTabsItemPill- v-for="item in chartTypeOptions"- :key="item.value"- variant="outline"- :isActive="statConfig.config.value.chartType === item.value"- class="flex grow gap-1"- @click="statConfig.updateConfig('chartType', item.value)"- >- <Icon :name="item.icon" :size="16" />- {{ item.label }}- </UiTabsItemPill>- </UiTabsBar>- </div>+ <!-- Chart: type -->+ <div class="grid gap-2">+ <UiTitleSection size="sm" class="px-1">+ {{ t('stat.config.chart.type.label') }}+ </UiTitleSection>+ <UiTabsBar>+ <UiTabsItemPill+ v-for="item in chartTypeOptions"+ :key="item.value"+ variant="outline"+ :isActive="statConfig.config.value.chartType === item.value"+ class="flex grow gap-1"+ @click="statConfig.updateConfig('chartType', item.value)"+ >+ <Icon :name="item.icon" :size="16" />+ {{ item.label }}+ </UiTabsItemPill>+ </UiTabsBar>+ </div>+ </grid></div></div>diff --git a/app/components/stat/filter/Selector.vue b/app/components/stat/filter/Selector.vueindex 91f5d850..09e94a15 100644--- a/app/components/stat/filter/Selector.vue+++ b/app/components/stat/filter/Selector.vue@@ -9,6 +9,10 @@ const props = defineProps<{const filter = inject(filterKey)!const { t } = useI18n()++const { width } = useWindowSize()+const { pointerType } = usePointer()+const isLaptop = computed(() => width.value >= 766 && pointerType.value === 'mouse')</script><template>@@ -21,6 +25,7 @@ const { t } = useI18n()icon="hugeicons:wallet-01"><WalletsSelector+ :filterAtTop="isLaptop":selectedIds="filter?.walletsIds.value"class="min-w-80 px-3"@selected="filter.toggleWalletId"@@ -29,7 +34,6 @@ const { t } = useI18n()<StatFilterSelectorItemv-if="props.isShowCategories"- :buttonLabel="t('base.close')":hasSelection="filter?.categoriesIds.value.length > 0":labelMode="props.labelMode":title="t('categories.filter')"diff --git a/app/components/stat/filter/SelectorItem.vue b/app/components/stat/filter/SelectorItem.vueindex 6eb1a3e5..8423dff0 100644--- a/app/components/stat/filter/SelectorItem.vue+++ b/app/components/stat/filter/SelectorItem.vue@@ -1,6 +1,5 @@<script setup lang="ts">const props = defineProps<{- buttonLabel?: stringhasSelection: booleanicon: stringlabelMode?: boolean@@ -50,8 +49,8 @@ const isOpen = ref(false)<slot :close="close" /><div class="px-3 py-2">- <UiButtonAccent @click="close">- {{ props.buttonLabel ?? t('base.apply') }}+ <UiButtonAccent class="rounded-full" @click="close">+ {{ t('base.apply') }}</UiButtonAccent></div></div>diff --git a/app/components/ui/Element.vue b/app/components/ui/Element.vueindex f5e2d3f8..887a6595 100644--- a/app/components/ui/Element.vue+++ b/app/components/ui/Element.vue@@ -14,9 +14,9 @@ const NuxtLink = resolveComponent('NuxtLink')const slots = useSlots()const elementClasses = computed(() => cn(- 'interactive uiElement flex grow items-center gap-3 overflow-hidden rounded-sm px-2 py-1.5 min-h-[42px] -my-[1px]',+ 'interactive uiElement flex grow border border-transparent items-center gap-3 overflow-hidden rounded-sm px-2 py-1.5 min-h-[42px] -my-[1px]',props.insideClasses,- { 'relative z-10': props.isActive },+ { 'relative z-10 bg-elevated/30 border-primary/30': props.isActive },))</script>diff --git a/app/components/ui/Header.vue b/app/components/ui/Header.vueindex 0f25e4dd..e48b01aa 100644--- a/app/components/ui/Header.vue+++ b/app/components/ui/Header.vue@@ -26,7 +26,7 @@ function onBack() {v-if="backTo"type="button":aria-label="$t('base.previous')"- class="interactive text-muted flex min-h-[42px] min-w-[42px] shrink-0 cursor-default items-center justify-center rounded-sm text-xl"+ class="interactive text-muted flex min-h-[42px] min-w-[42px] shrink-0 cursor-default items-center justify-center rounded-full text-xl"@click="onBack"><Icon name="lucide:arrow-left" size="20" />diff --git a/app/components/wallets/Selector.vue b/app/components/wallets/Selector.vueindex 0b79af18..e9120c27 100644--- a/app/components/wallets/Selector.vue+++ b/app/components/wallets/Selector.vue@@ -45,7 +45,7 @@ function onClickWallet(walletId: WalletId) {class="scrollerBlock h-full overflow-y-auto py-px":class="{'pb-16': !props.filterAtTop && walletsStore.currenciesUsed.length > 1,- 'pt-16': props.filterAtTop && walletsStore.currenciesUsed.length > 1,+ 'pt-12': props.filterAtTop && walletsStore.currenciesUsed.length > 1,}"><WalletsItem@@ -72,7 +72,7 @@ function onClickWallet(walletId: WalletId) {/><divclass="pointer-events-none absolute left-0 z-20 w-full px-2"- :class="props.filterAtTop ? 'top-2' : 'bottom-2'"+ :class="props.filterAtTop ? 'top-0' : 'bottom-2'"><div class="border-default/80 bg-default/20 pointer-events-auto rounded-2xl border p-1 shadow-lg backdrop-blur-xl dark:bg-neutral-800/50"><WalletsCurrenciesdiff --git a/app/components/wallets/page/New.vue b/app/components/wallets/page/New.vueindex 51d73e57..160bc8e4 100644--- a/app/components/wallets/page/New.vue+++ b/app/components/wallets/page/New.vue@@ -28,7 +28,11 @@ useHead({{{ t('wallets.createNewTitle') }}</h1>- <UiHeader v-else hideSearch>+ <UiHeader+ v-else+ hideSearch+ backTo="wallets"+ ><UiHeaderTitle>{{ t('wallets.createNewTitle') }}</UiHeaderTitle>diff --git a/i18n/locales/en-US.js b/i18n/locales/en-US.jsindex 2b19820c..f0cdaed1 100644--- a/i18n/locales/en-US.js+++ b/i18n/locales/en-US.js@@ -69,7 +69,6 @@ export default {childColor: 'Apply color to all child categories',children: {confirmRemove: 'Remove {count} categories from this parent? They will become root categories.',- currentlyIn: 'Currently in: {parent}',empty: 'No children',group: {current: 'Current children',@@ -79,7 +78,7 @@ export default {label: 'Child categories',noCandidates: 'No categories available',noMatches: 'No matches',- searchPlaceholder: 'Search categories...',+ searchPlaceholder: 'Search...',selected: '{count} selected',},delete: {diff --git a/i18n/locales/ru-RU.js b/i18n/locales/ru-RU.jsindex 1df38115..c9fa5c75 100644--- a/i18n/locales/ru-RU.js+++ b/i18n/locales/ru-RU.js@@ -69,7 +69,6 @@ export default {childColor: 'Применить цвет ко всем дочерним категориям',children: {confirmRemove: 'Отсоединить выбранные категории ({count}) от родителя? Они станут корневыми.',- currentlyIn: 'Сейчас в: {parent}',empty: 'Нет детей',group: {current: 'Текущие дети',@@ -79,7 +78,7 @@ export default {label: 'Дочерние категории',noCandidates: 'Нет доступных категорий',noMatches: 'Ничего не найдено',- searchPlaceholder: 'Поиск категорий...',+ searchPlaceholder: 'Поиск...',selected: 'Выбрано: {count}',},delete: {