Skip to content

Open source personal finance application

feat: enhance Toastify styles and improve component interactions

Ilya Komichev110f34dba8c7
diff --git a/app/assets/css/others.css b/app/assets/css/others.css
index 66bd4768..ea45ddb8 100644
--- a/app/assets/css/others.css
+++ b/app/assets/css/others.css
@@ -1,9 +1,13 @@
+.Toastify__toast-container {
+ @apply p-2;
+}
+
.Toastify__toast {
@apply cursor-default bg-foreground-1 !ring-2 !ring-item-3 text-1 p-0 min-h-6 rounded-lg hover:bg-item-3;
}
.Toastify__toast-body {
- @apply p-5 py-5;
+ @apply p-5 py-5 text-2;
}
.Toastify__close-button {
@@ -13,3 +17,7 @@
.Toastify__progress-bar {
@apply hidden;
}
+
+.Toastify__toast-container--top-left {
+ @apply left-1 top-1;
+}
diff --git a/app/components/categories/Delete.vue b/app/components/categories/Delete.vue
index e8e37e83..b65f250b 100644
--- a/app/components/categories/Delete.vue
+++ b/app/components/categories/Delete.vue
@@ -10,6 +10,10 @@ const props = defineProps<{
categoryId: CategoryId
}>()
+const emit = defineEmits<{
+ close: []
+}>()
+
const categoriesStore = useCategoriesStore()
const router = useRouter()
const trnsStore = useTrnsStore()
@@ -28,7 +32,10 @@ const deleteDescText = computed(() => {
})
const isShowDeleteConfirm = ref(false)
+
function onClickDelete() {
+ emit('close')
+
for (const id in categoriesStore.items) {
if (categoriesStore.items[id]?.parentId === props.categoryId) {
$toast(UiToastContent, {
diff --git a/app/components/categories/page/id/Index.vue b/app/components/categories/page/id/Index.vue
index 70475d8e..b961af51 100644
--- a/app/components/categories/page/id/Index.vue
+++ b/app/components/categories/page/id/Index.vue
@@ -70,8 +70,9 @@ onMounted(() => {
trnsFormStore.values.categoryId = categoryId.value
})
-function onEditClick() {
+function onEditClick(close: () => void) {
router.push(`/categories/${categoryId.value}/edit`)
+ close()
}
useHead({ title: category.value?.name })
@@ -94,16 +95,16 @@ useHead({ title: category.value?.name })
<template
v-if="!categoriesStore.transferCategoriesIds.includes(categoryId)"
- #popover
+ #popover="{ close }"
>
<UiHeaderLink
icon="mdi:pencil-outline"
- @click="onEditClick"
+ @click="() => onEditClick(close)"
>
{{ t('base.edit') }}
</UiHeaderLink>
- <CategoriesDelete :categoryId />
+ <CategoriesDelete :categoryId @close="close" />
</template>
</StatHeader>
diff --git a/app/components/stat/Config.vue b/app/components/stat/Config.vue
index 7df2aeee..e15d0a61 100644
--- a/app/components/stat/Config.vue
+++ b/app/components/stat/Config.vue
@@ -1,4 +1,5 @@
<script setup lang="ts">
+import type { StatConfigModal } from '~/components/stat/types'
import type { StatConfigProvider } from '~/components/stat/useStatConfig'
import { useStatChart } from '~/components/stat/chart/useStatChart'
@@ -7,6 +8,7 @@ import { useWalletsStore } from '~/components/wallets/useWalletsStore'
const props = defineProps<{
isShowWallets?: boolean
+ statConfigModal: StatConfigModal
}>()
const statConfig = inject('statConfig') as StatConfigProvider
@@ -18,16 +20,14 @@ function updateWalletsLimit(value: number) {
if (value <= walletsStore.sortedIds.length && value > 0)
statConfig.updateConfig('wallets', { count: value })
}
-
-const isShow = ref(false)
</script>
<template>
<BottomSheetOrDropdown
:title="t('stat.config.menu.label')"
- :isOpen="isShow"
- @onOpenModal="isShow = true"
- @onCloseModal="isShow = false"
+ :isOpen="props.statConfigModal.isShow"
+ @onOpenModal="props.statConfigModal.show"
+ @onCloseModal="props.statConfigModal.close"
>
<template #trigger>
<UiItem1>
@@ -40,7 +40,7 @@ const isShow = ref(false)
<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>
@@ -108,7 +108,7 @@ const isShow = ref(false)
<!-- Showed 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') }}
diff --git a/app/components/stat/Header.vue b/app/components/stat/Header.vue
index 03a81cad..b30beead 100644
--- a/app/components/stat/Header.vue
+++ b/app/components/stat/Header.vue
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { Range } from '~/components/date/types'
import type { FilterProvider } from '~/components/filter/types'
-import type { MoneyTypeSlugNew } from '~/components/stat/types'
+import type { MoneyTypeSlugNew, StatConfigModal } from '~/components/stat/types'
import type { StatConfigProvider } from '~/components/stat/useStatConfig'
import type { WalletId } from '~/components/wallets/types'
@@ -43,6 +43,12 @@ function onClickWallet(walletId: WalletId) {
filter.toggleWalletId(walletId)
trnsFormStore.values.walletId = walletId
}
+
+const statConfigModal: Ref<StatConfigModal> = ref({
+ close: () => statConfigModal.value.isShow = false,
+ isShow: false,
+ show: () => statConfigModal.value.isShow = true,
+})
</script>
<template>
@@ -62,11 +68,12 @@ function onClickWallet(walletId: WalletId) {
<StatConfig
v-if="props.config"
- :isShowWallets="!!props.config.isShowWallets"
:isShowCategories="!!props.config.isShowCategories"
+ :isShowWallets="!!props.config.isShowWallets"
+ :statConfigModal
>
<div v-if="$slots.popover">
- <slot name="popover" />
+ <slot name="popover" :close="statConfigModal.close" />
</div>
</StatConfig>
</div>
diff --git a/app/components/stat/types.ts b/app/components/stat/types.ts
index e3a9322f..fea54e1d 100644
--- a/app/components/stat/types.ts
+++ b/app/components/stat/types.ts
@@ -43,3 +43,9 @@ export type IntervalData = {
total: TotalReturns
trnsIds: TrnId[]
}
+
+export type StatConfigModal = {
+ close: () => void
+ isShow: boolean
+ show: () => void
+}
diff --git a/app/components/trnForm/Main.vue b/app/components/trnForm/Main.vue
index 6abe821e..9af1c4d9 100644
--- a/app/components/trnForm/Main.vue
+++ b/app/components/trnForm/Main.vue
@@ -96,7 +96,7 @@ const actions = computed(() => ({
/>
<UiTitle3
- class="sticky top-0 z-10 bg-foreground-1 px-3 pb-3 pt-4 md:text-xl"
+ class="bg-foreground-1 sticky top-0 z-10 px-3 pb-3 pt-4 md:text-xl"
@click="trnsFormStore.values.trnId = null"
>
{{ trnsFormStore.values.trnId ? t("trnForm.titleEditTrn") : t("trnForm.createTrn") }}
@@ -108,7 +108,7 @@ const actions = computed(() => ({
>
<TrnsItem
:trnItem="trnsStore.computeTrnItem(trnsFormStore.values.trnId)"
- class="group rounded-lg bg-item-4"
+ class="bg-item-4 group rounded-lg"
@click="trnsFormStore.values.trnId = null"
/>
@@ -116,7 +116,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-accent-1 bg-foreground-1 p-3 text-1">
+ <div class="border-accent-1 bg-foreground-1 text-1 z-10 grid h-full content-center gap-4 rounded-lg border p-3">
{{ t('base.sure') }}
<div class="flex gap-2">
@@ -134,7 +134,7 @@ const actions = computed(() => ({
/>
</template>
- <div class="leading-none text-2">
+ <div class="text-2 leading-none">
{{ t(item.localeKey) }}
</div>
</UiElement>
@@ -156,7 +156,7 @@ const actions = computed(() => ({
/>
</template>
- <div class="leading-none text-2">
+ <div class="text-2 leading-none">
{{ t(item.localeKey) }}
</div>
</DateLinkItem>
@@ -223,7 +223,7 @@ const actions = computed(() => ({
.trnForm__pagination {
@apply absolute left-1/2 z-[2] flex items-center justify-center w-auto p-1.5 rounded-md bg-foreground-1;
transform: translateX(-50%);
- bottom: calc(1px + env(safe-area-inset-bottom));
+ bottom: 1px;
}
.swiper-pagination-bullet {
diff --git a/app/components/wallets/utils.ts b/app/components/wallets/utils.ts
index 9209a660..ba773911 100644
--- a/app/components/wallets/utils.ts
+++ b/app/components/wallets/utils.ts
@@ -12,7 +12,7 @@ export function normalizeWalletItem(wallet?: WalletItemDirty | WalletForm) {
isArchived: wallet?.isArchived ?? wallet?.archived ?? false,
isExcludeInTotal: wallet?.isExcludeInTotal ?? false,
isWithdrawal: wallet?.isWithdrawal ?? wallet?.withdrawal ?? false,
- name: wallet?.name ?? 'Wallet name',
+ name: wallet?.name ?? '',
order: wallet?.order ?? 1,
}
diff --git a/i18n/locales/en-US.js b/i18n/locales/en-US.js
index 8c53b93c..73a963ec 100644
--- a/i18n/locales/en-US.js
+++ b/i18n/locales/en-US.js
@@ -73,7 +73,7 @@ export default {
error: 'Write category name',
exist: 'Category with same name is exist',
label: 'Category name',
- placeholder: 'Write category name...',
+ placeholder: 'Write...',
},
parent: {
label: 'Parent category',
@@ -310,7 +310,7 @@ export default {
calcTrnButton: 'Calculate',
createTrn: 'Add transaction',
description: {
- placeholder: 'Write description...',
+ placeholder: 'Write...',
title: 'Description',
},
filterAll: 'All',
diff --git a/i18n/locales/ru-RU.js b/i18n/locales/ru-RU.js
index 31561df8..1f2b2412 100644
--- a/i18n/locales/ru-RU.js
+++ b/i18n/locales/ru-RU.js
@@ -73,7 +73,7 @@ export default {
error: 'Напишите название категории',
exist: 'Категория с таким именем уже существует',
label: 'Название категории',
- placeholder: 'Напишите название категории...',
+ placeholder: 'Напишите...',
},
parent: {
label: 'Родительская категория',