Skip to content

Open source personal finance application

chore(Updates): login etc

Ilya Komichev127de2015d1e
diff --git a/assets/css/themes.css b/assets/css/themes.css
index e1608a34..fc7a4634 100644
--- a/assets/css/themes.css
+++ b/assets/css/themes.css
@@ -22,6 +22,8 @@ html.dark {
--foreground-second: 23 23 23;
/* Accent */
+ /* --accent-2: 220 100 61; */
+ --accent-2: 58 125 255;
--accent-default: 56 148 2451;
--accent-primary: 255 255 255;
@@ -55,6 +57,7 @@ html.dark-gray {
--foreground-second: 23 23 23;
/* Accent */
+ --accent-2: 58 125 255;
--accent-default: 10 132 255;
--accent-primary: 255 255 255;
}
@@ -78,6 +81,7 @@ html.light {
--foreground-active: 216 216 220;
/* Accent */
+ --accent-2: 58 125 255;
--accent-default: 0 122 255;
--accent-primary: 255 255 255;
diff --git a/components/shared/copyright/Copyright.vue b/components/common/Copyright.vue
similarity index 60%
rename from components/shared/copyright/Copyright.vue
rename to components/common/Copyright.vue
index 5456d4a7..7792710d 100644
--- a/components/shared/copyright/Copyright.vue
+++ b/components/common/Copyright.vue
@@ -2,14 +2,15 @@
a.flex-center.py-2.px-5.rounded-md.hocus_bg-item-hover.transition(
href="https://ilko.me"
)
- | {{ $t('app.madeBy.text') }}
- .mdi.mdi-heart.mx-2.heart.text-2xl(
+ | {{ $t('madeBy.text') }}
+ .mdi.mdi-heart(
class=`
+ mx-2
+ text-2xl text-[rgb(210,0,20)]
animate-[heartbeat_3s_ease-in-out_infinite]
- text-[rgb(210,0,20)]
`
)
- | {{ $t('app.madeBy.name') }}
+ | {{ $t('madeBy.name') }}
</template>
<style lang="stylus">
@@ -27,3 +28,14 @@ a.flex-center.py-2.px-5.rounded-md.hocus_bg-item-hover.transition(
100%
transform scale(.75)
</style>
+
+<i18n lang="yaml">
+en:
+ madeBy:
+ text: Made with
+ name: by Ilya Komichev
+ru:
+ madeBy:
+ text: Разработал
+ name: Илья Комичев
+ </i18n>
diff --git a/components/layout/Modals.vue b/components/layout/Modals.vue
index d8f849df..1f873f16 100644
--- a/components/layout/Modals.vue
+++ b/components/layout/Modals.vue
@@ -8,10 +8,6 @@
//- Currencies
CurrenciesModal
- //- Loading
- template(v-if="!$store.state.app.status.ready")
- LoaderSharedLoader
-
//- Notifications
Notifications(
:max="2"
diff --git a/components/shared/Spinier.vue b/components/shared/Spinier.vue
deleted file mode 100644
index ccf60583..00000000
--- a/components/shared/Spinier.vue
+++ /dev/null
@@ -1,80 +0,0 @@
-<script>
-// TODO: setup
-export default {
- props: {
- theme: {
- type: String,
- default: 'light',
- },
-
- size: {
- type: String,
- default: 'md',
- },
- },
-
- computed: {
- className() {
- return {
- _dark: this.theme === 'dark',
- [`_size_${this.size}`]: this.size,
- }
- },
- },
-}
-</script>
-
-<template lang="pug">
-.spinner(:class="className")
- .spinner__b._b1
- .spinner__b._b2
- .spinner__b._b3
-</template>
-
-<style lang="stylus" scoped>
-// TODO: style
-@import "~assets/stylus/variables/margins"
-
-.spinner
- display flex
- align-items center
- height 100%
- text-align center
-
- &._hidden
- visibility hidden
-
- &__b
- opacity .8
- display inline-block
- width 18px
- height 18px
- margin-right $m5
- border-radius 100%
- background-color var(--c-bg-10)
- animation sk-bouncedelay 1.3s infinite ease-in-out both
-
- ^[0]._size_lg &
- width 26px
- height 26px
- margin-right $m8
-
- ^[0]._dark &
- opacity 1
- background-color #067ab4
-
- &._b1
- animation-delay -0.32s
-
- &._b2
- animation-delay -0.16s
-
- &._b3
- margin-right 0
-
-@keyframes sk-bouncedelay
- 0%, 80%, 100%
- transform: scale(.2)
- 40%
- transform: scale(1)
-</style>
diff --git a/components/shared/loader/Loader.vue b/components/shared/loader/Loader.vue
deleted file mode 100644
index 73106717..00000000
--- a/components/shared/loader/Loader.vue
+++ /dev/null
@@ -1,38 +0,0 @@
-<script>
-export default {
-}
-</script>
-
-<template lang="pug">
-.loader
- .loader__wrap
- SharedAppName
- .loader__spinier
- SharedSpinier(theme="dark" size="lg")
-</template>
-
-<style lang="stylus" scoped>
-@import '~assets/stylus/variables/margins'
-
-.loader
- z-index 100
- position fixed
- top 0
- left 0
- display flex
- align-items center
- justify-content center
- width 100%
- height 100%
- flex-flow column wrap
- background var(--c-bg-1)
-
- &__wrap
- display flex
- flex-flow column nowrap
- align-items center
-
- &__spinier
- height 48px
- margin-top 40px
-</style>
diff --git a/components/ui/ButtonBlue.vue b/components/ui/ButtonBlue.vue
index f3d3aa9e..f8ab6743 100644
--- a/components/ui/ButtonBlue.vue
+++ b/components/ui/ButtonBlue.vue
@@ -5,11 +5,13 @@ const emit = defineEmits(['click'])
<template lang="pug">
button(
class=`
- cursor-pointer
+ overflow-hidden relative
+ enabled:cursor-pointer
py-3 px-3 w-full
+ min-h-[48px]
text-accent-primary text-center
- bg-accent-default rounded-full
- hocus_bg-accent-default/80
+ bg-accent-2 rounded-full
+ hocus_bg-accent-2/80
transition
`
@click="emit('click')"
diff --git a/components/shared/appName/AppName.vue b/components/ui/Logo.vue
similarity index 52%
rename from components/shared/appName/AppName.vue
rename to components/ui/Logo.vue
index e554e22d..879048f2 100644
--- a/components/shared/appName/AppName.vue
+++ b/components/ui/Logo.vue
@@ -1,10 +1,10 @@
<template lang="pug">
-.pb-8.text-6xl.font-extrabold.font-secondary.tracking-wide.text-gray-600.dark_text-neutral-200.appName.font-nunito.
+.logo.pb-8.text-6xl.font-extrabold.font-secondary.tracking-wide.text-gray-600.dark_text-neutral-200.font-nunito.
{{ $t('appName') }}
</template>
<style lang="stylus" scoped>
-.appName
+.logo
&:first-letter
color var(--c-blue-3)
</style>
diff --git a/components/ui/Spinier.vue b/components/ui/Spinier.vue
new file mode 100644
index 00000000..156a5e9e
--- /dev/null
+++ b/components/ui/Spinier.vue
@@ -0,0 +1,31 @@
+<script setup lang="ts">
+</script>
+
+<template lang="pug">
+.h-full.flex-center
+ .dot._d1
+ .dot._d2
+ .dot._d3
+</template>
+
+<style lang="stylus" scoped>
+.dot
+ animation sk-bouncedelay 1.3s infinite ease-in-out both
+ background-color var(--c-bg-10)
+ @apply size-4 mr-3 rounded-full;
+
+ &._d1
+ animation-delay -0.32s
+
+ &._d2
+ animation-delay -0.16s
+
+ &._d3
+ margin-right 0
+
+@keyframes sk-bouncedelay
+ 0%, 80%, 100%
+ transform: scale(.2)
+ 40%
+ transform: scale(1)
+</style>
diff --git a/components/welcome/page/Welcome.vue b/components/welcome/page/Welcome.vue
index e77eeb62..a4bb23dd 100644
--- a/components/welcome/page/Welcome.vue
+++ b/components/welcome/page/Welcome.vue
@@ -160,7 +160,7 @@ export default {
.firefoxBackdropFix.z-10.w-full.fixed.left-0.bottom-0.backdrop-blur(
class="bg-skin-layout-main/70"
)
- SharedCopyright
+ CommonCopyright
</template>
<style lang="stylus" scoped>
diff --git a/locales/en-US.js b/locales/en-US.js
index da6a983f..467e2a73 100644
--- a/locales/en-US.js
+++ b/locales/en-US.js
@@ -64,10 +64,6 @@ export default {
dark: 'Dark',
light: 'Light',
},
- madeBy: {
- text: 'Made with',
- name: 'by Ilya Komichev',
- },
},
userLogout: 'Logout',
diff --git a/locales/ru-RU.js b/locales/ru-RU.js
index b8c8d2c5..3791d858 100644
--- a/locales/ru-RU.js
+++ b/locales/ru-RU.js
@@ -65,10 +65,6 @@ export default {
dark: 'Темная',
light: 'Светлая',
},
- madeBy: {
- text: 'Разработал',
- name: 'Илья Комичев',
- },
},
userLogout: 'Выход',
diff --git a/pages/login.vue b/pages/login.vue
index 18c7a821..6a1d8cde 100644
--- a/pages/login.vue
+++ b/pages/login.vue
@@ -1,177 +1,79 @@
-<script lang="ts">
+<script setup lang="ts">
import { GoogleAuthProvider, signInWithPopup } from 'firebase/auth'
import { auth } from '~/services/firebase/api'
-export default defineComponent({
- layout: 'login',
+const { $notify } = useNuxtApp()
+const route = useRoute()
+const router = useRouter()
- setup() {
- const route = useRoute()
- const router = useRouter()
+const isLoading = ref(true)
- const isLoading = ref(false)
+if (route.query?.loading)
+ isLoading.value = true
- if (route.query?.loading)
- isLoading.value = true
+function signInWithGoogle() {
+ router.push({ query: { loading: true } })
+ isLoading.value = true
- onMounted(() => {
- if (route.query?.loader) {
- isLoading.value = true
- const newRoute = { ...route }
- delete newRoute.query?.loader
- router.replace(newRoute)
- }
-
- setTimeout(() => isLoading.value = false, 10000)
+ const provider = new GoogleAuthProvider()
+ signInWithPopup(auth, provider)
+ .catch((e) => {
+ $notify({
+ duration: 6000,
+ text: e.message,
+ title: 'Error',
+ type: 'error',
+ })
+ isLoading.value = false
})
+}
- return {
- isLoading,
- }
- },
+onMounted(() => {
+ if (route.query?.loader) {
+ isLoading.value = true
+ const newRoute = { ...route }
+ delete newRoute.query?.loader
+ router.replace(newRoute)
+ }
+
+ setTimeout(() => isLoading.value = false, 10000)
+})
+</script>
+
+<script lang="ts">
+export default defineComponent({
+ layout: 'login',
fetch({ store, redirect }) {
if (store.state.user?.user)
redirect('/')
},
-
- methods: {
- // signInWithEmailLink() {
- // const email = '[email protected]'
- // const actionCodeSettings = {
- // // URL you want to redirect back to. The domain (www.example.com) for this
- // // URL must be in the authorized domains list in the Firebase Console.
- // url: 'https://finapp.ilko.me',
- // handleCodeInApp: true,
- // iOS: {
- // bundleId: 'com.finapp.ilko.me.ios',
- // },
- // android: {
- // packageName: 'com.finapp.ilko.me.android',
- // installApp: true,
- // minimumVersion: '12',
- // },
- // dynamicLinkDomain: 'finapp.ilko.me',
- // }
-
- // sendSignInLinkToEmail(auth, email, actionCodeSettings)
- // .then(() => {
- // window.localStorage.setItem('emailForSignIn', email)
- // })
- // .catch((error) => {
- // const errorCode = error.code
- // const errorMessage = error.message
- // console.log(errorCode, errorMessage)
- // })
- // },
-
- signInWithGoogle() {
- this.$router.push({ query: { loading: true } })
- this.isLoading = true
-
- const provider = new GoogleAuthProvider()
- signInWithPopup(auth, provider)
- .catch(e => this.notifyAboutError(e))
- },
-
- notifyAboutError(e) {
- this.$notify({
- duration: 6000,
- text: e.message,
- title: 'Error',
- type: 'error',
- })
- this.isLoading = false
- },
- },
})
</script>
<template lang="pug">
.grid.h-full.text-center(class="grid-rows-[auto,1fr,auto]")
- //- Top
.max-w-xl.mx-auto.py-4.p-2.w-full.md_p-6
.flex.justify-between
LocaleSwitcher
ThemeSwitcher
- //- Center
.h-full.grid.items-center.gap-8.py-4.px-3.h-full.overflow-hidden.overflow-y-auto
.flex.flex-col.items-center.justify-center.pb-10
- SharedAppName
-
- //- div(@click="signInWithEmailLink") signInWithEmailLink
-
- .flex.flex-col.items-center.px-3.py-8
- .loginButton.bg-blue3.hocus_bg-blue1.hocus_shadow(
- :class="[{ _loading: isLoading }]"
- @click.prevent="signInWithGoogle"
+ UiLogo
+
+ .px-3.py-8.flex.flex-col.items-center(
+ class="min-w-[280px]"
+ )
+ UiButtonBlue(
+ :disabled="isLoading"
+ @click="signInWithGoogle"
)
+ | {{ $t('loginWithGoogle') }}
transition(name="fadeIn")
- .loginButton__spinier(v-if="isLoading"): SharedSpinier
- .loginButton__text.text-white {{ $t('loginWithGoogle') }}
+ .absolute.inset-0.w-full.h-full.flex-center.bg-accent-2(v-if="isLoading")
+ UiSpinier
.p-4.md_p-6
- SharedCopyright
+ CommonCopyright
</template>
-
-<style lang="stylus" scoped>
-.tab
- overflow-x hidden
- overflow-y scroll
- position relative
- display grid
- grid-template-rows auto 1fr auto
- scrollbar()
- width 100%
- height 100%
- max-width 1000px
- margin 0 auto
-
- +media(600px)
- grid-template-rows auto auto auto
-
- &__content
- display flex
- align-items center
- justify-content center
- flex-flow column
-
-.linkItem
- text-decoration none
-
- +media-hover()
- &:not(._active)
- cursor pointer
-
-.loginButton
- overflow hidden
- cursor pointer
- position relative
- min-width 260px
- padding $m7 $mb1
- font-size 16px
- text-align center
- border-radius 36px
- anim()
-
- &._loading
- pointer-events none
- cursor default
-
- &__text
- anim()
-
- ^[0]._loading &
- opacity 0
-
- &__spinier
- position absolute
- top 0
- left 0
- display flex
- align-items center
- justify-content center
- width 100%
- height 100%
-</style>
diff --git a/tailwind.config.js b/tailwind.config.js
index 1bd6674c..d0519679 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -18,6 +18,7 @@ module.exports = {
main: 'rgb(var(--bg-main))',
accent: {
default: 'rgb(var(--accent-default))',
+ 2: 'rgb(var(--accent-2))',
primary: 'rgb(var(--accent-primary))',
},
foreground: {
@@ -98,5 +99,15 @@ module.exports = {
plugin(({ addVariant }) => {
addVariant('hocus', ['.mouse &:not(._active):hover', '&:not(._active):active'])
}),
+ plugin(({ matchUtilities, theme }) => {
+ matchUtilities({
+ size: value => ({
+ width: value,
+ height: value,
+ }),
+ }, {
+ values: theme('width'),
+ })
+ }),
],
}