workaround: disable due date links for experts
This commit is contained in:
parent
5e8554acda
commit
fa22f5a18e
|
|
@ -1,11 +1,26 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { formatDate } from "@/components/dueDates/dueDatesUtils";
|
import { formatDate } from "@/components/dueDates/dueDatesUtils";
|
||||||
import type { DueDate } from "@/types";
|
import type { CourseSession, DueDate } from "@/types";
|
||||||
|
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
dueDate: DueDate;
|
dueDate: DueDate;
|
||||||
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 courseSession = courseSessionsStore.allCourseSessions.find(
|
||||||
|
(cs: CourseSession) => cs.id === props.dueDate.course_session
|
||||||
|
);
|
||||||
|
|
||||||
|
const disableLink = courseSession
|
||||||
|
? !courseSessionsStore.hasCockpit(courseSession)
|
||||||
|
: false;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -13,11 +28,14 @@ const props = defineProps<{
|
||||||
class="flex justify-between py-4"
|
class="flex justify-between py-4"
|
||||||
:class="{ 'flex-col': props.singleLine, 'items-center': !props.singleLine }"
|
:class="{ 'flex-col': props.singleLine, 'items-center': !props.singleLine }"
|
||||||
>
|
>
|
||||||
<div class="space-y-1">
|
<div class="text-bold space-y-1">
|
||||||
<div>
|
<div>
|
||||||
<a class="text-bold underline" :href="props.dueDate.url">
|
<a v-if="disableLink" class="underline" :href="props.dueDate.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">
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,8 @@ const dueDates = courseSession.value.due_dates.slice(0, 2);
|
||||||
:key="dueDate.id"
|
:key="dueDate.id"
|
||||||
class="border-t border-gray-500 pt-2"
|
class="border-t border-gray-500 pt-2"
|
||||||
>
|
>
|
||||||
<DueDateSingle :due-date="dueDate" :single-line="true"></DueDateSingle>
|
<DueDateSingle :due-date="dueDate" single-line></DueDateSingle>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="dueDates.length === 0">{{ $t("dueDates.noDueDatesAvailable") }}</div>
|
<div v-if="dueDates.length === 0">{{ $t("dueDates.noDueDatesAvailable") }}</div>
|
||||||
<a class="border-t border-gray-500 pt-8 underline" href="">
|
|
||||||
{{ $t("dueDates.showAllDueDates") }}
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue