Open source personal finance application
refactor: simplify trnForm layout structure
Ilya Komichev8f5539e733dc
diff --git a/app/components/trnForm/Date.vue b/app/components/trnForm/Date.vueindex 790b284f..40fbf4bc 100644--- a/app/components/trnForm/Date.vue+++ b/app/components/trnForm/Date.vue@@ -26,41 +26,37 @@ function changeDate(way: 'prev' | 'next' | 'today') {</script><template>- <div class="flex items-center gap-1">- <DateNav+ <DateNav+ class="grow"+ :isShowNavHome="!isToday"+ :isEnd="isToday"+ :isStart="false"+ @changeDate="changeDate"+ >+ <BottomSheetOrDropdown+ :title="t('common.date')"+ :isOpen="isShow"class="grow"- :isShowNavHome="!isToday"- :isEnd="isToday"- :isStart="false"- @changeDate="changeDate"+ isShowCloseBtn+ @openModal="isShow = true"+ @closeModal="isShow = false">- <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" />+ <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>- </template>- </BottomSheetOrDropdown>- </DateNav>-- <slot />- </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></template>diff --git a/app/components/trnForm/Main.vue b/app/components/trnForm/Main.vueindex 9cedfce9..bce53a37 100644--- a/app/components/trnForm/Main.vue+++ b/app/components/trnForm/Main.vue@@ -21,61 +21,57 @@ const walletId = computed(() =></script><template>- <div class="grid pb-0">+ <div class="grid gap-3 px-3 pb-6"><UiTitleModal @click="trnsFormStore.values.trnId = null">{{ trnsFormStore.values.trnId ? t('trnForm.titleEditTrn') : t('trnForm.createTrn') }}</UiTitleModal><TrnFormEditedTrn v-if="trnsFormStore.values.trnId" />- <TrnFormDate class="px-3 pb-1">- <TrnFormMainDescription />- </TrnFormDate>- <div class="px-3 pb-2">- <TrnFormMainTypes />+ <div class="flex items-center gap-1">+ <TrnFormDate />+ <TrnFormMainDescription /></div>+ <TrnFormMainTypes />+<TrnFormMainInputv-if="trnsFormStore.values.trnType !== TrnType.Transfer":amount="trnsFormStore.values.amount[trnsFormStore.activeAmountIdx]":amountRaw="trnsFormStore.values.amountRaw[trnsFormStore.activeAmountIdx]":highlight="trnsFormStore.values.trnType === TrnType.Expense ? 'expense' : 'income'":isShowSum="trnsFormStore.shouldShowSum()"- class="px-3 pb-2"@change="trnsFormStore.onChangeAmount"/>- <div class="grid gap-3 px-3 pb-6">- <!-- Selected -->- <div- v-if="trnsFormStore.values.trnType !== TrnType.Transfer"- class="grid grid-cols-2 gap-2"- >- <TrnFormSelectorWallet- v-if="walletId"- :bottomSheetStyle="{ maxHeight }"- :title="t('trnForm.wallet.select')"- :walletId="walletId"- @selected="(id: WalletId) => trnsFormStore.values.walletId = id"- />-- <TrnFormSelectorCategory- v-if="trnsFormStore.values.categoryId || categoriesStore.categoriesIdsForTrnValues[0]"- :bottomSheetStyle="{ maxHeight }"- :category="categoriesStore.items[(trnsFormStore.values.categoryId ?? categoriesStore.categoriesIdsForTrnValues[0])!]!"- :categoryId="(trnsFormStore.values.categoryId ?? categoriesStore.categoriesIdsForTrnValues[0])!"- :title="t('trnForm.category.select')"- @selected="(id: CategoryId) => trnsFormStore.values.categoryId = id"- />- </div>-- <TrnFormMainAmountTransfer- v-if="trnsFormStore.values.trnType === TrnType.Transfer"+ <!-- Selected -->+ <div+ v-if="trnsFormStore.values.trnType !== TrnType.Transfer"+ class="grid grid-cols-2 gap-2"+ >+ <TrnFormSelectorWallet+ v-if="walletId":bottomSheetStyle="{ maxHeight }"+ :title="t('trnForm.wallet.select')"+ :walletId="walletId"+ @selected="(id: WalletId) => trnsFormStore.values.walletId = id"/>- <TrnFormMainCalculator />+ <TrnFormSelectorCategory+ v-if="trnsFormStore.values.categoryId || categoriesStore.categoriesIdsForTrnValues[0]"+ :bottomSheetStyle="{ maxHeight }"+ :category="categoriesStore.items[(trnsFormStore.values.categoryId ?? categoriesStore.categoriesIdsForTrnValues[0])!]!"+ :categoryId="(trnsFormStore.values.categoryId ?? categoriesStore.categoriesIdsForTrnValues[0])!"+ @selected="(id: CategoryId) => trnsFormStore.values.categoryId = id"+ /></div>++ <TrnFormMainAmountTransfer+ v-if="trnsFormStore.values.trnType === TrnType.Transfer"+ :bottomSheetStyle="{ maxHeight }"+ />++ <TrnFormMainCalculator /></div></template>