Open source personal finance application
refactor: fix modifyRange
Ilya Komichev305d5defccd1
diff --git a/app/components/date/LinkItemNoBg.vue b/app/components/date/LinkItemNoBg.vueindex 56d43db8..6161b235 100644--- a/app/components/date/LinkItemNoBg.vue+++ b/app/components/date/LinkItemNoBg.vue@@ -16,7 +16,7 @@ const emit = defineEmits<{'bg-[var(--item-5)] text-(--ui-primary)': props.isActive,},]"- class="text-nowrap rounded-full font-primary text-2xs leading-none text-2"+ class="text-nowrap rounded-full text-xs leading-none text-(--ui-text)"@click="(e: Event) => emit('click', e)"><slot />diff --git a/app/components/date/Ranges.vue b/app/components/date/Ranges.vueindex fea670b1..35569545 100644--- a/app/components/date/Ranges.vue+++ b/app/components/date/Ranges.vue@@ -124,21 +124,23 @@ function selectMaxRange(isSkipEmpty = false) {</template><template v-if="props.isShowRangeAdjust">- <DateLinkItem- v-bind="props.itemProps"- @click="props.statDate.minusRange"- >- -- </DateLinkItem>- <DateLinkItemNoBg>- {{ props.statDate.params.value.rangeDuration }}- </DateLinkItemNoBg>- <DateLinkItem- v-bind="props.itemProps"- @click="props.statDate.plusRange"- >- +- </DateLinkItem>+ <div class="flex border border-(--ui-border) rounded-(--ui-radius) bg-(--ui-bg) p-px gap-1">+ <DateLinkItem+ v-bind="props.itemProps"+ @click="props.statDate.minusRange"+ >+ -+ </DateLinkItem>+ <DateLinkItemNoBg>+ {{ props.statDate.params.value.rangeDuration }}+ </DateLinkItemNoBg>+ <DateLinkItem+ v-bind="props.itemProps"+ @click="props.statDate.plusRange"+ >+ ++ </DateLinkItem>+ </div></template><template v-if="props.view === 'maximum'">diff --git a/app/components/date/useStatDate.ts b/app/components/date/useStatDate.tsindex 8f971fdb..78d7ca12 100644--- a/app/components/date/useStatDate.ts+++ b/app/components/date/useStatDate.ts@@ -164,15 +164,12 @@ export function useStatDate({}function modifyRange(modification: number) {- console.log('modifyRange', modification)-resetCustomAndMaxRangeParams()- if (params.value.rangeDuration > 1)- params.value.rangeDuration += modification+ if (params.value.rangeDuration === 1 && modification < 0)+ return+ params.value.rangeDuration += modificationparams.value.rangeOffset = 0-- console.log('params.value.rangeDuration', params.value.rangeDuration)}const plusRange = () => modifyRange(1)diff --git a/app/components/stat/date/Navigation.vue b/app/components/stat/date/Navigation.vueindex 45b38274..fd36c81b 100644--- a/app/components/stat/date/Navigation.vue+++ b/app/components/stat/date/Navigation.vue@@ -59,7 +59,6 @@ function changeDate(way: 'next' | 'prev' | 'today') {</script><template>- <!-- grid @xl/page:grid-cols-[auto_1fr] grid-cols-[1fr_auto] --><div class="items-top flex items-center grow gap-2 sticky top-[77px] lg:top-[89px] py-2 -my-2 sticky z-20 bg-(--ui-bg)/90 backdrop-blur overflow-x-auto"><divv-if="!statDate.params.value.customDate"@@ -74,7 +73,6 @@ function changeDate(way: 'next' | 'prev' | 'today') {/></div>- <!-- @xl/page:order-2 --><BottomSheetOrDropdown:title="t('dates.select')":isOpen="statDate.modals.value.dateSelector"@@ -91,7 +89,7 @@ function changeDate(way: 'next' | 'prev' | 'today') {<template #content="{ close }"><StatDateSelector- class="min-w-[362px] pb-2 md:px-3 md:pb-0"+ class="min-w-[362px] pb-2 md:px-3"@onClose="close"/></template>diff --git a/app/components/stat/date/Selector.vue b/app/components/stat/date/Selector.vueindex 01822400..8f99f4e6 100644--- a/app/components/stat/date/Selector.vue+++ b/app/components/stat/date/Selector.vue@@ -97,7 +97,7 @@ function selectInterval(grouped: Grouped) {{{ t(`dates.${item.intervalsBy}.simple`) }}</DateLinkItem>- <div class="flex">+ <div class="flex border border-(--ui-border) rounded-(--ui-radius) bg-(--ui-bg) p-px gap-1"><DateLinkItem @click="statDate.delInterval">-</DateLinkItem>