Update CourseSessionsMenu
This commit is contained in:
parent
54231d6cce
commit
d6b45f9f7f
|
|
@ -1,10 +1,12 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import CourseSessionsMenu from "@/components/header/CourseSessionsMenu.vue";
|
||||||
import type { UserState } from "@/stores/user";
|
import type { UserState } from "@/stores/user";
|
||||||
import type { CourseSession } from "@/types";
|
import type { CourseSession } from "@/types";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
courseSessions: CourseSession[];
|
courseSessions: CourseSession[];
|
||||||
user: UserState | undefined;
|
user: UserState;
|
||||||
|
selectedCourseSession?: number;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits(["selectCourseSession", "logout"]);
|
const emit = defineEmits(["selectCourseSession", "logout"]);
|
||||||
|
|
@ -12,18 +14,18 @@ const emit = defineEmits(["selectCourseSession", "logout"]);
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="text-black">
|
<div class="text-black">
|
||||||
<div v-if="user?.loggedIn" class="border-b py-4">
|
<div class="border-b py-4">
|
||||||
<div class="flex justify-start">
|
<div class="flex justify-start">
|
||||||
<div v-if="user?.avatar_url">
|
<div v-if="user.avatar_url">
|
||||||
<img
|
<img
|
||||||
class="inline-block h-20 w-20 rounded-full"
|
class="inline-block h-20 w-20 rounded-full"
|
||||||
:src="user?.avatar_url"
|
:src="user.avatar_url"
|
||||||
alt=""
|
alt=""
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-6">
|
<div class="ml-6">
|
||||||
<h3>{{ user?.first_name }} {{ user?.last_name }}</h3>
|
<h3>{{ user.first_name }} {{ user.last_name }}</h3>
|
||||||
<div class="text-sm text-gray-800">{{ user?.email }}</div>
|
<div class="text-sm text-gray-800">{{ user.email }}</div>
|
||||||
<div class="text-sm text-gray-800">
|
<div class="text-sm text-gray-800">
|
||||||
<router-link class="link" to="/profile">Profil anzeigen</router-link>
|
<router-link class="link" to="/profile">Profil anzeigen</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -32,17 +34,14 @@ const emit = defineEmits(["selectCourseSession", "logout"]);
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="props.courseSessions.length" class="border-b py-4">
|
<div v-if="props.courseSessions.length" class="border-b py-4">
|
||||||
<div v-for="cs in props.courseSessions" :key="cs.id">
|
<CourseSessionsMenu
|
||||||
<button @click="emit('selectCourseSession', cs)">{{ cs.title }}</button>
|
:items="courseSessions"
|
||||||
</div>
|
:selected="selectedCourseSession"
|
||||||
|
@select="emit('selectCourseSession', $event)"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button type="button" class="mt-6 flex items-center" @click="emit('logout')">
|
||||||
v-if="user?.loggedIn"
|
|
||||||
type="button"
|
|
||||||
class="mt-6 flex items-center"
|
|
||||||
@click="emit('logout')"
|
|
||||||
>
|
|
||||||
<it-icon-logout class="inline-block" />
|
<it-icon-logout class="inline-block" />
|
||||||
<span class="ml-1">{{ $t("mainNavigation.logout") }}</span>
|
<span class="ml-1">{{ $t("mainNavigation.logout") }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,22 @@
|
||||||
<template>
|
<template>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div>
|
<div>
|
||||||
{{selected}}
|
<div
|
||||||
<div v-for="item in props.items" :key="item.id" class="mb-4 flex items-center">
|
v-for="item in props.items"
|
||||||
|
:key="item.id"
|
||||||
|
class="mb-4 flex items-center last:mb-0"
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
:id="item.id"
|
:id="String(item.id)"
|
||||||
name="coursesessions"
|
name="coursesessions"
|
||||||
type="radio"
|
type="radio"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
v-model="selected"
|
:checked="selected === item.id"
|
||||||
class="text-indigo-600 focus:ring-indigo-600 h-4 w-4 border-gray-300"
|
class="focus:ring-indigo-900 h-4 w-4 border-gray-300 text-blue-900"
|
||||||
|
@change="emit('select', item)"
|
||||||
/>
|
/>
|
||||||
<label
|
<label
|
||||||
:for="item.id"
|
:for="String(item.id)"
|
||||||
class="ml-3 block text-sm font-medium leading-6 text-gray-900"
|
class="ml-3 block text-sm font-medium leading-6 text-gray-900"
|
||||||
>
|
>
|
||||||
{{ item.title }}
|
{{ item.title }}
|
||||||
|
|
@ -23,7 +27,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import type { CourseSession } from "@/types";
|
||||||
|
|
||||||
export interface Item {
|
export interface Item {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
@ -31,9 +35,10 @@ export interface Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
items: Item[];
|
items: CourseSession[];
|
||||||
|
selected?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const selected = ref(null);
|
|
||||||
const props = defineProps<Props>();
|
const props = defineProps<Props>();
|
||||||
|
const emit = defineEmits(["select"]);
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -219,6 +219,9 @@ onMounted(() => {
|
||||||
<div class="p-4">
|
<div class="p-4">
|
||||||
<AccountMenuContent
|
<AccountMenuContent
|
||||||
:course-sessions="courseSessionsStore.currentCourseSessions"
|
:course-sessions="courseSessionsStore.currentCourseSessions"
|
||||||
|
:selected-course-session="
|
||||||
|
courseSessionsStore.currentCourseSession.id
|
||||||
|
"
|
||||||
:user="userStore"
|
:user="userStore"
|
||||||
@logout="logout"
|
@logout="logout"
|
||||||
@select-course-session="selectCourseSession"
|
@select-course-session="selectCourseSession"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue