Skip to content

Open source personal finance application

feat (Stat): add info when no stat for period

ilkome52b5ee5a86d0
diff --git a/components/chart/MobileStatLines.vue b/components/chart/MobileStatLines.vue
index 1e8b5f44..e26cff67 100644
--- a/components/chart/MobileStatLines.vue
+++ b/components/chart/MobileStatLines.vue
@@ -5,6 +5,13 @@ import useFilter from '~/modules/filter/useFilter'
export default {
name: 'ChartMobileStatLines',
+ props: {
+ isEmptyStat: {
+ type: Boolean,
+ default: false
+ }
+ },
+
setup () {
const { store } = useContext()
const { filterPeriodNameAllReplacedToYear } = useFilter()
@@ -34,8 +41,9 @@ export default {
<template lang="pug">
.chart
- .chart__content
- StatChartLines(
+ .chart__content(v-if="!isEmptyStat")
+ LazyStatChartLines(
+ v-if="!isEmptyStat"
:isShowIncomes="activeTabStat === 'incomes' || activeTabStat === 'details' || activeTabStat === 'history'"
:isShowExpenses="activeTabStat === 'expenses' || activeTabStat === 'details' || activeTabStat === 'history'"
:chartType="chartType"
diff --git a/components/stat/Mobile.vue b/components/stat/Mobile.vue
index aa0d774e..d88aa862 100644
--- a/components/stat/Mobile.vue
+++ b/components/stat/Mobile.vue
@@ -111,6 +111,9 @@ export default {
return stat
})
+ // is empty stat
+ const isEmptyStat = computed(() => statAverage.value.total === 0 && store.getters['trns/selectedTrnsIdsWithDate'].length === 0)
+
return {
isShowChart,
@@ -131,7 +134,9 @@ export default {
moneyTypes,
statToday,
- statWithLastPeriods
+ statWithLastPeriods,
+
+ isEmptyStat
}
}
}
@@ -140,7 +145,10 @@ export default {
<template lang="pug">
.pageWrapScroll
.baseBox._chart(v-if="ui.showMainChart && isShowChart")
- LazyChartMobileStatLines(v-if="ui.showMainChart && isShowChart")
+ LazyChartMobileStatLines(
+ v-if="ui.showMainChart && isShowChart"
+ :isEmptyStat="isEmptyStat"
+ )
.baseBox._date
DateMobilePrevNextArrow
@@ -151,6 +159,10 @@ export default {
.baseBox._filter(v-if="isShowFilter")
LazyFilterRow(v-if="isShowFilter")
+ .noStat(v-if="isEmptyStat")
+ .noStat__title {{ $t('stat.empty') }}
+ .noStat__desc {{ $t('stat.emptyDesc') }}
+
template(v-if="activeTabStat !== 'history'")
//- Total
template(v-if="activeTabStat === 'details' && statAverage.incomes !== 0 && statAverage.expenses !== 0 && $store.state.filter.period !== 'all'")
@@ -315,6 +327,21 @@ export default {
<style lang="stylus" scoped>
@import '~assets/stylus/variables'
+.noStat
+ overflow hidden
+ padding $m10 $m7
+ color var(--c-font-3)
+ text-align center
+
+ &__title
+ padding-bottom $m6
+ font-size 22px
+
+ &__desc
+ color var(--c-font-4)
+ font-size 14px
+
+// ------------------------------------
.pageWrapScroll
overflow hidden
overflow-y auto
diff --git a/locales/en-US.js b/locales/en-US.js
index cfe65949..f15c9e9d 100644
--- a/locales/en-US.js
+++ b/locales/en-US.js
@@ -224,6 +224,7 @@ export default {
periods: 'Detail',
balanceTitle: 'Balance',
empty: 'No stat for this period',
+ emptyDesc: 'Change filter, period or add new transactions.',
customize: {
showHistory: 'Show history',
showRoundCats: 'Show round categories list',
diff --git a/locales/ru-RU.js b/locales/ru-RU.js
index 85cbcec6..5e63d385 100644
--- a/locales/ru-RU.js
+++ b/locales/ru-RU.js
@@ -226,6 +226,7 @@ export default {
balanceTitle: 'Баланс',
periods: 'Общее',
empty: 'Статистики по выбранным параметрам нет :)',
+ emptyDesc: 'Измените фильтр, период или добавьте новую транзакцию.',
customize: {
showHistory: 'Показывать историю',
showRoundCats: 'Показывать список круглых иконок',