Compare commits

..

No commits in common. "69b4134ab91b443a96667f371869ca459ac0aa5c" and "be47d1e5835fc72ee8ff2089157b57f4068bd82f" have entirely different histories.

4 changed files with 20 additions and 61 deletions

View file

@ -1,26 +1,22 @@
<script setup lang="ts"> <script setup lang="ts">
import Drawer from 'primevue/drawer' import Drawer from 'primevue/drawer'
import { ref } from 'vue' import { ref } from 'vue'
import { useClassStore } from '@/stores/classStore'
import router from '@/router'
const store = useClassStore()
store.loadClasses()
defineProps<{ defineProps<{
isLoggedIn: boolean isLoggedIn: boolean
isTeacher: boolean isTeacher: boolean
}>() }>()
var elements = store.classInfoList var elements = [
{ name: 'Max', id: 25 },
{ name: 'Anna', id: 30 },
{ name: 'Tom', id: 35 },
]
var visible = ref(true) var visible = ref(true)
var closeIcon = ref(false) var closeIcon = ref(false)
var counter = ref(null)
function setClass(input: number) { function setClass(input: Number) {}
store.setActiveClass(input)
router.push({ name: 'about' })
}
</script> </script>
<template> <template>
@ -33,11 +29,10 @@ function setClass(input: number) {
header="Sidebar" header="Sidebar"
v-if="isLoggedIn" v-if="isLoggedIn"
> >
<h1 v-if="store.classInfo != null">{{ store.classInfo.name }}</h1>
<div v-if="isTeacher"> <div v-if="isTeacher">
<ul> <ul>
<li v-for="item in elements"> <li v-for="item in elements">
<p href="/about" @click="setClass(item.id)">{{ item.name }}</p> <a href="/about" @click="setClass(item.id)">{{ item.name }}</a>
</li> </li>
</ul> </ul>
</div> </div>

View file

@ -1,5 +1,6 @@
import './assets/main.css' import './assets/main.css'
import { createApp } from 'vue' import { createApp } from 'vue'
import { createPinia } from 'pinia' import { createPinia } from 'pinia'
import PrimeVue from 'primevue/config' import PrimeVue from 'primevue/config'
@ -10,14 +11,13 @@ import App from './App.vue'
import router from './router' import router from './router'
const app = createApp(App) const app = createApp(App)
const pinia = createPinia()
app.use(PrimeVue, { app.use(PrimeVue, {
theme: { theme: {
preset: Aura, preset: Aura,
}, },
}) })
app.use(pinia) app.use(createPinia())
app.use(router) app.use(router)
app.directive('ripple', Ripple) app.directive('ripple', Ripple)

View file

@ -1,39 +0,0 @@
import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
interface State {
classInfoList: ClassInfo[]
classInfo: ClassInfo | null
}
export const useClassStore = defineStore('class', {
state: (): State => {
return {
classInfoList: [],
classInfo: null,
}
},
actions: {
loadClasses() {
/* Beispieldaten */
if (this.classInfoList.length < 1) {
this.classInfoList.push({ name: 'Steve', id: 1 })
this.classInfoList.push({ name: 'Garett', id: 2 })
this.classInfoList.push({ name: 'Natalie', id: 3 })
this.classInfoList.push({ name: 'Henry', id: 4 })
this.classInfoList.push({ name: 'Dawn', id: 5 })
}
},
setActiveClass(id: number) {
this.classInfoList.map((item) => {
if (item.id == id) {
this.classInfo = item
}
})
},
},
})
interface ClassInfo {
name: string
id: number
}

View file

@ -1,12 +1,15 @@
<script setup lang="ts">
import { useClassStore } from '@/stores/classStore'
const store = useClassStore()
</script>
<template> <template>
<div class="about"> <div class="about">
<h1>This is an about page</h1> <h1>This is an about page</h1>
</div> </div>
</template> </template>
<style></style> <style>
@media (min-width: 1024px) {
.about {
min-height: 100vh;
display: flex;
align-items: center;
}
}
</style>