Make "all" filter more explicit

This commit is contained in:
Ramon Wenger 2024-07-17 19:21:03 +02:00 committed by Christian Cueni
parent bb894a4ccd
commit 6ea37447f4
4 changed files with 20 additions and 3 deletions

View File

@ -3,3 +3,5 @@ export const itCheckboxDefaultIconCheckedTailwindClass =
export const itCheckboxDefaultIconUncheckedTailwindClass =
"bg-[url(/static/icons/icon-checkbox-unchecked.svg)] hover:bg-[url(/static/icons/icon-checkbox-unchecked-hover.svg)]";
export const COURSE_PROFILE_ALL_FILTER = "all";

View File

@ -1,4 +1,5 @@
<script lang="ts" setup>
import { COURSE_PROFILE_ALL_FILTER } from "@/constants";
import LearningPathCircleListTile from "@/pages/learningPath/learningPathPage/LearningPathCircleListTile.vue";
import type { LearningContentWithCompletion, TopicType } from "@/types";
import { computed } from "vue";
@ -11,7 +12,11 @@ interface Props {
const props = defineProps<Props>();
const filteredCircles = computed(() => {
if (props.filter === undefined || props.filter === "") {
if (
props.filter === undefined ||
props.filter === "" ||
props.filter === COURSE_PROFILE_ALL_FILTER
) {
return props.topic.circles;
}
return props.topic.circles.filter(

View File

@ -2,6 +2,7 @@
import { computed } from "vue";
import type { LearningContentWithCompletion, TopicType } from "@/types";
import LearningPathCircleColumn from "./LearningPathCircleColumn.vue";
import { COURSE_PROFILE_ALL_FILTER } from "@/constants";
interface Props {
topic: TopicType;
@ -21,7 +22,11 @@ const isLastCircle = (circleIndex: number, numCircles: number) =>
props.isLastTopic && circleIndex === numCircles - 1;
const filteredCircles = computed(() => {
if (props.filter === undefined || props.filter === "") {
if (
props.filter === undefined ||
props.filter === "" ||
props.filter === COURSE_PROFILE_ALL_FILTER
) {
return props.topic.circles;
}
return props.topic.circles.filter(

View File

@ -1,8 +1,11 @@
<script lang="ts" setup>
import { COURSE_PROFILE_ALL_FILTER } from "@/constants";
interface Props {
profiles?: string[];
selected?: string;
}
const allProfile = COURSE_PROFILE_ALL_FILTER;
defineProps<Props>();
defineEmits(["select"]);
@ -21,6 +24,8 @@ defineEmits(["select"]);
{{ $t(`profile.${profile}`) }}
</button>
</div>
<a class="link" @click="$emit('select', '')">Alle anzeigen (Allbranche)</a>
<a class="link" @click="$emit('select', allProfile)">
Alle anzeigen ({{ $t(`profile.${allProfile}`) }})
</a>
</div>
</template>