fix: use trainer url
This commit is contained in:
parent
4672698895
commit
daaecb57a0
|
|
@ -8,19 +8,17 @@ const props = defineProps<{
|
||||||
singleLine?: boolean;
|
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 courseSessionsStore = useCourseSessionsStore();
|
||||||
const courseSession = courseSessionsStore.allCourseSessions.find(
|
const courseSession = courseSessionsStore.allCourseSessions.find(
|
||||||
(cs: CourseSession) => cs.id === props.dueDate.course_session
|
(cs: CourseSession) => cs.id === props.dueDate.course_session
|
||||||
);
|
);
|
||||||
|
|
||||||
const disableLink = courseSession
|
if (!courseSession) {
|
||||||
? !courseSessionsStore.hasCockpit(courseSession)
|
throw new Error("Course session not found");
|
||||||
: false;
|
}
|
||||||
|
|
||||||
|
const isExpert = courseSessionsStore.hasCockpit(courseSession);
|
||||||
|
const url = isExpert ? props.dueDate.url_expert : props.dueDate.url;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -30,12 +28,9 @@ const disableLink = courseSession
|
||||||
>
|
>
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<div class="text-bold">
|
<div class="text-bold">
|
||||||
<a v-if="disableLink" class="underline" :href="props.dueDate.url">
|
<a class="underline" :href="url">
|
||||||
{{ props.dueDate.title }}
|
{{ props.dueDate.title }}
|
||||||
</a>
|
</a>
|
||||||
<template v-else>
|
|
||||||
{{ props.dueDate.title }}
|
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="text-small text-gray-900">
|
<div class="text-small text-gray-900">
|
||||||
<div v-if="props.dueDate.date_type_translation_key">
|
<div v-if="props.dueDate.date_type_translation_key">
|
||||||
|
|
|
||||||
|
|
@ -630,6 +630,7 @@ export type DueDate = {
|
||||||
date_type_translation_key: string;
|
date_type_translation_key: string;
|
||||||
subtitle: string;
|
subtitle: string;
|
||||||
url: string;
|
url: string;
|
||||||
|
url_expert: string;
|
||||||
course_session: number | null;
|
course_session: number | null;
|
||||||
page: number | null;
|
page: number | null;
|
||||||
circle: CircleLight | null;
|
circle: CircleLight | null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue