Skip to content

Open source personal finance application

chore: refactor

ilkome823a280214f4
diff --git a/components/modal/ModalButton.vue b/components/modal/ModalButton.vue
index 295fdba8..9dbd5ddb 100644
--- a/components/modal/ModalButton.vue
+++ b/components/modal/ModalButton.vue
@@ -1,41 +1,32 @@
<script>
export default {
props: {
- icon: {
- type: String,
- required: true
- },
- name: {
- type: String,
- required: true
- },
- isActive: {
- type: Boolean,
- default: false
- }
+ icon: { type: String, required: true },
+ name: { type: String, required: true },
+ isActive: { type: Boolean, default: false }
}
}
</script>
<template lang="pug">
-.button-link(
+.modalButton(
:class="{ _active: isActive }"
@click="$emit('onClick')"
)
- .button-link__icon(v-if="$slots.icon")
+ .modalButton__icon(v-if="$slots.icon")
slot(name="icon")
template(v-if="!$slots.icon && icon")
- .button-link__icon: div(:class="icon")
+ .modalButton__icon: div(:class="icon")
- .button-link__name {{ name }}
+ .modalButton__name {{ name }}
</template>
<style lang="stylus" scoped>
@import '~assets/stylus/variables'
-.button-link
+.modalButton
cursor pointer
display flex
align-items center
diff --git a/components/stat/Dashboard.vue b/components/stat/Dashboard.vue
index 8ef8912b..4c10c968 100644
--- a/components/stat/Dashboard.vue
+++ b/components/stat/Dashboard.vue
@@ -287,6 +287,7 @@ export default {
:title="$t('dates.day.today')"
)
+ //- Views
.total__custom(v-if="statCurrentPeriod[item.id].total !== 0")
.periodItem(
:class="{ _active: ui.showPieChart }"
@@ -324,10 +325,10 @@ export default {
)
//- Round cats list
- .statItemsTiles(v-if="ui.showRoundCats && statWithLastPeriods[item.id].categoriesIds.length > 0 && (!filter.categoryId || filter.categoryId && $store.getters['categories/getChildCategoriesIds'](filter.categoryId).length !== 0)")
+ .statItemsTiles(v-if="ui.showRoundCats && (!filter.categoryId || filter.categoryId && $store.getters['categories/getChildCategoriesIds'](filter.categoryId).length !== 0)")
LazyStatItemRound(
- v-if="ui.showRoundCats && statWithLastPeriods[item.id].categoriesIds.length > 0"
- v-for="categoryId in statWithLastPeriods[item.id].categoriesIds"
+ v-if="ui.showRoundCats"
+ v-for="categoryId in statCurrentPeriod[item.id].categoriesIds"
:category="$store.state.categories.items[categoryId]"
:categoryId="categoryId"
:currency="$store.state.currencies.base"
@@ -337,7 +338,7 @@ export default {
)
template(v-if="filter.categoryId")
template(v-for="categoryId in $store.getters['categories/getChildCategoriesIds'](filter.categoryId)")
- template(v-if="!statWithLastPeriods[item.id].categoriesIds.includes(categoryId)")
+ template(v-if="!statCurrentPeriod[item.id].categoriesIds.includes(categoryId)")
LazyStatItemRound(
v-if="filter.categoryId"
:category="$store.state.categories.items[categoryId]"
diff --git a/modules/stat/useStat.ts b/modules/stat/useStat.ts
index 7617fb6e..05e6f556 100644
--- a/modules/stat/useStat.ts
+++ b/modules/stat/useStat.ts
@@ -10,7 +10,13 @@ const moneyTypes = [{
export default function useStat () {
const { store } = useContext()
- const isEmptyStat = computed(() => store.getters['stat/statAverage'].total === 0 && store.getters['stat/statAverage'].incomes === 0 && store.getters['stat/statAverage'].expenses === 0)
+ const isEmptyStat = computed(() => {
+ const total = store.getters['stat/statAverage'].total === 0
+ const incomes = store.getters['stat/statAverage'].incomes === 0
+ const expenses = store.getters['stat/statAverage'].expenses === 0
+
+ return total && incomes && expenses
+ })
return {
moneyTypes,
diff --git a/store/stat/getters.js b/store/stat/getters.js
index d25a5809..c4245bab 100644
--- a/store/stat/getters.js
+++ b/store/stat/getters.js
@@ -9,7 +9,7 @@ export default {
* @return {Number} return[date].expenses
* @return {Number} return[date].total
*/
- statAverage (state, getters) {
+ statAverage (_state, getters) {
const statPeriods = getters.statByPeriods
let incomes = 0
@@ -51,7 +51,7 @@ export default {
* @return {Number} return[date].expenses
* @return {Number} return[date].total
*/
- statByPeriods (state, getters, rootState, rootGetters) {
+ statByPeriods (_state, _getters, rootState, rootGetters) {
const trns = rootState.trns.items
const transferCategoryId = rootGetters['categories/transferCategoryId']
const trnsIds = rootGetters['trns/selectedTrnsIds']