Skip to content

Open source personal finance application

usability: updates

ilkomee9765c9a8fee
diff --git a/components/filter/useFilter.ts b/components/filter/useFilter.ts
index 87f773c8..2f9c2a7d 100644
--- a/components/filter/useFilter.ts
+++ b/components/filter/useFilter.ts
@@ -27,10 +27,17 @@ export default function useFilter() {
scrollTop()
}
+ function setDayDate(date) {
+ $store.dispatch('filter/setPeriod', 'day')
+ $store.dispatch('filter/setDate', parseInt(date))
+ scrollTop()
+ }
+
return {
scrollTop,
setFilterCatsId,
setFilterWalletsId,
filterPeriodNameAllReplacedToYear,
+ setDayDate,
}
}
diff --git a/components/stat/menu/Mobile.vue b/components/stat/Menu.vue
similarity index 50%
rename from components/stat/menu/Mobile.vue
rename to components/stat/Menu.vue
index 08ba0fd9..abea1fe5 100644
--- a/components/stat/menu/Mobile.vue
+++ b/components/stat/Menu.vue
@@ -20,12 +20,23 @@ function onClickStatMenu(tabName) {
</script>
<template lang="pug">
-UiTabs2
- UiTabsItem2(
- v-for="item in menu"
- v-if="!item.isPrivate || $store.getters['user/isDevUser']"
- :key="item.id"
- :isActive="item.id === activeTabStat"
- @click="onClickStatMenu(item.id)"
- ) {{ item.name }}
+.my-4.px-2.sticky.z-20.backdrop-blur.firefoxBackdropFix(
+ class="top-[44px] bg-white/70 dark_bg-dark3/70"
+)
+ UiTabs2
+ UiTabsItem2.md_text-lg(
+ v-for="item in menu"
+ v-if="!item.isPrivate || $store.getters['user/isDevUser']"
+ :key="item.id"
+ :isActive="item.id === activeTabStat"
+ @click="onClickStatMenu(item.id)"
+ ) {{ item.name }}
</template>
+
+<style lang="stylus">
+.firefoxBackdropFix
+ @supports (not (-webkit-backdrop-filter: none)) and (not (backdrop-filter: none))
+ background theme('colors.dark3') !important
+ /.light &
+ background theme('colors.white') !important
+</style>
diff --git a/components/stat/View.vue b/components/stat/View.vue
index cede0bdf..4c74a25a 100644
--- a/components/stat/View.vue
+++ b/components/stat/View.vue
@@ -106,14 +106,7 @@ onDeactivated(async () => {
StatSumTotal
StatViewConfig
- .mb-4.px-2
- StatMenuLaptop
-
- template(v-if="isMobileView")
- .my-4.px-2.sticky.z-20.backdrop-blur(
- class="top-[44px] bg-white/70 dark_bg-dark3/70"
- )
- StatMenuMobile
+ StatMenu
div(
class="min-h-[calc(100vh-130px)]"
@@ -183,14 +176,7 @@ onDeactivated(async () => {
.my-4.px-2
TrnsListWithControl(
:trnsIds="statPage.current.trnsIds"
- defaultPeriod="period"
+ isFilterByDay
+ defaultFilterTrnsPeriod="period"
)
</template>
-
-<style lang="stylus">
-.firefoxBackdropFix
- @supports (not (-webkit-backdrop-filter: none)) and (not (backdrop-filter: none))
- background theme('colors.dark3') !important
- /.light &
- background theme('colors.white') !important
-</style>
diff --git a/components/stat/chart/Periods.vue b/components/stat/chart/Periods.vue
index 12725732..334c06fe 100644
--- a/components/stat/chart/Periods.vue
+++ b/components/stat/chart/Periods.vue
@@ -64,7 +64,7 @@ const isShowAdd = computed(() => showedPeriods.value >= maxPeriodsNumber.value)
)
| {{ periodItem.name }}
span.pl-1(v-if="periodItem.slug === filterPeriodNameAllReplacedToYear")
- | {{ showedPeriods }}/{{ maxPeriodsNumber }}
+ | {{ showedPeriods }}
.cursor-pointer.w-10.py-2.px-3.flex-center.rounded-md.hocus_bg-skin-item-main-hover(
:class="{ 'opacity-0 cursor-default pointer-events-none': isShowAdd }"
diff --git a/components/stat/menu/Laptop.vue b/components/stat/menu/Laptop.vue
deleted file mode 100644
index 4005c90d..00000000
--- a/components/stat/menu/Laptop.vue
+++ /dev/null
@@ -1,22 +0,0 @@
-<script setup lang="ts">
-import useStatPage from '~/components/stat/useStatPage'
-
-const { $store } = useNuxtApp()
-const { menu } = useStatPage()
-const activeTabStat = computed(() => $store.state.ui.activeTabStat)
-
-function onClickStatMenu(tabName) {
- $store.dispatch('ui/setActiveTabStat', tabName)
-}
-</script>
-
-<template lang="pug">
-UiTabs
- UiTabsItem(
- v-for="item in menu"
- v-if="!item.isPrivate || $store.getters['user/isDevUser']"
- :key="item.id"
- :isActive="item.id === activeTabStat"
- @click="onClickStatMenu(item.id)"
- ) {{ item.name }}
-</template>
diff --git a/components/trns/List.vue b/components/trns/List.vue
index 885279dd..86ebe635 100644
--- a/components/trns/List.vue
+++ b/components/trns/List.vue
@@ -10,6 +10,7 @@ const props = withDefaults(defineProps<{
trnsIds: TrnID[]
isShowFilter?: boolean
+ isFilterByDay?: boolean
isShowGroupDate?: boolean
uiCat?: boolean
uiHistory?: boolean
@@ -24,7 +25,7 @@ const emit = defineEmits(['onClickEdit'])
const { $store } = useNuxtApp()
const { setExpression } = useCalculator()
-const { setFilterCatsId } = useFilter()
+const { setFilterCatsId, setDayDate } = useFilter()
const pageNumber = ref(1)
const isShowTrnsWithDesc = ref(false)
@@ -120,7 +121,10 @@ div(v-if="trnsIds && trnsIds.length > 0")
:key="date"
class="dark_bg-dark4"
)
- .pt-4.pb-2.px-3(v-if="isShowGroupDate")
+ .pt-4.pb-2.px-3(
+ v-if="isShowGroupDate"
+ @click="isFilterByDay ? setDayDate(date) : null"
+ )
DateTrnsDay(:date="date")
.overflow-hidden.rounded-md
diff --git a/components/trns/ListWithControl.vue b/components/trns/ListWithControl.vue
index 19614b1e..d1f20775 100644
--- a/components/trns/ListWithControl.vue
+++ b/components/trns/ListWithControl.vue
@@ -1,37 +1,43 @@
<script setup lang="ts">
import type { TrnID, TrnItem, TrnType } from '~/components/trns/types'
import useTrns from '~/components/trns/useTrns'
+import useStatPage from '~/components/stat/useStatPage'
const props = withDefaults(defineProps<{
trnsIds: TrnID[]
trnsClassNames?: string
- defaultPeriod?: string
+ defaultFilterTrnsPeriod?: string
+ isFilterByDay?: boolean
}>(), {
trnsClassNames: ' grid md_grid-cols-2 md_gap-x-20',
})
const emit = defineEmits(['onClickEdit'])
const { $store } = useNuxtApp()
-const filterType = ref<TrnType>(null)
-const filterAll = ref(props.defaultPeriod)
+const filterTrnsType = ref<TrnType>(null)
+const filterTrnsPeriod = ref(props.defaultFilterTrnsPeriod)
const { allTrnsIdsWithFilter } = useTrns()
+const { statPage } = useStatPage()
+
+// Return to filter 'period', when global filter params changed
+watch(statPage.filter, () => filterTrnsPeriod.value = 'period')
const filteredTrnsIds = computed(() => {
- const trnsIds = props.defaultPeriod && filterAll.value === 'all'
+ const trnsIds = props.defaultFilterTrnsPeriod && filterTrnsPeriod.value === 'all'
? allTrnsIdsWithFilter.value
: props.trnsIds
- if (filterType.value === null)
+ if (filterTrnsType.value === null)
return trnsIds
const trnsItems: Record<TrnID, TrnItem> = $store.state.trns.items
- return trnsIds.filter(id => trnsItems[id].type === filterType.value)
+ return trnsIds.filter(id => trnsItems[id].type === filterTrnsType.value)
})
const trnsCount = computed(() => filteredTrnsIds.value.length)
-function setTrnType(type: TrnType) {
- filterType.value = type
+function setFilterTrnsType(type: TrnType) {
+ filterTrnsType.value = type
}
function onClickEdit(props) {
@@ -50,38 +56,38 @@ div
div {{ $t('trns.inPeriodTitle') }}:
div {{ trnsCount }}
- .div(v-if="defaultPeriod")
+ .div(v-if="defaultFilterTrnsPeriod")
UiTabs
UiTabsItem(
- :isActive="filterAll === 'period'"
- @click="filterAll = 'period'"
+ :isActive="filterTrnsPeriod === 'period'"
+ @click="filterTrnsPeriod = 'period'"
) {{ $t('dates.period') }}
UiTabsItem(
- :isActive="filterAll === 'all'"
- @click="filterAll = 'all'"
+ :isActive="filterTrnsPeriod === 'all'"
+ @click="filterTrnsPeriod = 'all'"
) {{ $t('common.all') }}
//- TypeSelector
.pb-2(v-if="trnsIds.length > 0")
UiTabs
UiTabsItem(
- :isActive="filterType === null"
- @click="setTrnType(null)"
+ :isActive="filterTrnsType === null"
+ @click="setFilterTrnsType(null)"
) {{ $t('common.all') }}
UiTabsItem(
- :isActive="filterType === 0"
- @click="setTrnType(0)"
+ :isActive="filterTrnsType === 0"
+ @click="setFilterTrnsType(0)"
) {{ $t('money.expense') }}
UiTabsItem(
- :isActive="filterType === 1"
- @click="setTrnType(1)"
+ :isActive="filterTrnsType === 1"
+ @click="setFilterTrnsType(1)"
) {{ $t('money.income') }}
UiTabsItem(
- :isActive="filterType === 2"
- @click="setTrnType(2)"
+ :isActive="filterTrnsType === 2"
+ @click="setFilterTrnsType(2)"
) {{ $t('transfer.titleMany') }}
//- Nothing
@@ -95,6 +101,7 @@ div
TrnsList(
:trnsIds="filteredTrnsIds"
:size="50"
+ :isFilterByDay="isFilterByDay"
isShowFilter
uiHistory
@onClickEdit="onClickEdit"
diff --git a/nuxt.config.js b/nuxt.config.js
index d17a1c79..1baae857 100644
--- a/nuxt.config.js
+++ b/nuxt.config.js
@@ -48,7 +48,11 @@ export default defineNuxtConfig({
stylus: ['~/assets/stylus/variables'],
},
- components: true,
+ components: [{
+ path: '~/components/',
+ extensions: ['vue'],
+ }],
+
loading: false,
plugins: [