Skip to content

Open source personal finance application

refactor: improve class order and structure in various components for better readability

Ilya Komichevc5211b916fba
diff --git a/app/assets/css/main.css b/app/assets/css/main.css
index 74ac7015..4b82125c 100644
--- a/app/assets/css/main.css
+++ b/app/assets/css/main.css
@@ -13,7 +13,7 @@
@layer base {
html,
body {
- @apply antialiased text-default bg-default select-none;
+ @apply antialiased text-default bg-default select-none overflow-hidden;
overscroll-behavior-y: none;
}
}
diff --git a/app/components/layout/Sidebar.vue b/app/components/layout/Sidebar.vue
index b8c5b74a..947e8866 100644
--- a/app/components/layout/Sidebar.vue
+++ b/app/components/layout/Sidebar.vue
@@ -53,7 +53,7 @@ const isShowLogoMenu = ref(false)
<template #trigger>
<div
:class="getStyles('item', ['link', 'rounded'])"
- class="block cursor-default px-3 py-2 group-data-[state='open']:!bg-item-4"
+ class="group-data-[state='open']:!bg-item-4 block cursor-default px-3 py-2"
>
<UiLogo />
</div>
@@ -85,7 +85,7 @@ const isShowLogoMenu = ref(false)
<LayoutSidebarMenu class="px-2 pb-2" />
<div class="px-2 pb-6">
- <UiTitle3 class="pb-2 pl-3 !text-4">
+ <UiTitle3 class="!text-4 pb-2 pl-3">
{{ t('wallets.title') }}
</UiTitle3>
@@ -128,7 +128,7 @@ const isShowLogoMenu = ref(false)
:kbds="['Meta', '\\']"
>
<UiItem1
- class="z-10 text-4"
+ class="text-4 z-10"
@click="emit('toggleSidebar')"
>
<Icon :name="props.isShowSidebar ? 'lucide:panel-left-close' : 'lucide:panel-left'" size="18" />
diff --git a/app/components/stat/Dashboard.vue b/app/components/stat/Dashboard.vue
index 63c90c60..f64d602b 100644
--- a/app/components/stat/Dashboard.vue
+++ b/app/components/stat/Dashboard.vue
@@ -63,10 +63,6 @@ onDeactivated(() => {
<template>
<UiPage>
<StatHeader
- :menu="{
- active: activeTab,
- click: id => activeTab = id,
- }"
:filter="{
isShowCategories: true,
isShowWallets: true,
@@ -78,6 +74,13 @@ onDeactivated(() => {
<template #title>
<UiHeaderTitle>{{ t('stat.title') }}</UiHeaderTitle>
</template>
+
+ <template #selected>
+ <StatMenu
+ :active="activeTab"
+ @click="(id: StatTabSlug) => activeTab = id"
+ />
+ </template>
</StatHeader>
<StatWrap
diff --git a/app/components/stat/Item.vue b/app/components/stat/Item.vue
index 654ff557..1e229191 100644
--- a/app/components/stat/Item.vue
+++ b/app/components/stat/Item.vue
@@ -112,13 +112,6 @@ function onSetCategoryFilter(categoryId: CategoryId) {
if (filteredCategoriesIds.value.includes(categoryId))
return filteredCategoriesIds.value = []
- // if (filteredCategoriesIds.value.includes(categoryId)) {
- // return filteredCategoriesIds.value = [...filteredCategoriesIds.value.filter(id => id !== categoryId)]
- // }
-
- // if (filteredCategoriesIds.value.includes(categoryId))
- // return
-
filteredCategoriesIds.value = [categoryId]
}
@@ -148,7 +141,6 @@ const averageTotal = computed(() => {
const items = {
month: 0,
-
week: 0,
// eslint-disable-next-line perfectionist/sort-objects
day: 0,
@@ -283,7 +275,7 @@ function getIntervalsData(trnsIds: TrnId[], intervalsInRange: Range[]) {
@clickAverage="statConfig.updateConfig('statAverage', { isShow: !statConfig.config.value.statAverage.isShow })"
/>
- <div class="grid items-start gap-4 content-start min-h-dvh">
+ <div class="_min-h-dvh grid content-start items-start gap-4">
<StatCategoriesSection
v-if="statConfig.config.value.catsRound.isShow && (props.hasChildren || (props.preCategoriesIds ?? []).length > 0)"
:isOneCategory="props.isOneCategory"
@@ -296,7 +288,7 @@ function getIntervalsData(trnsIds: TrnId[], intervalsInRange: Range[]) {
<div
:class="{
- 'grid @3xl/page:grid-cols-2 @3xl/page:gap-6 gap-5': props.statTab !== 'split' && statConfig.config.value.catsList.isShow,
+ 'grid gap-5 @3xl/page:grid-cols-2 @3xl/page:gap-6': props.statTab !== 'split' && statConfig.config.value.catsList.isShow,
}"
>
<StatCategoriesSection2
diff --git a/app/components/stat/Wrap.vue b/app/components/stat/Wrap.vue
index a80aa718..29cec34f 100644
--- a/app/components/stat/Wrap.vue
+++ b/app/components/stat/Wrap.vue
@@ -47,7 +47,7 @@ const incomeTrnsIds = computed(() => trnsStore.getStoreTrnsIds({
<!-- Split -->
<div
v-if="props.activeTab === 'split'"
- class="@3xl/page:gap-8 @3xl/page:grid-cols-2 grid max-w-7xl gap-8 px-2 pb-24 lg:px-4 xl:py-2 2xl:px-8"
+ class="grid max-w-7xl gap-8 px-2 pb-24 lg:px-4 xl:py-2 2xl:px-8 @3xl/page:grid-cols-2 @3xl/page:gap-8"
>
<StatItem
:statTab="props.activeTab"
diff --git a/app/components/trnForm/Main.vue b/app/components/trnForm/Main.vue
index b92b1edd..6968459b 100644
--- a/app/components/trnForm/Main.vue
+++ b/app/components/trnForm/Main.vue
@@ -105,7 +105,7 @@ const actions = computed(() => ({
>
<TrnsItem
:trnItem="trnsStore.computeTrnItem(trnsFormStore.values.trnId)"
- class="group rounded-lg bg-item-3"
+ class="group bg-item-3 rounded-lg"
@click="trnsFormStore.values.trnId = null"
/>
@@ -113,7 +113,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-(--ui-primary) bg-[var(--item-1)] p-3 text-1">
+ <div class="text-1 z-10 grid h-full content-center gap-4 rounded-lg border border-(--ui-primary) bg-[var(--item-1)] p-3">
{{ t('base.sure') }}
<div class="flex gap-2">
@@ -131,7 +131,7 @@ const actions = computed(() => ({
/>
</template>
- <div class="leading-none text-muted">
+ <div class="text-muted leading-none">
{{ item.label }}
</div>
</UiElement>
@@ -154,7 +154,7 @@ const actions = computed(() => ({
/>
</template>
- <div class="leading-none text-muted">
+ <div class="text-muted leading-none">
{{ t(item.label) }}
</div>
</UiItem1>
diff --git a/app/components/trnForm/SelectorCategory.vue b/app/components/trnForm/SelectorCategory.vue
index f67bcc40..513fe905 100644
--- a/app/components/trnForm/SelectorCategory.vue
+++ b/app/components/trnForm/SelectorCategory.vue
@@ -40,7 +40,7 @@ const isShow = ref(false)
<CategoriesCommandPalette
:hide="close"
:activeItemId="props.categoryId"
- class="min-w-72 -mt-2 bottomSheetContentInside"
+ class="bottomSheetContentInside -mt-2 min-w-72"
@onSelected="(id: CategoryId) => { emit('onSelected', id); close() }"
/>
</template>
diff --git a/app/components/trnForm/Sidebar.vue b/app/components/trnForm/Sidebar.vue
index abb23d55..e74653b8 100644
--- a/app/components/trnForm/Sidebar.vue
+++ b/app/components/trnForm/Sidebar.vue
@@ -49,18 +49,18 @@ watch(isShow, (v) => {
<Transition name="fadeIn" appear>
<div
v-if="isShow"
- class="@container/trnForm trnForm absolute inset-y-0 z-50 right-0 h-full w-[360px] py-2"
+ class="trnForm @container/trnForm absolute inset-y-0 right-0 z-50 h-full w-[360px] py-2"
>
- <div class="border-left relative h-full overflow-hidden rounded-l-xl border-item-6 border border-r-0 border-item-4 bg-item-2 shadow-2xl">
- <div class="absolute right-2 top-2">
+ <div class="border-left border-item-6 border-item-4 bg-item-2 relative h-full overflow-hidden rounded-l-xl border border-r-0 shadow-2xl">
+ <div class="absolute top-2 right-2">
<BottomSheetClose @onClick="trnsFormStore.onClose()" />
</div>
<div ref="sliderRef" class="swiper-container h-full">
<div class="swiper-wrapper">
<!-- Main -->
- <div class="swiper-slide h-full bg-default">
- <div class="scrollerBlock grid h-full grid-rows-[auto_1fr] gap-4 overflow-y-auto items-start">
+ <div class="swiper-slide bg-default h-full">
+ <div class="scrollerBlock grid h-full grid-rows-[auto_1fr] items-start gap-4 overflow-y-auto">
<TrnFormMain
maxHeight="100vh"
class="!pb-0"
@@ -68,7 +68,7 @@ watch(isShow, (v) => {
/>
<div
v-if="trnsFormStore.values.trnType !== 2"
- class="-mt-6 grid gap-2"
+ class="-mt-6 grid gap-2 pb-6"
>
<TrnFormSelectionCategoriesFast
@onSelectCategory="id => trnsFormStore.values.categoryId = id"
@@ -83,7 +83,7 @@ watch(isShow, (v) => {
:style="{ height: '100%' }"
>
<div class="scrollerBlock h-full overflow-y-auto">
- <UiTitle3 class="sticky top-0 z-10 bg-default px-4 pb-3 pt-5 md:text-xl">
+ <UiTitle3 class="bg-default sticky top-0 z-10 px-4 pt-5 pb-3 md:text-xl">
{{ t('trns.history') }}
</UiTitle3>
diff --git a/app/components/trnForm/main/ActionSide.vue b/app/components/trnForm/main/ActionSide.vue
index 126cf3dc..ea59d2a6 100644
--- a/app/components/trnForm/main/ActionSide.vue
+++ b/app/components/trnForm/main/ActionSide.vue
@@ -30,10 +30,10 @@ async function onClickSubmit() {
<template>
<div
:class="{
- '!hover:bg-(--ui-primary) !bg-(--ui-primary)/60 text-icon-primary': !isMath && isSubmittable,
+ '!hover:bg-(--ui-primary) text-icon-primary !bg-(--ui-primary)/60': !isMath && isSubmittable,
'text-muted': !isSubmittable || isMath,
}"
- class="flex size-full items-center justify-center rounded-[var(--ui-radius)] bg-item-4 p-1 py-4 text-center text-4xl text-1 transition hover:scale-[1.02] hover:bg-[var(--item-5)]"
+ class="bg-item-4 text-1 flex size-full items-center justify-center rounded-[var(--ui-radius)] p-1 py-4 text-center transition hover:scale-[1.02] hover:bg-[var(--item-5)]"
@click="onClickSubmit"
>
<Icon :name="isMath ? 'lucide:equal' : 'lucide:check'" size="40" />
diff --git a/app/components/trnForm/main/Input.vue b/app/components/trnForm/main/Input.vue
index ad3e6f90..2b4707f6 100644
--- a/app/components/trnForm/main/Input.vue
+++ b/app/components/trnForm/main/Input.vue
@@ -23,7 +23,7 @@ const { t } = useI18n()
'left-3': isTransfer,
'left-1/2 -translate-x-1/2': !isTransfer,
}]"
- class="pointer-events-none absolute top-2 text-center text-sm text-1/60"
+ class="text-1/60 pointer-events-none absolute top-2 text-center text-sm"
tabindex="0"
>
{{ amount }}
@@ -37,7 +37,7 @@ const { t } = useI18n()
}"
:placeholder="t('enterAmount')"
:value="amountRaw"
- class="swiper-no-swiping border-transparent bg-item-2 pb-2 pt-6 text-center font-secondary !text-3xl placeholder:text-3xl"
+ class="swiper-no-swiping bg-item-2 font-secondary border-transparent pt-6 pb-2 text-center !text-3xl placeholder:text-3xl"
inputmode="tel"
@updateValue="(value: string) => emit('onChange', value || '')"
/>
diff --git a/app/layouts/default.vue b/app/layouts/default.vue
index 2c3e39c4..941f06f6 100644
--- a/app/layouts/default.vue
+++ b/app/layouts/default.vue
@@ -64,8 +64,8 @@ usePageScroll()
<template>
<div
- :class="{ 'md:pr-[360px]': trnsFormStore.ui.isShow && isShowSidebar && width >= 767 }"
- class="h-dvh overflow-hidden transition-all duration-300 ease-in-out bg-[var(--item-1)]"
+ :class="{ 'md:pr-[360px]': trnsFormStore.ui.isShow && width >= 767 }"
+ class="h-dvh bg-[var(--item-1)] transition-all duration-300 ease-in-out"
style="margin-left: env(safe-area-inset-left)"
>
<div v-if="status === 'error'">
@@ -84,12 +84,12 @@ usePageScroll()
/>
<div
- class="grid h-full overflow-hidden md:p-4 sm:pl-12 md:pl-12"
+ class="grid h-full overflow-hidden sm:pl-12 md:p-4 md:pl-12"
:class="{
'sm:pl-74 md:pl-74': isShowSidebar && width >= 767,
}"
>
- <div class="relative h-full overflow-hidden sm:rounded-md lg:rounded-2xl bg-default sm:border sm:border-item-4 max-w-5xl">
+ <div class="bg-default sm:border-item-4 relative h-full max-w-5xl overflow-hidden sm:rounded-md sm:border lg:rounded-2xl">
<main
id="pageScroll"
style="padding-bottom: calc(50px + env(safe-area-inset-bottom))"
diff --git a/app/pages/login.vue b/app/pages/login.vue
index 5539ff97..b7e4c550 100644
--- a/app/pages/login.vue
+++ b/app/pages/login.vue
@@ -60,7 +60,7 @@ async function openDemo() {
</script>
<template>
- <div class="h-dvh mx-auto grid size-full max-w-xl grid-rows-[auto_1fr_auto] px-2 py-3">
+ <div class="mx-auto grid size-full h-dvh max-w-xl grid-rows-[auto_1fr_auto] px-2 py-3">
<div class="flex items-center justify-end gap-3">
<LocaleSwitcher />
<ThemeSwitcher />
@@ -85,7 +85,7 @@ async function openDemo() {
>
<div class="flex flex-col items-center justify-center pb-10">
<UiLogo class="pb-0 !text-6xl !font-extrabold" />
- <div class="pt-1 text-sm text-muted">
+ <div class="text-muted pt-1 text-sm">
{{ t('description') }}
</div>
@@ -96,12 +96,12 @@ async function openDemo() {
size="xl"
@click="signInWithGoogle"
>
- {{ t("loginWithGoogle") }}
+ {{ t('loginWithGoogle') }}
</UiButtonAccent>
<USeparator
- label="or"
- class="pt-3 px-3"
+ :label="t('ore')"
+ class="!text-muted px-3 pt-3"
/>
<UiButtonAccent
@@ -110,7 +110,7 @@ async function openDemo() {
variant="ghost"
@click="openDemo"
>
- {{ t("openDemo") }}
+ {{ t('openDemo') }}
</UiButtonAccent>
</div>
</div>
@@ -126,10 +126,12 @@ async function openDemo() {
en:
title: "Login"
openDemo: "Open Demo"
+ or: "or"
description: Powerful open-source finance application
ru:
title: "Вход"
openDemo: "Открыть демо"
+ or: "или"
description: Персональный финансовый ассистент
</i18n>