Skip to content

Open source personal finance application

refactor: reorder class attributes for improved readability and consistency

Ilya Komichev2f50b8732cb1
diff --git a/app/assets/css/main.css b/app/assets/css/main.css
index 4b82125c..82ecc259 100644
--- a/app/assets/css/main.css
+++ b/app/assets/css/main.css
@@ -1,4 +1,4 @@
-@import "tailwindcss" theme(static);
+@import 'tailwindcss' theme(static);
@import '@nuxt/ui';
@import './theme.css';
@import './utility.css';
@@ -6,8 +6,15 @@
@custom-variant dark (&:where(.dark, .dark *));
@custom-variant hover {
- @media (hover: hover) and (pointer: fine) { &:hover { @slot; } }
- &:active { @slot; }
+ @media (hover: hover) and (pointer: fine) {
+ &:hover {
+ @slot;
+ }
+ }
+
+ &:active {
+ @slot;
+ }
}
@layer base {
diff --git a/app/components/amount/Amount.vue b/app/components/amount/Amount.vue
index 7ce16a80..c2190383 100644
--- a/app/components/amount/Amount.vue
+++ b/app/components/amount/Amount.vue
@@ -45,7 +45,7 @@ const { baseCurrencyCode, getAmountInBaseRate } = useAmount()
'text-xl': props.variant === 'xl',
'text-base': props.variant === 'base',
}"
- class="grid gap-1 font-secondary leading-none"
+ class="font-secondary grid gap-1 leading-none"
@click="(e: Event) => emit('click', e)"
>
<AmountItem
diff --git a/app/components/amount/AmountItem.vue b/app/components/amount/AmountItem.vue
index 10037a21..bb09efb6 100644
--- a/app/components/amount/AmountItem.vue
+++ b/app/components/amount/AmountItem.vue
@@ -11,7 +11,7 @@ const props = defineProps<{
<template>
<div
- class="flex items-baseline gap-1 whitespace-nowrap leading-none"
+ class="flex items-baseline gap-1 leading-none whitespace-nowrap"
:class="{
'justify-center': props.align === 'center',
'justify-end': props.align === 'right',
diff --git a/app/components/bottomSheet/BottomSheet.vue b/app/components/bottomSheet/BottomSheet.vue
index 920afa90..2078ad95 100644
--- a/app/components/bottomSheet/BottomSheet.vue
+++ b/app/components/bottomSheet/BottomSheet.vue
@@ -446,7 +446,7 @@ const wrapClasses = computed(() => ({
<div
ref="containerRef"
:class="wrapClasses"
- class="absolute inset-0 z-50 size-full select-none overflow-hidden"
+ class="absolute inset-0 z-50 size-full overflow-hidden select-none"
>
<!-- Overlay -->
<div
diff --git a/app/components/bottomSheet/BottomSheetHandler.vue b/app/components/bottomSheet/BottomSheetHandler.vue
index cbaa298c..f7b22b9c 100644
--- a/app/components/bottomSheet/BottomSheetHandler.vue
+++ b/app/components/bottomSheet/BottomSheetHandler.vue
@@ -1,9 +1,9 @@
<template>
<div
class="
- handler flex-center after:bg-item-7 hover:bg-[var(--item-5)] absolute left-0 top-0
- z-30 h-[16px] w-full
- transition after:block after:h-[4px] after:w-[32px] after:rounded-sm after:content-['']
+ handler flex-center after:bg-item-7 absolute top-0 left-0 z-30
+ h-[16px] w-full transition
+ after:block after:h-[4px] after:w-[32px] after:rounded-sm after:content-[''] hover:bg-[var(--item-5)]
"
/>
</template>
diff --git a/app/components/categories/Selector.vue b/app/components/categories/Selector.vue
index 0ef4c686..078699f3 100644
--- a/app/components/categories/Selector.vue
+++ b/app/components/categories/Selector.vue
@@ -66,8 +66,8 @@ onMounted(() => {
:key="categoryId"
class="group/item"
:class="{
- 'relative mb-2 rounded-md bg-item-3': opened.includes(categoryId),
- 'rounded-md bg-item-3': isChildsSelected(categoryId),
+ 'bg-item-3 relative mb-2 rounded-md': opened.includes(categoryId),
+ 'bg-item-3 rounded-md': isChildsSelected(categoryId),
'border !border-(--ui-primary)/60': isEveryChildsSelected(categoryId),
}"
>
@@ -82,7 +82,7 @@ onMounted(() => {
<div
v-if="opened.includes(categoryId) && categoriesStore.hasChildren(categoryId)"
- class="pb-2 pl-4 pr-2"
+ class="pr-2 pb-2 pl-4"
>
<CategoriesItem
v-for="childCategoryId in categoriesStore.getChildsIds(categoryId)"
diff --git a/app/components/categories/Selector2.vue b/app/components/categories/Selector2.vue
index ce4f4211..0c740cb4 100644
--- a/app/components/categories/Selector2.vue
+++ b/app/components/categories/Selector2.vue
@@ -38,7 +38,7 @@ function onFilter(id: CategoryId) {
</script>
<template>
- <div class="grid pt-1 px-3 gap-1 3sm:grid-cols-2">
+ <div class="3sm:grid-cols-2 grid gap-1 px-3 pt-1">
<CategoriesItem
v-for="categoryId in props.ids"
:key="categoryId"
diff --git a/app/components/date/LinkItemNoBg.vue b/app/components/date/LinkItemNoBg.vue
index 07186044..376243a6 100644
--- a/app/components/date/LinkItemNoBg.vue
+++ b/app/components/date/LinkItemNoBg.vue
@@ -13,10 +13,10 @@ const emit = defineEmits<{
<div
:class="[
getStyles('item', ['center2', 'padding4', 'minh3']), {
- 'bg-[var(--item-5)] text-primary': props.isActive,
+ 'text-primary bg-[var(--item-5)]': props.isActive,
},
]"
- class="text-nowrap rounded-full text-xs leading-none text-(--ui-text)"
+ class="rounded-full text-xs leading-none text-nowrap text-(--ui-text)"
@click="(e: Event) => emit('click', e)"
>
<slot />
diff --git a/app/components/date/Trns.vue b/app/components/date/Trns.vue
index 0496fd29..9dc1065f 100644
--- a/app/components/date/Trns.vue
+++ b/app/components/date/Trns.vue
@@ -16,11 +16,11 @@ const formattedDate = computed(() => formatDate(props.date, 'full'))
</div>
<div class="text-2">
- <div class="pb-[2px] text-2xs leading-none">
+ <div class="text-2xs pb-[2px] leading-none">
{{ formattedDate.weekday }}
</div>
- <div class="flex gap-1 text-sm font-medium leading-none text-1">
+ <div class="text-1 flex gap-1 text-sm leading-none font-medium">
<div>{{ formattedDate.month }}</div>
<div>{{ formattedDate.year }}</div>
</div>
diff --git a/app/components/demo/data.ts b/app/components/demo/data.ts
index 0d696802..4615552c 100644
--- a/app/components/demo/data.ts
+++ b/app/components/demo/data.ts
@@ -1,10 +1,10 @@
import type { CategoryId, CategoryItem } from '~/components/categories/types'
import type { WalletId, WalletItem } from '~/components/wallets/types'
- type LocaleString = {
- en: string
- ru: string
- }
+type LocaleString = {
+ en: string
+ ru: string
+}
export const data: {
categories: Record<CategoryId, Omit<CategoryItem, 'name'> & { name: LocaleString }>
diff --git a/app/components/form/Switch.vue b/app/components/form/Switch.vue
index f112fa58..4d1dde96 100644
--- a/app/components/form/Switch.vue
+++ b/app/components/form/Switch.vue
@@ -17,11 +17,11 @@ const emit = defineEmits<{
<div
:class="{ 'bg-(--ui-primary)': value, 'bg-(--ui-bg-accented)': !value }"
- class="relative p-px px-[2px] w-10 h-5 rounded-xl transition-colors ease-in-out"
+ class="relative h-5 w-10 rounded-xl p-px px-[2px] transition-colors ease-in-out"
>
<div
:class="{ 'translate-x-4.5': value }"
- class="size-4.5 rounded-xl bg-default shadow-md transition-transform ease-in-out"
+ class="bg-default size-4.5 rounded-xl shadow-md transition-transform ease-in-out"
/>
</div>
</div>
diff --git a/app/components/form/Textarea.vue b/app/components/form/Textarea.vue
index 73b34798..a75a8ae8 100644
--- a/app/components/form/Textarea.vue
+++ b/app/components/form/Textarea.vue
@@ -17,7 +17,7 @@ const emit = defineEmits<{
:placeholder="props.placeholder"
:value="props.value"
:class="getStyles('item', ['link', 'rounded'])"
- class="m-0 w-full border border-solid border-item-6 bg-item-3 px-3 py-2 text-base font-normal placeholder:text-muted hover:border-(--ui-primary) hover:bg-[var(--item-5)] hover:text-1 hover:outline-none"
+ class="border-item-6 bg-item-3 placeholder:text-muted hover:text-1 m-0 w-full border border-solid px-3 py-2 text-base font-normal hover:border-(--ui-primary) hover:bg-[var(--item-5)] hover:outline-none"
@input="(event: HTMLInputEvent) => emit('updateValue', event.target.value)"
/>
</template>
diff --git a/app/components/layout/MenuBottom.vue b/app/components/layout/MenuBottom.vue
index b021130e..95c688b2 100644
--- a/app/components/layout/MenuBottom.vue
+++ b/app/components/layout/MenuBottom.vue
@@ -6,7 +6,7 @@ const { itemsBottom } = useMenuData()
<template>
<div
- class="sm:bottom-inherit sticky bottom-0 left-0 z-20 mx-auto flex w-full items-stretch bg-default/90 backdrop-blur sm:hidden lg:hidden"
+ class="sm:bottom-inherit bg-default/90 sticky bottom-0 left-0 z-20 mx-auto flex w-full items-stretch backdrop-blur sm:hidden lg:hidden"
style="padding-bottom: calc(env(safe-area-inset-bottom) - 16px)"
>
<LayoutSidebarMenuItem
diff --git a/app/components/layout/MenuBottomModal.vue b/app/components/layout/MenuBottomModal.vue
index ef4823d1..38c44381 100644
--- a/app/components/layout/MenuBottomModal.vue
+++ b/app/components/layout/MenuBottomModal.vue
@@ -22,7 +22,7 @@ const { isDemo } = useDemo()
</template>
<div class="bottomSheetContent">
- <div class="bottomSheetContentInside grid gap-3 px-3 pb-2 pt-4">
+ <div class="bottomSheetContentInside grid gap-3 px-3 pt-4 pb-2">
<!-- User -->
<div
v-if="!isDemo"
diff --git a/app/components/layout/SidebarMenuItem.vue b/app/components/layout/SidebarMenuItem.vue
index 4ccf6857..3f1bfa61 100644
--- a/app/components/layout/SidebarMenuItem.vue
+++ b/app/components/layout/SidebarMenuItem.vue
@@ -25,7 +25,7 @@ const { checkIsActive, onClick } = useMenuData()
'gap-3': props.isShowText,
},
]"
- class="group min-h-[44px] text-muted md:min-h-[38px]"
+ class="group text-muted min-h-[44px] md:min-h-[38px]"
@click="onClick(props.menuId)"
>
<div class="flex min-w-8 items-center justify-center">
diff --git a/app/components/stat/CategoriesButtons.vue b/app/components/stat/CategoriesButtons.vue
index c6531ce0..63f5e2b6 100644
--- a/app/components/stat/CategoriesButtons.vue
+++ b/app/components/stat/CategoriesButtons.vue
@@ -184,7 +184,7 @@ function onChangeViewOptions(newViewOptions: any) {
</div>
<div
- class="border-item-4 grid gap-3 border-b pb-2 pt-3 last:border-0"
+ class="border-item-4 grid gap-3 border-b pt-3 pb-2 last:border-0"
>
<UiTitleOption>{{ t('elements') }}</UiTitleOption>
<div class="">
diff --git a/app/components/stat/ConfigModal.vue b/app/components/stat/ConfigModal.vue
index 67ea7dfd..c9785cf8 100644
--- a/app/components/stat/ConfigModal.vue
+++ b/app/components/stat/ConfigModal.vue
@@ -56,7 +56,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>
@@ -132,7 +132,7 @@ function updateStatAverage(value: number) {
<!-- 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') }}
@@ -179,7 +179,7 @@ function updateStatAverage(value: number) {
<!-- Statistics -->
<div
- class="border-b border-item-3 pb-3"
+ class="border-item-3 border-b pb-3"
>
<UiTitleOption class="pb-2">
{{ t('statistics.title') }}
diff --git a/app/components/stat/categories/Line.vue b/app/components/stat/categories/Line.vue
index 86c19945..2873a4f3 100644
--- a/app/components/stat/categories/Line.vue
+++ b/app/components/stat/categories/Line.vue
@@ -92,7 +92,7 @@ onLongPress(
ref="longPressRef"
:class="[props.insideClass, {
'-bg-item-3 ': props.isActive,
- 'rounded-lg bg-item-2': statConfig.config.value.catsList.isItemsBg,
+ 'bg-item-2 rounded-lg': statConfig.config.value.catsList.isItemsBg,
}]"
:style="props.insideStyle"
class="relative"
@@ -107,9 +107,9 @@ onLongPress(
<template #line>
<div
v-if="statConfig.config.value.catsList.isLines"
- class="absolute bottom-2 left-0 w-full overflow-hidden rounded-lg pl-[52px] pr-3"
+ class="absolute bottom-2 left-0 w-full overflow-hidden rounded-lg pr-3 pl-[52px]"
>
- <div class="overflow-hidden rounded-lg bg-item-4">
+ <div class="bg-item-4 overflow-hidden rounded-lg">
<div
:style="getBarStyle()"
class="h-1 opacity-60"
diff --git a/app/components/stat/categories/Section2.vue b/app/components/stat/categories/Section2.vue
index 2319fffb..a20ac25b 100644
--- a/app/components/stat/categories/Section2.vue
+++ b/app/components/stat/categories/Section2.vue
@@ -113,7 +113,7 @@ function toggleRoot(id: CategoryId) {
<template>
<div
v-if="categoriesWithData.length > 0"
- class="@3xl/main:max-w-lg grid gap-3 content-start"
+ class="grid content-start gap-3 @3xl/main:max-w-lg"
>
<!-- Vertical -->
<UiToggle
@@ -147,7 +147,7 @@ function toggleRoot(id: CategoryId) {
v-if="isShown"
class="grid pt-3"
>
- <div class="flex overflow-hidden overflow-x-auto pl-1 pt-2">
+ <div class="flex overflow-hidden overflow-x-auto pt-2 pl-1">
<StatCategoriesVertical
v-for="item in verticalCategories.filter(c => c.value !== 0)"
:key="item.id"
@@ -243,7 +243,7 @@ function toggleRoot(id: CategoryId) {
<!-- Inside -->
<div
v-if="categoriesOpened[item.id]?.show && item.categories && item.categories?.length >= 1"
- class="ml-5 mt-[-2px] -translate-x-px pl-3 pb-3"
+ class="mt-[-2px] ml-5 -translate-x-px pb-3 pl-3"
>
<div
:class="{
diff --git a/app/components/stat/categories/SectionWithCollapse.vue b/app/components/stat/categories/SectionWithCollapse.vue
index f7cdff42..341af18a 100644
--- a/app/components/stat/categories/SectionWithCollapse.vue
+++ b/app/components/stat/categories/SectionWithCollapse.vue
@@ -51,7 +51,7 @@ const verticalBiggestCatNumber = computed(() => getBiggestCatNumber(verticalCate
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 roundCategories = computed<CategoryWithData[]>(() => categoriesStat.value[statConfig.config.value.catsRound.isGrouped ? 'grouped' : 'ungrouped'])
const biggestCatNumber = computed(() => getBiggestCatNumber(categoriesWithData.value))
function getBiggestCatNumber(categories: CategoryWithData[]) {
@@ -215,7 +215,7 @@ function updateState(state: CategoriesState, options: { childShow?: boolean, par
v-if="isShown"
class="grid pt-3"
>
- <div class="flex overflow-hidden overflow-x-auto pl-1 pt-2">
+ <div class="flex overflow-hidden overflow-x-auto pt-2 pl-1">
<StatCategoriesVertical
v-for="item in verticalCategories.filter(c => c.value !== 0)"
:key="item.id"
@@ -335,7 +335,7 @@ function updateState(state: CategoriesState, options: { childShow?: boolean, par
</template>
<!-- Inside -->
- <div class="ml-5 mt-[-2px] -translate-x-px pl-3">
+ <div class="mt-[-2px] ml-5 -translate-x-px pl-3">
<div
v-if="!item.categories || item.categories.length === 0"
class="mb-3 ml-11"
@@ -352,7 +352,7 @@ function updateState(state: CategoriesState, options: { childShow?: boolean, par
<div
v-if="item.categories && statConfig.config.value.catsList.isGrouped"
- class="flex flex-wrap gap-1 pl-12 pt-2"
+ class="flex flex-wrap gap-1 pt-2 pl-12"
>
<StatCategoriesRound
v-for="itemInside in item.categories"
@@ -405,7 +405,7 @@ function updateState(state: CategoriesState, options: { childShow?: boolean, par
</template>
<!-- Inside -->
- <div class="ml-5 mt-[-2px] -translate-x-px pl-14">
+ <div class="mt-[-2px] ml-5 -translate-x-px pl-14">
<TrnsList
:trnsIds="itemInside.trnsIds"
:size="5"
diff --git a/app/components/stat/chart/Wrap.vue b/app/components/stat/chart/Wrap.vue
index 7c32ec68..32e3d820 100644
--- a/app/components/stat/chart/Wrap.vue
+++ b/app/components/stat/chart/Wrap.vue
@@ -52,12 +52,12 @@ function onChangePeriod(period: Period) {
'@3xl/main:max-w-xl': props.chartView === 'half',
}"
>
- <div class="flex justify-end -mb-1">
+ <div class="-mb-1 flex justify-end">
<slot />
<div class="h-7">
<StatChartIntervals
- :class="{ 'border-l border-item-4': statConfig.config.value?.date.isShowQuick }"
+ :class="{ 'border-item-4 border-l': statConfig.config.value?.date.isShowQuick }"
:period="statDate.params.value.intervalsBy"
:range="statDate.range.value"
@onChangePeriod="onChangePeriod"
diff --git a/app/components/stat/date/useGetDateRange.test.ts b/app/components/stat/date/useGetDateRange.test.ts
index feaf584b..f2c32132 100644
--- a/app/components/stat/date/useGetDateRange.test.ts
+++ b/app/components/stat/date/useGetDateRange.test.ts
@@ -1,4 +1,4 @@
-import { addMonths, endOfDay, endOfMonth, endOfWeek, endOfYear, startOfDay, startOfMonth, startOfWeek, startOfYear, subDays, subMonths, subWeeks, subYears } from 'date-fns'
+import { addMonths, endOfDay, endOfMonth, endOfWeek, endOfYear, startOfDay, startOfMonth, startOfWeek, startOfYear } from 'date-fns'
import { describe, expect, it } from 'vitest'
import { useGetDateRange } from '~/components/stat/date/useGetDateRange'
diff --git a/app/components/theme/Picker.vue b/app/components/theme/Picker.vue
index deb11956..35cfd033 100644
--- a/app/components/theme/Picker.vue
+++ b/app/components/theme/Picker.vue
@@ -80,11 +80,11 @@ function setBlackAsPrimary(value: boolean) {
<template #content>
<fieldset>
- <legend class="text-[11px] leading-none font-semibold mb-2">
+ <legend class="mb-2 text-[11px] leading-none font-semibold">
{{ t('primary') }}
</legend>
- <div class="grid grid-cols-3 gap-1 -mx-2">
+ <div class="-mx-2 grid grid-cols-3 gap-1">
<ThemePickerButton
chip="primary"
label="Black"
@@ -92,7 +92,7 @@ function setBlackAsPrimary(value: boolean) {
@click="setBlackAsPrimary(true)"
>
<template #leading>
- <span class="inline-block w-2 h-2 rounded-full bg-black dark:bg-white" />
+ <span class="inline-block h-2 w-2 rounded-full bg-black dark:bg-white" />
</template>
</ThemePickerButton>
@@ -108,11 +108,11 @@ function setBlackAsPrimary(value: boolean) {
</fieldset>
<fieldset>
- <legend class="text-[11px] leading-none font-semibold mb-2">
+ <legend class="mb-2 text-[11px] leading-none font-semibold">
{{ t('neutral') }}
</legend>
- <div class="grid grid-cols-3 gap-1 -mx-2">
+ <div class="-mx-2 grid grid-cols-3 gap-1">
<ThemePickerButton
v-for="color in neutralColors"
:key="color"
@@ -125,11 +125,11 @@ function setBlackAsPrimary(value: boolean) {
</fieldset>
<fieldset>
- <legend class="text-[11px] leading-none font-semibold mb-2">
+ <legend class="mb-2 text-[11px] leading-none font-semibold">
{{ t('radius') }}
</legend>
- <div class="grid grid-cols-5 gap-1 -mx-2">
+ <div class="-mx-2 grid grid-cols-5 gap-1">
<ThemePickerButton
v-for="r in radiuses"
:key="r"
@@ -142,11 +142,11 @@ function setBlackAsPrimary(value: boolean) {
</fieldset>
<fieldset>
- <legend class="text-[11px] leading-none font-semibold mb-2">
+ <legend class="mb-2 text-[11px] leading-none font-semibold">
{{ t('theme') }}
</legend>
- <div class="grid grid-cols-3 gap-1 -mx-2">
+ <div class="-mx-2 grid grid-cols-3 gap-1">
<ThemePickerButton
v-for="m in modes"
:key="m.label"
diff --git a/app/components/theme/PickerButton.vue b/app/components/theme/PickerButton.vue
index 28fc5ccc..cb6f8d32 100644
--- a/app/components/theme/PickerButton.vue
+++ b/app/components/theme/PickerButton.vue
@@ -14,7 +14,7 @@ defineProps<{
variant="outline"
:icon="icon"
:label="label"
- class="capitalize ring-(--ui-border) rounded-[calc(var(--ui-radius))] text-[11px]"
+ class="rounded-[calc(var(--ui-radius))] text-[11px] capitalize ring-(--ui-border)"
:class="[selected ? 'bg-elevated' : 'hover:bg-elevated/50']"
>
<template v-if="chip" #leading>
diff --git a/app/components/trnForm/Bottom.vue b/app/components/trnForm/Bottom.vue
index 3f74105b..db5ae80b 100644
--- a/app/components/trnForm/Bottom.vue
+++ b/app/components/trnForm/Bottom.vue
@@ -78,18 +78,18 @@ onMounted(init)
<BottomSheetClose @onClick="close" />
</template>
- <div class="trnForm @container/trnForm bg-default">
+ <div class="trnForm bg-default @container/trnForm">
<div ref="sliderRef" class="swiper-container">
<div class="swiper-wrapper">
<!-- History -->
<div
- class="swiper-slide h-full overflow-y-auto bg-default"
+ class="swiper-slide bg-default h-full overflow-y-auto"
:style="{ height: maxHeight }"
>
<TrnFormTrnsSlide
:slider="sliderObj"
:mainSlideIdx="1"
- class="overflow-hidden px-2 pb-6 pt-4"
+ class="overflow-hidden px-2 pt-4 pb-6"
/>
</div>
diff --git a/app/components/wallets/Form.vue b/app/components/wallets/Form.vue
index 7c5f7f9e..7e6be954 100644
--- a/app/components/wallets/Form.vue
+++ b/app/components/wallets/Form.vue
@@ -5,7 +5,7 @@ import type { CurrencyCode } from '~/components/currencies/types'
import type { WalletId, WalletItem, WalletType } from '~/components/wallets/types'
import { errorEmo, random } from '~/assets/js/emo'
-import { icons, types, walletItemSchema } from '~/components/wallets/types'
+import { types, walletItemSchema } from '~/components/wallets/types'
import { useWalletsStore } from '~/components/wallets/useWalletsStore'
const props = defineProps<{
@@ -42,44 +42,44 @@ const walletPlaceholder = computed(() => ({
/**
* Validate
*/
-function validate(values: WalletItem) {
- // name
- if (!values.name) {
- toast.add({
- color: 'error',
- description: t('wallets.form.name.error'),
- title: random(errorEmo),
- })
-
- return false
- }
-
- // currency
- if (!values.currency) {
- toast.add({
- color: 'error',
- description: t('wallets.form.currency.error'),
- title: random(errorEmo),
- })
-
- return false
- }
-
- // Check for duplicate wallet names
- const existingWallet = Object.entries(walletsStore.items ?? {})
- .find(([id, wallet]) => wallet.name === values.name && id !== editWalletId)
-
- if (existingWallet) {
- toast.add({
- color: 'error',
- description: t('wallets.form.name.exist'),
- title: random(errorEmo),
- })
- return false
- }
-
- return true
-}
+// function validate(values: WalletItem) {
+// // name
+// if (!values.name) {
+// toast.add({
+// color: 'error',
+// description: t('wallets.form.name.error'),
+// title: random(errorEmo),
+// })
+
+// return false
+// }
+
+// // currency
+// if (!values.currency) {
+// toast.add({
+// color: 'error',
+// description: t('wallets.form.currency.error'),
+// title: random(errorEmo),
+// })
+
+// return false
+// }
+
+// // Check for duplicate wallet names
+// const existingWallet = Object.entries(walletsStore.items ?? {})
+// .find(([id, wallet]) => wallet.name === values.name && id !== editWalletId)
+
+// if (existingWallet) {
+// toast.add({
+// color: 'error',
+// description: t('wallets.form.name.exist'),
+// title: random(errorEmo),
+// })
+// return false
+// }
+
+// return true
+// }
async function onSave() {
const values = walletItemSchema.safeParse(props.walletForm)