Skip to content

Open source personal finance application

fix: update viewport settings and improve layout responsiveness

Ilya Komicheva7da6528a30a
diff --git a/app/assets/css/tailwind.css b/app/assets/css/tailwind.css
index c69ee804..044cf306 100644
--- a/app/assets/css/tailwind.css
+++ b/app/assets/css/tailwind.css
@@ -25,7 +25,7 @@
@layer base {
html,
body {
- @apply bg-foreground-1 font-primary text-1 leading-none antialiased h-dvh select-none;
+ @apply bg-foreground-1 font-primary text-1 leading-none antialiased select-none;
overscroll-behavior-y: none;
}
}
@@ -44,7 +44,8 @@
}
.bottomSheetContent {
- @apply grid h-full max-h-[90vh] grid-rows-[auto,1fr,auto] overflow-hidden;
+ @apply grid h-full max-h-[98dvh] grid-rows-[auto,1fr,auto] overflow-hidden;
+ padding-bottom: calc(env(safe-area-inset-bottom) - 22px);
}
.bottomSheetContentInside {
diff --git a/app/components/amount/Amount.vue b/app/components/amount/Amount.vue
index 0b63e414..c51b321a 100644
--- a/app/components/amount/Amount.vue
+++ b/app/components/amount/Amount.vue
@@ -58,9 +58,7 @@ const { baseCurrencyCode, getAmountInBaseRate } = useAmount()
<template v-if="amount !== 0">
<AmountItem
:align="props.align"
- :amount="
- formatAmount(amount, currencyCode, { precision: props.precision })
- "
+ :amount="formatAmount(amount, currencyCode, { precision: props.precision })"
:isShowMinus="props.isShowMinus"
:isShowPlus="props.isShowPlus"
:isShowSymbol="props.isShowSymbol"
diff --git a/app/components/layout/MenuBottom.vue b/app/components/layout/MenuBottom.vue
index 9ecf797c..ba7a92b6 100644
--- a/app/components/layout/MenuBottom.vue
+++ b/app/components/layout/MenuBottom.vue
@@ -6,7 +6,8 @@ const { itemsBottom } = useMenuData()
<template>
<div
- class="sm:bottom-inherit absolute bottom-0 left-0 z-20 mx-auto flex w-full items-stretch bg-foreground-2/80 backdrop-blur sm:hidden lg:hidden"
+ class="sm:bottom-inherit sticky bottom-0 left-0 z-20 mx-auto flex w-full items-stretch bg-foreground-2/80 backdrop-blur sm:hidden lg:hidden"
+ style="padding-bottom: calc(env(safe-area-inset-bottom) - 16px)"
>
<LayoutSidebarMenuItem
v-for="(item, menuId) in itemsBottom"
diff --git a/app/components/stat/Config.vue b/app/components/stat/Config.vue
index 068343b5..ea10817b 100644
--- a/app/components/stat/Config.vue
+++ b/app/components/stat/Config.vue
@@ -36,11 +36,11 @@ const isShow = ref(false)
</template>
<template #content="{ close }">
- <div class="grid gap-4 px-1 pt-3 md:px-3">
+ <div class="grid gap-4 px-1 py-3 md:px-3 md:!pb-0">
<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/categories/Section.vue b/app/components/stat/categories/Section.vue
index 5330754c..7801ac9d 100644
--- a/app/components/stat/categories/Section.vue
+++ b/app/components/stat/categories/Section.vue
@@ -187,6 +187,7 @@ function updateState(
</template>
<template v-if="categoriesWithData.length > 0">
+ <!-- Vertical -->
<div
v-if="statConfig.config.value.vertical.isShow && verticalCategories.length > 1"
class="grid"
diff --git a/app/components/trnForm/Bottom.vue b/app/components/trnForm/Bottom.vue
index cc763461..fc0283a1 100644
--- a/app/components/trnForm/Bottom.vue
+++ b/app/components/trnForm/Bottom.vue
@@ -69,7 +69,7 @@ onMounted(init)
<template>
<BottomSheet
:isShow="isShow"
- drugClassesCustom="max-h-[100dvh] max-w-md"
+ drugClassesCustom="max-h-[98dvh] max-w-md"
@closed="trnsFormStore.onClose()"
>
<template #handler="{ close }">
@@ -95,7 +95,7 @@ onMounted(init)
<!-- Main -->
<div class="swiper-slide getHeight bg-foreground-1">
<div class="scroll scrollerBlock">
- <div class="max-h-[90dvh]">
+ <div class="max-h-[98dvh]">
<TrnFormMain :maxHeight />
</div>
</div>
diff --git a/app/components/trnForm/Main.vue b/app/components/trnForm/Main.vue
index 8256c7a2..35f59851 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>
@@ -205,6 +205,7 @@ const actions = computed(() => ({
<TrnFormMainAmountTransfer
v-if="trnsFormStore.values.trnType === 2"
+ :bottomSheetStyle="{ maxHeight: props.maxHeight }"
isLaptop
@onOpen="show(0)"
/>
@@ -217,9 +218,12 @@ const actions = computed(() => ({
<style>
.trnForm {
+ padding-bottom: calc(env(safe-area-inset-bottom) - 16px);
+
.trnForm__pagination {
- @apply absolute left-1/2 bottom-[1px] z-[2] flex items-center justify-center w-auto p-1.5 rounded-md bg-foreground-1;
+ @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) - 16px);
}
.swiper-pagination-bullet {
diff --git a/app/components/trnForm/main/AmountTransfer.vue b/app/components/trnForm/main/AmountTransfer.vue
index e89040b9..b4de9e33 100644
--- a/app/components/trnForm/main/AmountTransfer.vue
+++ b/app/components/trnForm/main/AmountTransfer.vue
@@ -7,7 +7,8 @@ import { type TransferType, TrnType } from '~/components/trns/types'
import { getStyles } from '~/components/ui/getStyles'
import { useWalletsStore } from '~/components/wallets/useWalletsStore'
-defineProps<{
+const props = defineProps<{
+ bottomSheetStyle?: Record<string, string>
isLaptop: boolean
}>()
@@ -80,18 +81,20 @@ watch(
<TrnFormSelectorWallet
v-if="slug === 'income' && incomeWalletId"
+ :bottomSheetStyle="props.bottomSheetStyle"
+ :isLaptop
:title="t(slug)"
:walletId="incomeWalletId"
- :isLaptop
@onOpen="n => emit('onOpen', n)"
@onSelected="id => trnsFormStore.values.incomeWalletId = id"
/>
<TrnFormSelectorWallet
v-if="slug === 'expense' && expenseWalletId"
+ :bottomSheetStyle="props.bottomSheetStyle"
+ :isLaptop
:title="t(slug)"
:walletId="expenseWalletId"
- :isLaptop
@onOpen="n => emit('onOpen', n)"
@onSelected="id => trnsFormStore.values.expenseWalletId = id"
/>
diff --git a/app/components/ui/Page.vue b/app/components/ui/Page.vue
index addbadeb..453bf903 100644
--- a/app/components/ui/Page.vue
+++ b/app/components/ui/Page.vue
@@ -1,9 +1,10 @@
<template>
<div
class="
- relative rounded-xl bg-foreground-1 pb-[50px]
+ relative rounded-xl bg-foreground-1
sm:border sm:border-item-5 sm:p-2 md:p-3 lg:p-4
"
+ style="padding-bottom: calc(50px + env(safe-area-inset-bottom))"
>
<slot />
</div>
diff --git a/app/components/wallets/Item.vue b/app/components/wallets/Item.vue
index eeecb692..45b81c0a 100644
--- a/app/components/wallets/Item.vue
+++ b/app/components/wallets/Item.vue
@@ -152,7 +152,7 @@ if (!props.isSort) {
<div
v-if="isSort"
- class="sortHandle flex-center absolute h-full rounded-md px-3 group-hocus:bg-item-5"
+ class="sortHandle flex-center absolute right-0 h-full rounded-md px-3 group-hocus:bg-item-5"
>
<Icon name="lucide:grip-vertical" size="20" />
</div>
diff --git a/app/layouts/default.vue b/app/layouts/default.vue
index da9bd789..ed717efc 100644
--- a/app/layouts/default.vue
+++ b/app/layouts/default.vue
@@ -76,6 +76,7 @@ usePageScroll()
<div
:class="{ 'md:translate-x-20': isShowTrnForm && isShowSidebar && width >= 767 }"
class="layoutBase @container/main overflow-hidden transition-all duration-300 ease-in-out"
+ style="margin-left: env(safe-area-inset-left)"
>
<NuxtPwaManifest />
diff --git a/nuxt.config.ts b/nuxt.config.ts
index 869b1a7e..44439764 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -18,7 +18,7 @@ export default defineNuxtConfig({
}],
meta: [
{ charset: 'utf-8' },
- { content: 'width=device-width, initial-scale=1', name: 'viewport' },
+ { content: 'width=device-width, initial-scale=1, viewport-fit=cover', name: 'viewport' },
{
content: process.env.npm_package_description || '',
hid: 'description',