Skip to content

Open source personal finance application

update: welcome, wallets, categories

Ilya Komicheva9c412ed71c6
diff --git a/.vscode/settings.json b/.vscode/settings.json
deleted file mode 100644
index 86eefae2..00000000
--- a/.vscode/settings.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "prettier.enable": false,
- "editor.codeActionsOnSave": {
- "source.fixAll.eslint": true
- },
- "editor.formatOnSave": false
-}
diff --git a/components/about/About.vue b/components/about/About.vue
index f7401e6e..a350ca79 100644
--- a/components/about/About.vue
+++ b/components/about/About.vue
@@ -13,6 +13,7 @@ div
</template>
<style lang="stylus" scoped>
+// TODO: use Ui components
.title
font-h1()
font-size 18px
diff --git a/components/categories/Delete.vue b/components/categories/Delete.vue
index e7f19d88..51e51464 100644
--- a/components/categories/Delete.vue
+++ b/components/categories/Delete.vue
@@ -57,7 +57,7 @@ async function onDeleteConfirm() {
// Give some time to complete redirect
setTimeout(async () => {
- await this.$store.dispatch('trns/deleteTrnsByIds', trnsIdsS)
+ await $store.dispatch('trns/deleteTrnsByIds', trnsIdsS)
removeData(`users/${uid}/categories/${categoryIdS}`)
.then(() => {
$notify({
diff --git a/components/categories/page/List.vue b/components/categories/page/List.vue
index 45ce61eb..6539c430 100644
--- a/components/categories/page/List.vue
+++ b/components/categories/page/List.vue
@@ -1,15 +1,9 @@
<script setup lang="ts">
-const { $store } = useNuxtApp()
+const { $store, nuxt2Context: { i18n } } = useNuxtApp()
const categoriesRootIds = computed(() => $store.getters['categories/categoriesRootIds'])
-</script>
-<script lang="ts">
-export default defineComponent({
- head() {
- return {
- title: this.$t('categories.title'),
- }
- },
+useHead({
+ title: i18n.t('categories.title'),
})
</script>
diff --git a/components/categories/page/id/Edit.vue b/components/categories/page/id/Edit.vue
index 37311228..1a67a52e 100644
--- a/components/categories/page/id/Edit.vue
+++ b/components/categories/page/id/Edit.vue
@@ -3,7 +3,7 @@ import type { CategoryId, CategoryItem } from '~/components/categories/types'
import { getPreparedFormData } from '~/components/categories/getForm'
import { getParentCategory } from '~/components/categories/getCategories'
-const { $store } = useNuxtApp()
+const { $store, nuxt2Context: { i18n } } = useNuxtApp()
const router = useRouter()
const route = useRoute()
@@ -15,15 +15,12 @@ const parentCategory = computed(() =>
const updateValue = (id, value) => categoryForm.value[id] = value
const afterSave = () => router.replace(`/categories/${categoryId.value}`)
-</script>
-<script lang="ts">
-export default defineComponent({
- head() {
- return {
- title: `${this.$t('base.edit')}: ${this.categoryForm.name ? this.categoryForm.name : this.$t('wallets.form.name.label')}`,
- }
- },
+useHead({
+ title: `${i18n.t('base.edit')}:
+ ${categoryForm.value?.name
+ ? categoryForm.value?.name
+ : i18n.t('categories.form.name.label')}`,
})
</script>
diff --git a/components/categories/page/id/Index.vue b/components/categories/page/id/Index.vue
index f1cee7c7..203a427b 100644
--- a/components/categories/page/id/Index.vue
+++ b/components/categories/page/id/Index.vue
@@ -2,7 +2,7 @@
import { getTrnsIds } from '~/components/trns/getTrns'
import useFilter from '~/components/filter/useFilter'
-const { $store } = useNuxtApp()
+const { $store, nuxt2Context: { i18n } } = useNuxtApp()
const { setFilterCatsId } = useFilter()
const route = useRoute()
@@ -37,6 +37,11 @@ function handleSetFilterCategory() {
}
const onClickEdit = () => router.push(`/categories/${categoryId.value}/edit`)
+
+useHead({
+ // title: `${category.value.name} / ${i18n.t('categories.title')}`,
+ title: category.value.name,
+})
</script>
<template lang="pug">
diff --git a/components/wallets/Delete.vue b/components/wallets/Delete.vue
index 5f6996da..6dba016d 100644
--- a/components/wallets/Delete.vue
+++ b/components/wallets/Delete.vue
@@ -43,7 +43,7 @@ async function onDeleteConfirm() {
// Give some time to complete redirect
setTimeout(async () => {
- await this.$store.dispatch('trns/deleteTrnsByIds', trnsIdsS)
+ await $store.dispatch('trns/deleteTrnsByIds', trnsIdsS)
removeData(`users/${uid}/accounts/${walletIdS}`)
.then(() => {
$notify({
diff --git a/components/welcome/CategoryForm.vue b/components/welcome/CategoryForm.vue
index b9d0efa1..8140b9a5 100644
--- a/components/welcome/CategoryForm.vue
+++ b/components/welcome/CategoryForm.vue
@@ -3,7 +3,7 @@ import { getPreparedFormData } from '~/components/categories/getForm'
import { getParentCategory } from '~/components/categories/getCategories'
const emit = defineEmits(['afterSave'])
-const { $store } = useNuxtApp()
+const { $store, nuxt2Context: { i18n } } = useNuxtApp()
const categoryForm = ref(getPreparedFormData())
const parentCategory = computed(() =>
@@ -11,15 +11,12 @@ const parentCategory = computed(() =>
const updateValue = (id, value) => categoryForm.value[id] = value
const afterSave = () => emit('afterSave')
-</script>
-<script lang="ts">
-export default defineComponent({
- head() {
- return {
- title: `${this.$t('base.add')}: ${this.categoryForm.name ? this.categoryForm.name : this.$t('categories.form.name.label')}`,
- }
- },
+useHead({
+ title: () => `${i18n.t('base.add')}:
+ ${categoryForm.value?.name
+ ? categoryForm.value?.name
+ : i18n.t('categories.form.name.label')}`,
})
</script>
diff --git a/components/welcome/WalletForm.vue b/components/welcome/WalletForm.vue
index 453c492c..ba896642 100644
--- a/components/welcome/WalletForm.vue
+++ b/components/welcome/WalletForm.vue
@@ -5,12 +5,14 @@ import type { WalletForm } from '~/components/wallets/types'
const emit = defineEmits(['afterSave'])
+const { $store, nuxt2Context: { i18n } } = useNuxtApp()
+
const walletForm = ref<WalletForm>({
color: random(random(allColors)),
countTotal: true,
currency: 'USD',
isCredit: false,
- name: null,
+ name: '',
order: 1,
})
@@ -21,15 +23,12 @@ function updateValue(id, value) {
function afterSave() {
emit('afterSave')
}
-</script>
-<script lang="ts">
-export default defineComponent({
- head() {
- return {
- title: `${this.$t('base.add')}: ${this.wallet?.name}`,
- }
- },
+useHead({
+ title: () => `${i18n.t('base.add')}:
+ ${walletForm.value?.name
+ ? walletForm.value?.name
+ : i18n.t('categories.form.name.label')}`,
})
</script>
diff --git a/components/welcome/page/Welcome.vue b/components/welcome/page/Welcome.vue
index a4bb23dd..3c6deadd 100644
--- a/components/welcome/page/Welcome.vue
+++ b/components/welcome/page/Welcome.vue
@@ -111,24 +111,16 @@ export default {
.options
.options__item
.options__desc {{ $t('welcome.create.text') }}
- SharedButton._blue2._center(
- :title="$t('welcome.create.btn')"
- @onClick="step = 3"
+ SharedButton._center._blue2(
+ v-if="!$store.getters['wallets/hasWallets']"
+ :title="$t('wallets.createNewTitle')"
+ @onClick="() => { step = 3; showWalletForm = true; }"
+ )
+ SharedButton._center._blue2(
+ v-if="$store.getters['wallets/hasWallets']"
+ :title="$t('categories.createNewTitle')"
+ @onClick="() => { step = 3; showCategoryForm = true; }"
)
-
- //- Wallet
- transition(name="fadeIn")
- template(v-if="(step !== 1 && step !== 2) && !showWalletForm && !$store.getters['wallets/hasWallets']")
- .tab
- .tab__content
- .tab__wrap
- .header
- .header__title {{ $t('appName') }}
- .options__desc {{ $t('welcome.createFirstWallet.text') }}
- SharedButton._center._blue2(
- :title="$t('welcome.createFirstWallet.btn')"
- @onClick="showWalletForm = true"
- )
//- Wallet form
transition(name="fadeIn")
@@ -164,12 +156,6 @@ export default {
</template>
<style lang="stylus" scoped>
-.firefoxBackdropFix
- @supports (not (-webkit-backdrop-filter: none)) and (not (backdrop-filter: none))
- background theme('colors.dark3') !important
- /.light &
- background theme('colors.white') !important
-
.tabs
overflow hidden
position absolute
@@ -255,7 +241,7 @@ export default {
background var(--c-bg-6)
&__desc
- padding-bottom $m7
+ @apply pb-6;
color var(--c-font-4)
line-height 20px
text-align center
diff --git a/layouts/default.vue b/layouts/default.vue
index 27b05b47..2a9176b9 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -53,6 +53,12 @@ onMounted(() => {
getPageDimensions()
window.addEventListener('resize', debounce(getPageDimensions, 300))
})
+
+useHead({
+ titleTemplate: (titleChunk) => {
+ return titleChunk ? `${titleChunk} - Finapp` : 'Finapp'
+ },
+})
</script>
<template lang="pug">
@@ -87,12 +93,6 @@ div(:class="classes")
<style lang="stylus">
@import '~assets/stylus/index'
-.firefoxBackdropFix
- @supports (not (-webkit-backdrop-filter: none)) and (not (backdrop-filter: none))
- background theme('colors.dark3') !important
- /.light &
- background theme('colors.white') !important
-
.createTrn
cursor pointer
align-items flex-end
diff --git a/layouts/welcome.vue b/layouts/welcome.vue
index 803ca44c..987b3cb3 100644
--- a/layouts/welcome.vue
+++ b/layouts/welcome.vue
@@ -10,8 +10,6 @@ useLazyAsyncData('posts', async () => {
await initUI()
})
-const keepAliveInclude = ['PagesIndex, PagesWallets', 'PagesCategories', 'PagesHistory']
-
// TODO: Put in one separate setup function
const { pointerType } = usePointer()
const classes = computed(() => [
@@ -52,51 +50,7 @@ div(:class="classes")
name="modal"
)
- .layout__wrap.overflow-hidden.flex-grow.h-full.flex
+ .overflow-hidden.flex-grow.h-full.flex
transition(name="fadeIn" appear)
- Nuxt(
- keep-alive
- :keep-alive-props="{ include: keepAliveInclude }"
- )
+ Nuxt
</template>
-
-<style lang="stylus">
-@import '~assets/stylus/base/animations'
-@import '~assets/stylus/index'
-</style>
-
-<style lang="stylus" scoped>
-.layout
- &__wrap
- grid-template-columns 1fr
- grid-template-rows 1fr minmax(auto, auto)
-
- +media(1200px)
- grid-template-rows 1fr auto
- grid-template-columns minmax(auto, auto) 1fr
-
- &__sidebar
- display none
-
- +media(1200px)
- display block
-
- &__content
- overflow hidden
- overflowScrollY()
- display grid
- height 100%
- max-width 1100px
- padding 0
- background var(--c-bg-3)
- +media(800px)
- padding 0 32px
- +media(1000px)
- padding 0 64px
-
- &__menu
- background var(--c-bg-3)
-
- +media(1200px)
- display none
-</style>
diff --git a/locales/en-US.js b/locales/en-US.js
index 467e2a73..c46825c9 100644
--- a/locales/en-US.js
+++ b/locales/en-US.js
@@ -98,15 +98,11 @@ export default {
btn: 'Start',
},
create: {
- text: 'Start creating your own wallets, categories',
+ text: 'Start creating your first wallet and category',
btn: 'Let\'s go',
},
- createFirstWallet: {
- text: 'Let\'s start with create first Wallet',
- btn: 'Create wallet',
- },
createFirstCategory: {
- text: 'Great! Now Let\'s create first category',
+ text: 'Great! Now let\'s create a category',
btn: 'Create category',
},
},
@@ -128,7 +124,7 @@ export default {
showAll: 'Show all wallets',
showOnly: 'Show only',
sortTitle: 'Sort wallets',
- createNewTitle: 'Create wallet',
+ createNewTitle: 'Add wallet',
editTitle: 'Edit Wallet',
form: {
name: {
@@ -172,7 +168,7 @@ export default {
allTitle: 'All',
lastUsedTitle: 'Recent',
favoriteTitle: 'Favorite',
- createNewTitle: 'Create category',
+ createNewTitle: 'Add category',
editTitle: 'Edit category',
form: {
name: {
@@ -306,7 +302,7 @@ export default {
buttons: {
nextTitle: 'Next',
prevTitle: 'Prev',
- nextStep: 'Next step',
+ nextStep: 'Continue',
},
users: {
diff --git a/locales/ru-RU.js b/locales/ru-RU.js
index 3791d858..13a49524 100644
--- a/locales/ru-RU.js
+++ b/locales/ru-RU.js
@@ -99,13 +99,9 @@ export default {
btn: 'Начать',
},
create: {
- text: 'Начнем с создания первого кошелька и категории',
+ text: 'Начнем с добавления кошелька и категории',
btn: 'Погнали',
},
- createFirstWallet: {
- text: 'Создадим первый кошелек',
- btn: 'Создать',
- },
createFirstCategory: {
text: 'Отлично! Теперь создадим категорию',
btn: 'Создать',
@@ -129,7 +125,7 @@ export default {
showAll: 'Показать все кошельки',
showOnly: 'Показать только',
sortTitle: 'Сортировать кошельки',
- createNewTitle: 'Создание кошелька',
+ createNewTitle: 'Добавить кошелек',
editTitle: 'Редактирование кошелька',
form: {
name: {
@@ -173,7 +169,7 @@ export default {
allTitle: 'Все',
lastUsedTitle: 'Недавние',
favoriteTitle: 'Любимые',
- createNewTitle: 'Создание категории',
+ createNewTitle: 'Добавить категорию',
editTitle: 'Редактирование категории',
form: {
name: {