feat: alle functionaliteiten van de user homepage zijn geïmplementeerd
This commit is contained in:
parent
54a2cf0800
commit
0d635fc6a1
6 changed files with 26 additions and 15 deletions
|
@ -4,7 +4,7 @@
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import {AGE_TO_THEMES, THEMESITEMS} from "@/utils/constants.ts";
|
import {AGE_TO_THEMES, THEMESITEMS} from "@/utils/constants.ts";
|
||||||
|
|
||||||
// Receive the selectedTheme from the parent component
|
// Receive the selectedTheme and selectedAge from the parent component
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
selectedTheme: {
|
selectedTheme: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -31,7 +31,6 @@
|
||||||
// Update the cards value with the fetched themes
|
// Update the cards value with the fetched themes
|
||||||
allCards.value = await response.json();
|
allCards.value = await response.json();
|
||||||
cards.value = allCards.value;
|
cards.value = allCards.value;
|
||||||
//console.log(allCards.value);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching themes:", error);
|
console.error("Error fetching themes:", error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,23 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
path: string;
|
path: string;
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
image: string;
|
image: string;
|
||||||
}>();
|
}>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<v-card variant="outlined" class="theme-card d-flex flex-column">
|
<v-card
|
||||||
|
variant="outlined"
|
||||||
|
class="theme-card d-flex flex-column"
|
||||||
|
:to="`theme/${path}`"
|
||||||
|
link
|
||||||
|
>
|
||||||
<v-card-title class="title-container">
|
<v-card-title class="title-container">
|
||||||
<v-img
|
<v-img
|
||||||
v-if="image"
|
v-if="image"
|
||||||
|
@ -39,6 +44,11 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-card:hover {
|
||||||
|
background-color: rgba(0, 0, 0, 0.03);
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-container {
|
.title-container {
|
||||||
|
@ -57,5 +67,8 @@
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
white-space: normal;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"choose-age": "Select age",
|
"choose-age": "Select age",
|
||||||
"theme-options": {
|
"theme-options": {
|
||||||
"all": "All themes",
|
"all": "All themes",
|
||||||
"culture": "culture",
|
"culture": "Culture",
|
||||||
"electricity-and-mechanics": "Electricity and mechanics",
|
"electricity-and-mechanics": "Electricity and mechanics",
|
||||||
"nature-and-climate": "Nature and climate",
|
"nature-and-climate": "Nature and climate",
|
||||||
"agriculture": "Agriculture",
|
"agriculture": "Agriculture",
|
||||||
|
|
|
@ -119,7 +119,7 @@ router.beforeEach(async (to, from, next) => {
|
||||||
// Verify if user is logged in before accessing certain routes
|
// Verify if user is logged in before accessing certain routes
|
||||||
if (to.meta.requiresAuth) {
|
if (to.meta.requiresAuth) {
|
||||||
if (!authState.isLoggedIn.value) {
|
if (!authState.isLoggedIn.value) {
|
||||||
//next("/login");
|
//Next("/login");
|
||||||
next();
|
next();
|
||||||
} else {
|
} else {
|
||||||
next();
|
next();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<main></main>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -72,7 +72,6 @@ import {ref, watch} from "vue";
|
||||||
</v-container>
|
</v-container>
|
||||||
|
|
||||||
<BrowseThemes :selectedTheme="selectedThemeKey ?? ''" :selectedAge="selectedAgeKey ?? ''"/>
|
<BrowseThemes :selectedTheme="selectedThemeKey ?? ''" :selectedAge="selectedAgeKey ?? ''"/>
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue