Skip to content

Open source personal finance application

refactor: move description button to date row in transaction form

Ilya Komichev45b91f1f6219
diff --git a/app/components/trnForm/Date.vue b/app/components/trnForm/Date.vue
index c562f3a1..790b284f 100644
--- a/app/components/trnForm/Date.vue
+++ b/app/components/trnForm/Date.vue
@@ -26,37 +26,41 @@ function changeDate(way: 'prev' | 'next' | 'today') {
</script>
<template>
- <div class="flex gap-1">
- <BottomSheetOrDropdown
- :title="t('common.date')"
- :isOpen="isShow"
- isShowCloseBtn
- @openModal="isShow = true"
- @closeModal="isShow = false"
- >
- <template #trigger>
- <UiActionButton class="text-2 grid w-full !justify-start p-2 text-left">
- <div class="text-1 text-sm">
- {{ formattedDate?.day }} {{ formattedDate?.month }}
- </div>
- <div class="font-regular text-2xs leading-none">
- {{ formattedDate?.weekday }}
- </div>
- </UiActionButton>
- </template>
-
- <template #content="{ close }">
- <div class="min-w-80">
- <TrnFormCalendar :onClose="close" />
- </div>
- </template>
- </BottomSheetOrDropdown>
-
+ <div class="flex items-center gap-1">
<DateNav
+ class="grow"
:isShowNavHome="!isToday"
:isEnd="isToday"
:isStart="false"
@changeDate="changeDate"
- />
+ >
+ <BottomSheetOrDropdown
+ :title="t('common.date')"
+ :isOpen="isShow"
+ class="grow"
+ isShowCloseBtn
+ @openModal="isShow = true"
+ @closeModal="isShow = false"
+ >
+ <template #trigger>
+ <UiActionButton class="text-2 grid h-full w-full content-center !justify-start px-2 text-left">
+ <div class="text-1 text-sm">
+ {{ formattedDate?.day }} {{ formattedDate?.month }}
+ </div>
+ <div class="font-regular text-2xs leading-none">
+ {{ formattedDate?.weekday }}
+ </div>
+ </UiActionButton>
+ </template>
+
+ <template #content="{ close }">
+ <div class="min-w-80">
+ <TrnFormCalendar :onClose="close" />
+ </div>
+ </template>
+ </BottomSheetOrDropdown>
+ </DateNav>
+
+ <slot />
</div>
</template>
diff --git a/app/components/trnForm/Main.vue b/app/components/trnForm/Main.vue
index 8b392dbe..9cedfce9 100644
--- a/app/components/trnForm/Main.vue
+++ b/app/components/trnForm/Main.vue
@@ -27,7 +27,9 @@ const walletId = computed(() =>
</UiTitleModal>
<TrnFormEditedTrn v-if="trnsFormStore.values.trnId" />
- <TrnFormDate class="px-3 pb-0 " />
+ <TrnFormDate class="px-3 pb-1">
+ <TrnFormMainDescription />
+ </TrnFormDate>
<div class="px-3 pb-2">
<TrnFormMainTypes />
diff --git a/app/components/trnForm/main/ActionSide.vue b/app/components/trnForm/main/ActionSide.vue
index beefcb8f..13985aba 100644
--- a/app/components/trnForm/main/ActionSide.vue
+++ b/app/components/trnForm/main/ActionSide.vue
@@ -37,7 +37,7 @@ async function onClickSubmit() {
<template>
<div
:class="cn(
- 'flex size-full items-center justify-center rounded-(--ui-radius) p-1 py-4 text-center transition hover:scale-[1.02]',
+ 'flex w-12 @xs/trnForm:w-14 @sm/trnForm:w-16 size-full items-center justify-center rounded-(--ui-radius) p-1 py-4 text-center transition hover:scale-[1.02]',
!isMath && isSubmittable
? 'bg-(--ui-primary)/60 hover:bg-(--ui-primary) text-icon-primary'
: 'bg-item-4 text-1 hover:bg-(--item-5)',
diff --git a/app/components/trnForm/main/Calculator.vue b/app/components/trnForm/main/Calculator.vue
index 9986d630..3c86d14f 100644
--- a/app/components/trnForm/main/Calculator.vue
+++ b/app/components/trnForm/main/Calculator.vue
@@ -76,8 +76,7 @@ onLongPress(
</div>
</div>
- <div class="grid grid-rows-[auto_1fr] gap-3">
- <TrnFormMainDescription />
+ <div class="grid grid-rows-[1fr] gap-3">
<TrnFormMainActionSide />
</div>
</div>
diff --git a/app/components/trnForm/main/Description.vue b/app/components/trnForm/main/Description.vue
index dce8cf7e..81cfc98d 100644
--- a/app/components/trnForm/main/Description.vue
+++ b/app/components/trnForm/main/Description.vue
@@ -23,20 +23,20 @@ function onSave(close: () => void) {
<BottomSheetOrDropdown
:isOpen="trnsFormStore.modal.description"
:title="t('trnForm.description.title')"
- class="grow"
+ class="!grow-0 shrink-0"
dragClassesCustom="max-w-md"
isShowCloseBtn
@closeModal="trnsFormStore.closeTrnFormModal('description')"
@openModal="trnsFormStore.openTrnFormModal('description')"
>
<template #trigger>
- <TrnFormMainCalculatorButton class="relative overflow-visible">
- <Icon name="lucide:message-square" size="26" />
+ <UiActionButton class="relative overflow-visible">
+ <Icon name="lucide:message-square" size="20" />
<div
v-if="trnsFormStore.values.desc"
class="absolute top-0 right-0 aspect-square w-2.5 rounded-full bg-(--ui-primary)"
/>
- </TrnFormMainCalculatorButton>
+ </UiActionButton>
</template>
<template #content="{ close }">