fix: use trainer url

This commit is contained in:
Livio Bieri 2023-09-28 17:44:07 +02:00
parent 4672698895
commit daaecb57a0
2 changed files with 8 additions and 12 deletions

View File

@ -8,19 +8,17 @@ const props = defineProps<{
singleLine?: boolean;
}>();
/* FIXME @livioso 19.09.23: This is a temporary workaround to have a ship-able / deployable
version of the preview feature (VBV-516). The plan is to tackle the role-based
due dates calendar next (VBV-524) which will touch all usage of this component.
For now, just disable links for trainer / expert -> to reduce level of confusion ;)
*/
const courseSessionsStore = useCourseSessionsStore();
const courseSession = courseSessionsStore.allCourseSessions.find(
(cs: CourseSession) => cs.id === props.dueDate.course_session
);
const disableLink = courseSession
? !courseSessionsStore.hasCockpit(courseSession)
: false;
if (!courseSession) {
throw new Error("Course session not found");
}
const isExpert = courseSessionsStore.hasCockpit(courseSession);
const url = isExpert ? props.dueDate.url_expert : props.dueDate.url;
</script>
<template>
@ -30,12 +28,9 @@ const disableLink = courseSession
>
<div class="space-y-1">
<div class="text-bold">
<a v-if="disableLink" class="underline" :href="props.dueDate.url">
<a class="underline" :href="url">
{{ props.dueDate.title }}
</a>
<template v-else>
{{ props.dueDate.title }}
</template>
</div>
<div class="text-small text-gray-900">
<div v-if="props.dueDate.date_type_translation_key">

View File

@ -630,6 +630,7 @@ export type DueDate = {
date_type_translation_key: string;
subtitle: string;
url: string;
url_expert: string;
course_session: number | null;
page: number | null;
circle: CircleLight | null;