Merged in feature/VBV-681-media-icon (pull request #328)

Feature/VBV-681 media icon
This commit is contained in:
Christian Cueni 2024-05-14 05:10:12 +00:00
commit 621296b9b1
5 changed files with 51 additions and 3 deletions

View File

@ -21,7 +21,9 @@ import {
getLearningMentorUrl,
getLearningPathUrl,
getMediaCenterUrl,
isVVLearningMentor,
} from "@/utils/utils";
import { useVVByLink } from "@/composables";
log.debug("MainNavigationBar created");
@ -29,6 +31,7 @@ const breakpoints = useBreakpoints(breakpointsTailwind);
const userStore = useUserStore();
const courseSessionsStore = useCourseSessionsStore();
const notificationsStore = useNotificationsStore();
const vvBuyLink = useVVByLink();
const {
inCockpit,
inCompetenceProfile,
@ -291,7 +294,14 @@ const mentorTabTitle = computed(() =>
>
<it-icon-media-library class="h-8 w-8" />
</router-link>
<router-link
v-if="isVVLearningMentor(courseSessionsStore.currentCourseSession)"
:to="vvBuyLink.href.value"
data-cy="buy-vv-link"
class="nav-item-no-mobile"
>
{{ $t("a.Lehrgang kaufen") }}
</router-link>
<router-link
v-if="hasAppointmentsMenu"
:to="appointmentsUrl"

View File

@ -9,9 +9,11 @@ import {
getLearningMentorUrl,
getLearningPathUrl,
getMediaCenterUrl,
isVVLearningMentor,
} from "@/utils/utils";
import { computed } from "vue";
import { useCourseSessionsStore } from "@/stores/courseSessions";
import { useVVByLink } from "@/composables";
const router = useRouter();
@ -33,6 +35,7 @@ defineProps<{
const emit = defineEmits(["closemodal", "logout"]);
const courseSessionsStore = useCourseSessionsStore();
const vvBuyLink = useVVByLink();
const clickLink = (to: string | undefined) => {
if (to) {
@ -119,6 +122,17 @@ const mentorTabTitle = computed(() =>
{{ $t("a.Mediathek") }}
</button>
</li>
<li
v-if="isVVLearningMentor(courseSessionsStore.currentCourseSession)"
class="mb-6"
>
<button
data-cy="vv-buy-link"
@click="clickLink(vvBuyLink.href.value as string)"
>
{{ $t("Lernpfad kaufen") }}
</button>
</li>
</ul>
</div>
<div class="mt-6 border-b">

View File

@ -51,6 +51,7 @@ import orderBy from "lodash/orderBy";
import log from "loglevel";
import type { ComputedRef, Ref } from "vue";
import { computed, onMounted, ref, watchEffect } from "vue";
import { useRouter, type RouteLocationRaw } from "vue-router";
export function useCurrentCourseSession() {
/**
@ -728,3 +729,17 @@ export function useEvaluationWithFeedback() {
return { hasFeedback };
}
export function useVVByLink() {
const router = useRouter();
const userStore = useUserStore();
const href = computed(
() =>
router.resolve({
name: "accountConfirm",
params: { courseType: `vv-${userStore.language}` },
}).href as RouteLocationRaw
);
return { href };
}

View File

@ -1,4 +1,4 @@
import type { AssignmentType } from "@/types";
import type { AssignmentType, CourseSession } from "@/types";
import { useTranslation } from "i18next-vue";
export function assertUnreachable(msg: string): never {
@ -66,3 +66,12 @@ export function getAssignmentTypeIcon(assignmentType: AssignmentType): string {
return "it-icon-lc-assignment";
}
}
export function isVVLearningMentor(courseSession: CourseSession | undefined): boolean {
return (
(courseSession?.actions.includes("is_learning_mentor") &&
!courseSession?.actions.includes("learning-mentor::edit-mentors") &&
courseSession?.course.configuration.is_vv) ??
false
);
}

View File

@ -1 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M5.5,26.86h-.85c-1.24,0-2.25-1.01-2.25-2.25V5.27c0-1.24,1.01-2.25,2.25-2.25h.85c1.24,0,2.25,1.01,2.25,2.25V24.61c0,1.24-1.01,2.25-2.25,2.25Zm-.85-22.33c-.41,0-.75,.34-.75,.75V24.61c0,.41,.34,.75,.75,.75h.85c.41,0,.75-.34,.75-.75V5.27c0-.41-.34-.75-.75-.75h-.85Z"/><path d="M12.72,26.75h-.85c-1.24,0-2.25-1.01-2.25-2.25V5.17c0-1.24,1.01-2.25,2.25-2.25h.85c1.24,0,2.25,1.01,2.25,2.25V24.5c0,1.24-1.01,2.25-2.25,2.25Zm-.85-22.33c-.41,0-.75,.34-.75,.75V24.5c0,.41,.34,.75,.75,.75h.85c.41,0,.75-.34,.75-.75V5.17c0-.41-.34-.75-.75-.75h-.85Z"/><path d="M24.19,26.51c-.38,0-.76-.1-1.1-.29-.52-.3-.9-.78-1.06-1.36L16.84,6.24c-.33-1.19,.37-2.44,1.56-2.77l.82-.23c1.19-.33,2.44,.37,2.77,1.56l5.19,18.62c.33,1.19-.37,2.44-1.56,2.77l-.82,.23c-.2,.06-.4,.08-.61,.08ZM19.83,4.66c-.07,0-.13,0-.2,.03l-.82,.23c-.4,.11-.63,.53-.52,.92l5.19,18.62c.05,.19,.18,.35,.35,.45,.18,.1,.38,.12,.57,.07l.82-.23h0c.4-.11,.63-.53,.52-.92L20.55,5.21c-.09-.33-.39-.55-.72-.55Z"/></svg>
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M24.05,22.22c.41,0,.75-.34,.75-.75V2.89c0-.41-.34-.75-.75-.75H7.98c-1.92,0-3.49,1.56-3.49,3.49V24.38h.02c0,1.92,1.56,3.49,3.49,3.49H24.76v-1.5h-1.73v-4.14h1.01ZM5.99,5.63c0-1.1,.89-1.99,1.99-1.99h15.32V20.72H7.99c-.75,0-1.44,.24-2,.63V5.63Zm15.55,20.74H7.99c-1.1,0-1.99-.89-1.99-1.99v-.17c0-1.1,.89-1.99,1.99-1.99h13.54v4.14Z"/><path d="M9.81,11.01h9.61c.41,0,.75-.34,.75-.75v-3.92c0-.41-.34-.75-.75-.75H9.81c-.41,0-.75,.34-.75,.75v3.92c0,.41,.34,.75,.75,.75Zm.75-3.92h8.11v2.42H10.56v-2.42Z"/></svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 615 B