Skip to content

Commit

Permalink
feat: log in button
Browse files Browse the repository at this point in the history
asqarslanov committed Jul 22, 2024
1 parent c9c433b commit 1392ce6
Showing 4 changed files with 34 additions and 15 deletions.
4 changes: 3 additions & 1 deletion layouts/default.vue
Original file line number Diff line number Diff line change
@@ -2,10 +2,12 @@
import Header from '~/components/widgets/Header.vue'
import { TEAM_MEMBERS as teamMembers } from '~/constants/teamMembers'
const store = useStore()
const attrs = useAttrs()
const back = attrs.back !== undefined ? (attrs.back as boolean) : true
const email = attrs.email !== undefined ? (attrs.email as string) : ''
const email = store.email || ''
useHead({
meta: [
27 changes: 23 additions & 4 deletions pages/about.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<script lang="ts" setup>
import { useRouter } from 'vue-router'
import Logo from '~/components/shared/Logo/Logo.vue'
import Member from '~/components/shared/Member.vue'
import { TEAM_MEMBERS as teamMembers } from '~/constants/teamMembers'
const router = useRouter()
const store = useStore()
useHead({
title: 'Elect.Gen - Project contributors',
@@ -18,17 +17,25 @@ function configClick() {
navigateTo('/config')
}
function signIn(): void {
navigateTo('/login')
}
function distributeClick() {
navigateTo('/distribute')
}
</script>

<template>
<div class="flex flex-col gap-8">
<header class="h-15 grid w-full grid-cols-3 items-center px-44">
<header class="flex h-16 w-full grid-cols-3 items-end justify-between px-44">
<a class="h-20 w-40 p-4" href="https://innopolis.university/">
<Logo />
</a>

<span>
{{ store.email }}
</span>
</header>
<main class="flex flex-col p-6 desktop:mx-8 desktop:flex-row">
<div class="flex w-full flex-col gap-8 pr-8 desktop:w-1/3">
@@ -69,11 +76,23 @@ function distributeClick() {
</div>
</div>
<div class="flex w-full flex-col items-center justify-center gap-16 desktop:w-2/3">
<div class="flex w-max flex-col items-center gap-4 text-center">
<div
class="flex w-max flex-col items-center gap-4 text-center"
v-if="store.email?.endsWith('innopolis.ru')"
>
<h2 class="text-3xl font-semibold">Select an action</h2>
<UButton class="w-32 justify-center" @click="configClick">Configure</UButton>
<UButton class="w-32 justify-center" @click="distributeClick">Distribute</UButton>
</div>
<div class="flex flex-col items-center gap-4 font-semibold" v-else>
<span>Log in to your account</span>
<UButton
class="h-12 w-36 justify-center rounded-xl text-2xl font-semibold"
@click="signIn"
>
Sign in
</UButton>
</div>
<div class="flex flex-col items-center gap-4">
<h2 class="text-3xl font-semibold">Authors</h2>
<div class="flex w-full flex-row justify-center">
8 changes: 1 addition & 7 deletions pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
<script lang="ts" setup>
const email = useState('email')
await callOnce(async () => {
email.value = 'a.potyomckin@innopolis.ru'
})
const localePath = useLocalePath()
navigateTo(localePath('/about'))
navigateTo('/about')
</script>
10 changes: 7 additions & 3 deletions pages/login.vue
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ import { ref } from 'vue'
import { useRouter } from 'vue-router'
import Logo from '~/components/shared/Logo/Logo.vue'
const store = useStore()
const showPassword = ref(false)
const email = ref('')
@@ -13,11 +15,13 @@ const togglePasswordVisibility = () => {
const router = useRouter()
function navigateToStatistics() {
if (email.value === 'a.potyomckin@innopolis.ru' || email.value.includes('@innopolis.ru')) {
router.push('/distribute')
} else if (email.value.includes('@innopolis.university')) {
store.email = email.value
if (email.value.endsWith('@innopolis.ru')) {
router.push('/')
} else if (email.value.endsWith('@innopolis.university')) {
router.push('/form')
} else {
store.email = undefined
alert('Your email is not in the system')
console.log('invalid')
}

0 comments on commit 1392ce6

Please sign in to comment.