Open source personal finance application
feat: improve mobile header and navigation UX
Ilya Komichev25ad84dbb433
diff --git a/app/components/categories/Header.vue b/app/components/categories/Header.vueindex e8a2fdac..26f9426c 100644--- a/app/components/categories/Header.vue+++ b/app/components/categories/Header.vue@@ -9,36 +9,21 @@ const props = defineProps<{<template><UiHeaderTitle>- <div class="-mx-3 flex items-center">- <div- class="flex items-center gap-2 rounded-lg px-3 py-1"- >- <Icon- :name="props.category.icon"- :style="{ color: props.category.color }"- class="mt-[-2px] size-5"- />-- <div class="text-lg font-semibold @lg:text-xl">- {{ props.category.name }}- </div>- </div>-- <div- v-if="props.parentCategory"- class="text-2 flex items-center pt-[3px] text-xs leading-none font-medium @lg:text-base"- >- <div class="text-2xs text-4">- •- </div>-+ <div class="flex min-w-0 items-center">+ <template v-if="props.parentCategory"><NuxtLink:to="`/categories/${props.category.parentId}`"- class="flex items-center gap-2 rounded-lg px-3 py-1 text-inherit no-underline hover:bg-(--item-5)"+ class="text-muted truncate text-lg font-medium no-underline hover:text-(--ui-text-highlighted) @lg:text-xl">{{ props.parentCategory.name }}</NuxtLink>- </div>++ <span class="text-4 mx-1 text-lg @lg:text-xl">/</span>+ </template>++ <span class="truncate">+ {{ props.category.name }}+ </span></div></UiHeaderTitle></template>diff --git a/app/components/layout/MenuBottomModal.vue b/app/components/layout/MenuBottomModal.vueindex 60fd324b..37a9c5c6 100644--- a/app/components/layout/MenuBottomModal.vue+++ b/app/components/layout/MenuBottomModal.vue@@ -1,11 +1,19 @@<script setup lang="ts">import { useDemo } from '~/components/demo/useDemo'+import { isSearchOpen } from '~/components/search/useSearch'import { useUserStore } from '~/components/user/useUserStore'const emit = defineEmits<{ close: [] }>()const { t } = useI18n()const userStore = useUserStore()const { isDemo } = useDemo()++function onSearchClick() {+ emit('close')+ nextTick(() => {+ isSearchOpen.value = true+ })+}</script><template>@@ -29,7 +37,21 @@ const { isDemo } = useDemo()<UserViewLogout /></div>- <LayoutSidebarMenu class="py-4" source="itemsModal" />+ <div class="py-4">+ <div+ class="interactive text-muted flex min-h-[44px] items-center gap-3 rounded-sm px-2 py-1.5 md:min-h-[38px]"+ @click="onSearchClick"+ >+ <div class="flex min-w-8 items-center justify-center">+ <Icon name="lucide:search" size="22" class="leading-none" />+ </div>+ <div class="text-sm font-medium">+ {{ t('search.title') }}+ </div>+ </div>++ <LayoutSidebarMenu source="itemsModal" />+ </div><divv-if="isDemo"diff --git a/app/components/stat/ConfigModal.vue b/app/components/stat/ConfigModal.vueindex 04f2d19c..fe8a51f1 100644--- a/app/components/stat/ConfigModal.vue+++ b/app/components/stat/ConfigModal.vue@@ -6,6 +6,8 @@ import { useWalletsStore } from '~/components/wallets/useWalletsStore'const props = defineProps<{isShowWallets?: boolean+ labelMode?: boolean+ onBeforeOpen?: () => void}>()const statConfig = inject(statConfigKey)!@@ -21,11 +23,21 @@ const isOpen = ref(false):title="t('stat.config.menu.label')":isOpenisShowCloseBtn- @openModal="isOpen = true"+ @openModal="() => { props.onBeforeOpen?.(); isOpen = true }"@closeModal="isOpen = false"><template #trigger>- <UTooltip :text="t('stat.config.menu.label')">+ <UiHeaderLink+ v-if="props.labelMode"+ icon="lucide:settings-2"+ >+ {{ t('stat.config.menu.label') }}+ </UiHeaderLink>++ <UTooltip+ v-else+ :text="t('stat.config.menu.label')"+ ><UiActionButton :ariaLabel="t('stat.config.menu.label')"><Icon name="lucide:settings-2" size="20" /></UiActionButton>diff --git a/app/components/stat/Header.vue b/app/components/stat/Header.vueindex 86f342fa..d81868bb 100644--- a/app/components/stat/Header.vue+++ b/app/components/stat/Header.vue@@ -41,18 +41,19 @@ const isPopoverOpen = ref(false)<slot name="title" /><template #actions>- <StatFilterSelector- v-if="filterCategories || filterWallets"- :isShowCategories="!!filterCategories"- :isShowWallets="!!filterWallets"- />+ <div class="hidden items-center sm:flex">+ <StatFilterSelector+ v-if="filterCategories || filterWallets"+ :isShowCategories="!!filterCategories"+ :isShowWallets="!!filterWallets"+ />- <StatConfigModal- :isShowWallets="!!configWallets"- />+ <StatConfigModal+ :isShowWallets="!!configWallets"+ />+ </div><BottomSheetOrDropdown- v-if="$slots.popover":isOpen="isPopoverOpen"isShowCloseBtn@openModal="isPopoverOpen = true"@@ -66,6 +67,23 @@ const isPopoverOpen = ref(false)<template #content="{ close: closeContent }"><div class="min-w-52 p-1 pt-4 pb-3">+ <!-- Mobile: search, filters, config -->+ <div class="mb-2 grid border-b border-(--ui-border) pb-3 sm:hidden">+ <StatFilterSelector+ v-if="filterCategories || filterWallets"+ :isShowCategories="!!filterCategories"+ :isShowWallets="!!filterWallets"+ :onBeforeOpen="() => { closeContent?.(); isPopoverOpen = false }"+ labelMode+ />++ <StatConfigModal+ :isShowWallets="!!configWallets"+ :onBeforeOpen="() => { closeContent?.(); isPopoverOpen = false }"+ labelMode+ />+ </div>+<slotname="popover":close="() => { closeContent?.(); isPopoverOpen = false }"diff --git a/app/components/stat/date/Navigation.vue b/app/components/stat/date/Navigation.vueindex acbea17c..caf682ac 100644--- a/app/components/stat/date/Navigation.vue+++ b/app/components/stat/date/Navigation.vue@@ -50,7 +50,7 @@ function changeDate(way: 'next' | 'prev' | 'today') {</script><template>- <div class="items-top bg-default/90 sticky top-0 z-20 -my-2 flex grow items-center gap-2 overflow-x-auto py-2 backdrop-blur lg:top-[87px]">+ <div class="items-top bg-default/90 sticky top-0 z-20 -mt-2 mr-12 flex grow items-center gap-2 overflow-x-auto py-2 pb-0 backdrop-blur sm:mr-0 lg:top-[87px]"><DateNavv-if="isShowNav && !statDate.params.value.customDate":isEnddiff --git a/app/components/stat/filter/Selector.vue b/app/components/stat/filter/Selector.vueindex e09a9a3a..c105e0b0 100644--- a/app/components/stat/filter/Selector.vue+++ b/app/components/stat/filter/Selector.vue@@ -4,6 +4,8 @@ import { filterKey } from '~/components/stat/injectionKeys'const props = defineProps<{isShowCategories?: booleanisShowWallets?: boolean+ labelMode?: boolean+ onBeforeOpen?: () => void}>()const filter = inject(filterKey)!@@ -11,10 +13,12 @@ const { t } = useI18n()</script><template>- <div>+ <div class="flex items-center"><StatFilterSelectorItemv-if="props.isShowWallets":hasSelection="filter?.walletsIds.value.length > 0"+ :labelMode="props.labelMode"+ :onBeforeOpen="props.onBeforeOpen":title="t('wallets.filter')"icon="hugeicons:wallet-01">@@ -29,6 +33,8 @@ const { t } = useI18n()v-if="props.isShowCategories":buttonLabel="t('base.close')":hasSelection="filter?.categoriesIds.value.length > 0"+ :labelMode="props.labelMode"+ :onBeforeOpen="props.onBeforeOpen":title="t('categories.filter')"icon="hugeicons:folder-library">diff --git a/app/components/stat/filter/SelectorItem.vue b/app/components/stat/filter/SelectorItem.vueindex 628d48cc..a790929a 100644--- a/app/components/stat/filter/SelectorItem.vue+++ b/app/components/stat/filter/SelectorItem.vue@@ -3,6 +3,8 @@ const props = defineProps<{buttonLabel?: stringhasSelection: booleanicon: string+ labelMode?: boolean+ onBeforeOpen?: () => voidtitle: string}>()@@ -16,11 +18,21 @@ const isOpen = ref(false):title="props.title":isOpen="isOpen"isShowCloseBtn- @openModal="isOpen = true"+ @openModal="() => { props.onBeforeOpen?.(); isOpen = true }"@closeModal="isOpen = false"><template #trigger>- <UTooltip :text="props.title">+ <UiHeaderLink+ v-if="props.labelMode"+ :icon="props.icon"+ >+ {{ props.title }}+ </UiHeaderLink>++ <UTooltip+ v-else+ :text="props.title"+ ><UChip:show="props.hasSelection"color="secondary"diff --git a/app/components/ui/Header.vue b/app/components/ui/Header.vueindex f9502163..537d2c7b 100644--- a/app/components/ui/Header.vue+++ b/app/components/ui/Header.vue@@ -11,7 +11,7 @@ const { isSearchOpen } = useSearch()<template><div class="bg-default/90 sticky top-0 z-20 mb-2 backdrop-blur"><div class="border-item-4 grid min-h-12 max-w-7xl items-center border-b px-2 py-2 lg:px-4 lg:py-4">- <div class="flex grow items-center gap-2">+ <div class="flex grow items-center"><NuxtLinkv-if="backTo":to="backTo"@@ -24,10 +24,11 @@ const { isSearchOpen } = useSearch()<slot /></div>- <div class="ml-auto flex shrink-0 items-center gap-1">+ <div class="ml-auto flex shrink-0 flex-nowrap items-center gap-1 pl-2"><UTooltip:text="$t('search.title')":kbds="['meta', 'K']"+ class="hidden sm:block"><UiActionButton:ariaLabel="$t('search.title')"diff --git a/app/components/ui/HeaderLink.vue b/app/components/ui/HeaderLink.vueindex 63a830f9..3f3a6b69 100644--- a/app/components/ui/HeaderLink.vue+++ b/app/components/ui/HeaderLink.vue@@ -9,21 +9,21 @@ const emit = defineEmits<{</script><template>- <UiElement- class="group/item"- :lineWidth="4"- insideClasses="min-h-[44px] pr-3"+ <div+ class="interactive flex min-h-[44px] items-center gap-3 rounded-sm px-2 py-1.5 text-sm font-medium"@click="e => emit('click', e)">- <template #leftIcon>+ <div+ v-if="props.icon"+ class="flex min-w-8 items-center justify-center"+ ><Icon- v-if="props.icon":name="props.icon"- size="20"+ size="22"class="text-muted"/>- </template>+ </div><slot />- </UiElement>+ </div></template>diff --git a/app/components/ui/HeaderTitle.vue b/app/components/ui/HeaderTitle.vueindex 295b9cf6..b6b076b9 100644--- a/app/components/ui/HeaderTitle.vue+++ b/app/components/ui/HeaderTitle.vue@@ -1,7 +1,7 @@<template><divclass="- font-tertiary flex grow items-center gap-2 overflow-x-auto px-1 pl-2 text-lg leading-none font-semibold tracking-wide+ font-tertiary flex grow items-center gap-2 overflow-x-auto px-1 text-lg leading-none font-semibold tracking-widetext-(--ui-text-highlighted) @lg:text-xl">diff --git a/app/components/wallets/page/id/Index.vue b/app/components/wallets/page/id/Index.vueindex ac5f669c..265bf2ff 100644--- a/app/components/wallets/page/id/Index.vue+++ b/app/components/wallets/page/id/Index.vue@@ -118,11 +118,6 @@ async function onDeleteConfirm() {><template #title><UiHeaderTitle>- <WalletsIcon- :color="wallet.color"- :name="wallet.name"- class="mt-[-2px] mr-1"- />{{ wallet.name }}</UiHeaderTitle></template>