Update layout

This commit is contained in:
2022-10-30 11:28:50 +01:00
parent 91a24e7db2
commit a79200383a
8 changed files with 51 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
<template> <template>
<v-footer app> <v-footer app dark>
<v-row justify="center" no-gutters> <v-row justify="center" no-gutters>
<v-col cols="12" class="text-center"> <v-col cols="12" class="text-center">
<span class="text-caption">&copy; {{ new Date().getFullYear() }}</span> <span class="text-caption">&copy; {{ new Date().getFullYear() }}</span>

View File

@@ -1,5 +1,5 @@
<template> <template>
<v-navigation-drawer v-if="$store.state.user" app clipped :mini-variant="miniVariant"> <v-navigation-drawer v-if="$store.state.user" app dark clipped :mini-variant="miniVariant">
<v-list> <v-list>
<v-list-item link class="px-2" @click="gotoProfilePage"> <v-list-item link class="px-2" @click="gotoProfilePage">
<v-list-item-avatar> <v-list-item-avatar>

View File

@@ -1,13 +1,15 @@
<template> <template>
<v-app dark> <v-app :style="{ background: $vuetify.theme.themes[theme].background }">
<NavigationDrawer ref="navDrawer" /> <NavigationDrawer ref="navDrawer" />
<v-app-bar app clipped-left> <v-app-bar app dark clipped-left>
<v-app-bar-nav-icon @click="toggleNavDrawer" /> <v-app-bar-nav-icon @click="toggleNavDrawer" />
<v-toolbar-title v-text="title" /> <v-toolbar-title v-text="title" />
<v-spacer /> <v-spacer />
<!-- TODO: Enable theme switching some time maybe
<v-btn icon @click="$vuetify.theme.dark = !$vuetify.theme.dark"> <v-btn icon @click="$vuetify.theme.dark = !$vuetify.theme.dark">
<v-icon>mdi-theme-light-dark</v-icon> <v-icon>mdi-theme-light-dark</v-icon>
</v-btn> </v-btn>
-->
<v-btn v-if="loggedIn" icon @click="logout"> <v-btn v-if="loggedIn" icon @click="logout">
<v-icon>mdi-logout-variant</v-icon> <v-icon>mdi-logout-variant</v-icon>
</v-btn> </v-btn>
@@ -32,6 +34,9 @@ export default {
} }
}, },
computed: { computed: {
theme () {
return (this.$vuetify.theme.dark) ? 'dark' : 'light'
},
loggedIn () { loggedIn () {
return this.$store.state.user return this.$store.state.user
} }

View File

@@ -1,5 +1,5 @@
<template> <template>
<v-app> <v-app :style="{ background: $vuetify.theme.themes[theme].background }">
<v-main> <v-main>
<Nuxt /> <Nuxt />
</v-main> </v-main>
@@ -11,6 +11,11 @@
<script> <script>
export default { export default {
name: 'EmptyLayout', name: 'EmptyLayout',
layout: 'empty' layout: 'empty',
computed: {
theme () {
return (this.$vuetify.theme.dark) ? 'dark' : 'light'
}
}
} }
</script> </script>

View File

@@ -1,5 +1,5 @@
<template> <template>
<v-app dark> <v-app :style="{ background: $vuetify.theme.themes[theme].background }">
<h1 v-if="error.statusCode === 404"> <h1 v-if="error.statusCode === 404">
{{ pageNotFound }} {{ pageNotFound }}
</h1> </h1>
@@ -27,6 +27,7 @@ export default {
otherError: 'An error occurred', otherError: 'An error occurred',
} }
}, },
head() { head() {
const title = const title =
this.error.statusCode === 404 ? this.pageNotFound : this.otherError this.error.statusCode === 404 ? this.pageNotFound : this.otherError
@@ -34,6 +35,11 @@ export default {
title, title,
} }
}, },
computed: {
theme () {
return (this.$vuetify.theme.dark) ? 'dark' : 'light'
}
}
} }
</script> </script>

View File

@@ -1,5 +1,5 @@
<template> <template>
<v-app> <v-app :style="{ background: $vuetify.theme.themes[theme].background }">
<v-main> <v-main>
<v-container fill-height> <v-container fill-height>
<v-card max-width="500px" class="mx-auto"> <v-card max-width="500px" class="mx-auto">
@@ -35,6 +35,9 @@ export default {
} }
}, },
computed: { computed: {
theme () {
return (this.$vuetify.theme.dark) ? 'dark' : 'light'
},
userEmail () { userEmail () {
return this.$auth.currentUser.email return this.$auth.currentUser.email
} }

View File

@@ -80,6 +80,7 @@ export default {
info: colors.blue.base, info: colors.blue.base,
success: colors.green.base, success: colors.green.base,
warning: colors.orange.darken1, warning: colors.orange.darken1,
background: '#f1f2f6' // same as MyCampus
}, },
dark: { dark: {
// Vuetify default dark theme colors // Vuetify default dark theme colors

View File

@@ -1,9 +1,22 @@
<template> <template>
<v-container> <v-container fluid>
<v-row> <v-row>
<v-col v-for="course, id in courses" :key="id"> <v-col v-for="(course, id) in courses" :key="id" cols="12" lg="6">
<v-card :width="vCardSize" :height="vCardSize" align="center" justify="center" @click="openCourse(id)"> <v-card flat width="100%" class="rounded-lg" @click="openCourse(id)">
{{ id.toUpperCase() }} - {{ course.name }} <v-row no-gutters class="flex-nowrap">
<v-col cols="auto">
<v-img
src="https://www.onlinecollegeplan.com/wp-content/uploads/2018/05/computer-programming.jpg"
:width="imgSize"
:height="imgSize"
class="rounded-l-lg"
></v-img>
</v-col>
<v-col cols="auto">
<v-card-title class="text--secondary text-subtitle-1">{{ id.toUpperCase() }}</v-card-title>
<v-card-subtitle class="text--primary text-h6 text-wrap">{{ course.name }}</v-card-subtitle>
</v-col>
</v-row>
</v-card> </v-card>
</v-col> </v-col>
</v-row> </v-row>
@@ -13,16 +26,20 @@
<script> <script>
import _cloneDeep from 'lodash-es/cloneDeep' import _cloneDeep from 'lodash-es/cloneDeep'
import { collection, getDocs } from 'firebase/firestore' import { collection, getDocs } from 'firebase/firestore'
import { demoAccounts } from '~/components/DemoInfoDialog.vue'
export default { export default {
name: 'DashboardPage', name: 'DashboardPage',
layout ({ $auth }) { layout ({ $auth }) {
// Ref: https://firebase.google.com/docs/reference/js/v8/firebase.auth.Auth#currentuser // Ref: https://firebase.google.com/docs/reference/js/v8/firebase.auth.Auth#currentuser
return $auth.currentUser.emailVerified ? 'default' : 'unverified' // return $auth.currentUser.emailVerified ? 'default' : 'unverified'
// TODO: For demo purposes only. Delete in production.
return $auth.currentUser.emailVerified || demoAccounts.includes($auth.currentUser.email) ? 'default' : 'unverified'
}, },
data () { data () {
return { return {
vCardSize: 150 imgSize: 125
} }
}, },
computed: { computed: {