VBV-85: Update Navigation

This commit is contained in:
Daniel Egger 2022-06-30 17:25:53 +02:00
parent e228feb237
commit 988dd7c0de
8 changed files with 113 additions and 50 deletions

View File

@ -1,7 +1,8 @@
<template> <template>
<div id="app"> <div id="app" class="flex flex-col min-h-screen">
<MainNavigationBar /> <MainNavigationBar class="flex-none" />
<RouterView /> <RouterView class="flex-auto" />
<Footer class="flex-none" />
</div> </div>
</template> </template>
@ -9,6 +10,7 @@
import * as log from 'loglevel'; import * as log from 'loglevel';
import MainNavigationBar from '@/components/MainNavigationBar.vue'; import MainNavigationBar from '@/components/MainNavigationBar.vue';
import Footer from '@/components/Footer.vue';
log.debug('App created'); log.debug('App created');
</script> </script>

View File

@ -0,0 +1,21 @@
<script setup lang="ts">
import * as log from 'loglevel';
log.debug('Footer created');
</script>
<template>
<footer
class="
px-8
py-4
bg-gray-100
border-t border-gray-500
">
@2022 VBV
</footer>
</template>
<style scoped>
</style>

View File

@ -26,6 +26,18 @@ function menuActive(checkPath) {
return route.path.startsWith(checkPath); return route.path.startsWith(checkPath);
} }
function inLearningPath() {
return route.path.startsWith('/learningpath/') || route.path.startsWith('/circle/');
}
function backButtonUrl() {
if (route.path.startsWith('/circle/')) {
return '/learningpath/versicherungsvermittlerin';
}
return '/';
}
</script> </script>
<template> <template>
@ -59,12 +71,13 @@ function menuActive(checkPath) {
<button <button
type="button" type="button"
class=" class="
w-8
text-white text-white
hover:text-sky-500 hover:text-sky-500
focus:outline-none focus:text-sky-500 focus:outline-none focus:text-sky-500
" "
> >
<it-icon-menu class="h-8 w-10"/> <it-icon-menu class="h-8 w-8"/>
</button> </button>
</div> </div>
</div> </div>
@ -81,22 +94,35 @@ function menuActive(checkPath) {
" "
> >
<router-link <router-link
to="/dashboard" v-if="userStore.loggedIn && !inLearningPath()"
to="/"
class="nav-item" class="nav-item"
:class="{'nav-item--active': menuActive('/dashboard')}" :class="{'nav-item--active': route.path === '/'}"
> >
Dashboard Cockpit
</router-link> </router-link>
<router-link <router-link
v-if="userStore.loggedIn && !inLearningPath()"
to="/shop" to="/shop"
class="nav-item" class="nav-item"
:class="{'nav-item--active': menuActive('/shop')}" :class="{'nav-item--active': menuActive('/shop')}"
> >
Shop Shop
</router-link> </router-link>
<router-link
v-if="userStore.loggedIn && inLearningPath()"
to="/learningpath/versicherungsvermittlerin"
class="nav-item"
:class="{'nav-item--active': menuActive('/learningpath/')}"
>
Lernpfad
</router-link>
<hr class="text-white lg:hidden"> <hr class="text-white lg:hidden">
<div class="hidden lg:list-item flex-auto"></div> <div class="hidden lg:list-item flex-auto"></div>
<router-link <router-link
v-if="userStore.loggedIn"
to="/mediacenter" to="/mediacenter"
class="nav-item" class="nav-item"
:class="{'nav-item--active': menuActive('/mediacenter')}" :class="{'nav-item--active': menuActive('/mediacenter')}"
@ -104,6 +130,7 @@ function menuActive(checkPath) {
Mediathek Mediathek
</router-link> </router-link>
<router-link <router-link
v-if="userStore.loggedIn"
to="/messages" to="/messages"
class="nav-item flex flex-row items-center" class="nav-item flex flex-row items-center"
> >

View File

@ -1,5 +1,5 @@
import {createRouter, createWebHistory} from 'vue-router' import {createRouter, createWebHistory} from 'vue-router'
import HomeView from '@/views/HomeView.vue'; import CockpitView from '@/views/CockpitView.vue';
import LoginView from '@/views/LoginView.vue'; import LoginView from '@/views/LoginView.vue';
import {redirectToLoginIfRequired, updateLoggedIn} from '@/router/guards'; import {redirectToLoginIfRequired, updateLoggedIn} from '@/router/guards';
@ -7,24 +7,17 @@ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHistory(import.meta.env.BASE_URL),
routes: [ routes: [
{ {
path: '/', path: '/login',
name: 'home', component: LoginView,
component: HomeView,
meta: { meta: {
// no login required -> so `public === true` // no login required -> so `public === true`
public: true public: true
} }
}, },
{ {
path: '/login', path: '/',
component: LoginView, name: 'home',
meta: { component: CockpitView,
public: true
}
},
{
path: '/dashboard',
component: () => import('@/views/DashboardView.vue'),
}, },
{ {
path: '/shop', path: '/shop',

View File

@ -0,0 +1,31 @@
<script setup lang="ts">
import * as log from 'loglevel';
import {useUserStore} from '@/stores/user';
log.debug('CockpitView created');
const userStore = useUserStore();
</script>
<template>
<main class="px-8 py-8 lg:px-12 lg:py-12 bg-gray-100">
<h1>Willkommen, {{userStore.first_name}}</h1>
<h2 class="mt-12">Deine Kurse</h2>
<div class="mt-8 p-8 break-words bg-white max-w-xl">
<h3>Versicherungsvermittler/in</h3>
<div class="mt-4">
<router-link class="btn-blue" to="/learningpath/versicherungsvermittlerin">
Weiter gehts
</router-link>
</div>
</div>
</main>
</template>
<style scoped>
</style>

View File

@ -1,15 +0,0 @@
<script setup lang="ts">
import * as log from 'loglevel';
log.debug('DashboardView created');
</script>
<template>
<main class="px-8 py-8">
<h1>Dashboard</h1>
</main>
</template>
<style scoped>
</style>

View File

@ -1,14 +1,15 @@
<script> <script>
import axios from 'axios'; import axios from 'axios';
import * as log from 'loglevel'; import * as log from 'loglevel';
import { mapStores } from 'pinia';
import MainNavigationBar from '../components/MainNavigationBar.vue';
import LearningPathDiagram from '../components/circle/LearningPathDiagram.vue'; import LearningPathDiagram from '../components/circle/LearningPathDiagram.vue';
import { useUserStore } from '../stores/user';
export default { export default {
components: {MainNavigationBar, LearningPathDiagram}, components: {LearningPathDiagram},
props: ['learningPathSlug',], props: ['learningPathSlug',],
data() { data() {
return { return {
@ -19,6 +20,9 @@ export default {
learningSequences: [], learningSequences: [],
} }
}, },
computed: {
...mapStores(useUserStore)
},
mounted() { mounted() {
log.debug('LearningPath mounted', this.learningPathSlug); log.debug('LearningPath mounted', this.learningPathSlug);
axios({ axios({
@ -62,7 +66,7 @@ export default {
</script> </script>
<template> <template>
<div class="bg-gray-300 h-screen" v-if="learningPathContents"> <div class="bg-gray-100" v-if="learningPathContents">
<div class="learningpath flex flex-col"> <div class="learningpath flex flex-col">
<div class="flex flex-col h-max"> <div class="flex flex-col h-max">
@ -70,21 +74,21 @@ export default {
<LearningPathDiagram :learning-path-contents="learningPathContents"></LearningPathDiagram> <LearningPathDiagram :learning-path-contents="learningPathContents"></LearningPathDiagram>
</div> </div>
<div class="text-blue-dark font-bold text-7xl m-12"> <h1 class="m-12">{{ learningPathData.title }}</h1>
{{ learningPathData.title }}
</div>
<div class="bg-white m-12 p-8 flex flex-row justify-start"> <div class="bg-white m-12 p-8 flex flex-row justify-start">
<div class="p-8"> <div class="p-8 flex-auto">
<h2>Willkommmen zurück, {{userStore.first_name}}</h2>
<h2>Willkommmen zurück, Jan</h2> <p class="mt-4 text-xl">
Du hast bereits drei circles bearbeitet, mach weiter so! Du hast bereits drei circles bearbeitet, mach weiter so!
</p>
</div> </div>
<div class="p-8 border-l ">Nächster Schirtt <div class="p-8 border-l border-gray-500 flex-1">
Nächster Schirtt
<h3>Analyse: Anwenden</h3> <h3>Analyse: Anwenden</h3>
<button class="btn-blue mt-4"> <router-link class="mt-4 btn-blue" to="/circle/analyse">
Los geht's Los geht's
</button> </router-link>
</div> </div>
</div> </div>

View File

@ -4,7 +4,7 @@ module.exports = {
content: [ content: [
'./index.html', './index.html',
'./src/**/*.{vue,js,ts,jsx,tsx}', './src/**/*.{vue,js,ts,jsx,tsx}',
'../server/vbv_lernwelt/**/*.{html,js}', // '../server/vbv_lernwelt/**/*.{html,js}',
], ],
theme: { theme: {
fontFamily: { fontFamily: {