Skip to content

Commit 7b09620

Browse files
feat: Create a page with all learning path
1 parent 9582551 commit 7b09620

3 files changed

Lines changed: 180 additions & 2 deletions

File tree

components/ContentElements.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export default {
154154
async setup(props) {
155155
const route = useRoute();
156156
const pathParent = route.path;
157-
console.log(pathParent);
157+
158158
let lang = route.params.lang;
159159
const { data: navigation } = await useAsyncData("navigation", () =>
160160
fetchContentNavigation(pathParent)

pages/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@
167167
</v-card-text>
168168
</v-card>
169169
</div>
170+
<NuxtLink v-if="navel.title == 'Learning Path'" to="/learning-path/all/" style="color: gainsboro; text-decoration: none; ">+ Show more</NuxtLink>
170171
</div>
171172
</v-container>
172173
</v-sheet>

pages/learning-path/all/index.vue

Lines changed: 178 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,185 @@
11
<template>
2-
<h1>Learning path</h1>
2+
<div v-for="(navL1, keyL1) in navigation" :key="keyL1">
3+
<v-sheet
4+
v-for="(n, keyC) in navL1.children"
5+
:key="keyC"
6+
class="pa-9"
7+
style="overflow: auto; margin: 0"
8+
>
9+
<v-row no-gutters>
10+
<v-col>
11+
<v-sheet class="pa-2 ma-2">
12+
<p
13+
class="text-h2 mdi mdi-school dividerline"
14+
style="color: #0080bc"
15+
>
16+
Learn {{ n.title }}
17+
</p>
18+
</v-sheet>
19+
<v-sheet class="pa-2 ma-2">
20+
<h3 class="text-black text-h6" style="font-weight: normal">
21+
{{ n.description }}
22+
</h3>
23+
</v-sheet>
24+
</v-col>
25+
<v-col cols="2">
26+
<v-sheet class="pa-6 rounded-lg justify-center">
27+
<img
28+
v-if="n.image"
29+
:src="n.image"
30+
alt="logo"
31+
style="
32+
height: 150px;
33+
display: block;
34+
margin-left: auto;
35+
margin-right: auto;
36+
"
37+
/>
38+
</v-sheet>
39+
</v-col>
40+
</v-row>
41+
42+
<div class="d-flex flex-wrap">
43+
<v-card
44+
outlined
45+
elevation="3"
46+
v-for="(c, keyC) in n.children"
47+
:key="keyC"
48+
width="350px"
49+
class="ma-3 rounded-lg"
50+
>
51+
<v-card-text class="d-flex flex-column" style="height: 100%">
52+
<v-badge dot :color="changeColor(c._path, 'white')">
53+
<p class="text-h6 mb-3">
54+
<strong>{{ c.title }}</strong>
55+
</p>
56+
</v-badge>
57+
<div class="mb-2">
58+
<div v-if="c.author">
59+
<v-icon class="me-2">mdi-account-edit</v-icon>
60+
{{ c.author }}
61+
</div>
62+
<v-row>
63+
<v-col
64+
><div v-if="c.language">
65+
<v-icon class="me-2">mdi-account-voice</v-icon>
66+
<span :class="'ma-1 fi fi-' + c.language"></span></div
67+
></v-col>
68+
<v-col
69+
><div v-if="c.duration">
70+
<v-icon class="me-2">mdi-clock-time-five-outline</v-icon>
71+
{{ c.duration }}
72+
</div></v-col
73+
>
74+
</v-row>
75+
</div>
76+
<div v-if="c.belt">
77+
<Belts :belts="c.belt" />
78+
</div>
79+
<div v-if="c.tags">
80+
<Tags :tags="c.tags" />
81+
</div>
82+
<v-spacer></v-spacer>
83+
<p class="mt-4 mb-1"><b>Description</b></p>
84+
<p>
85+
{{ n.description }}
86+
</p>
87+
<br />
88+
89+
<p><b>Progression</b></p>
90+
<div class="overflow-y-auto" style="width: 100%">
91+
<v-timeline truncate-line="both" direction="horizontal">
92+
<v-timeline-item
93+
v-for="step in n.steps"
94+
:key="step"
95+
:dot-color="changeColor('/' + step)"
96+
@click="changePathStep(step)"
97+
>
98+
</v-timeline-item>
99+
</v-timeline>
100+
</div>
101+
102+
<v-card-actions class="justify-center">
103+
<v-btn
104+
@click="changePath(n._path)"
105+
class="bg-primary lighten-4 mx-1"
106+
>Start Now</v-btn
107+
>
108+
</v-card-actions>
109+
</v-card-text>
110+
</v-card>
111+
</div>
112+
</v-sheet>
113+
</div>
3114
</template>
4115

5116
<script>
117+
import "/node_modules/flag-icons/css/flag-icons.min.css";
118+
import { useStorage } from "@vueuse/core";
119+
120+
export default {
121+
async setup(props) {
122+
const route = useRoute();
123+
const pathParent = route.path.replaceAll("all/", "");
124+
125+
let lang = route.params.lang;
126+
const { data: navigation } = await useAsyncData("navigation", () =>
127+
fetchContentNavigation(pathParent)
128+
);
129+
return { navigation, lang };
130+
},
131+
methods: {
132+
changePath(stepPath) {
133+
var pathParts = stepPath.replace("/_dir", "");
134+
var id = pathParts.split("/");
135+
id = id[id.length - 1];
136+
const router = useRouter();
137+
if (!pathParts.startsWith("/")) {
138+
pathParts = "/" + pathParts;
139+
}
140+
141+
router.push({
142+
path: pathParts.replace(id, ""),
143+
query: { id: id },
144+
});
145+
},
146+
changePathStep(stepPath) {
147+
const pathParts = stepPath.split("/");
148+
const id = pathParts[pathParts.length];
149+
var path = stepPath.replace(id, "");
150+
if (!path.startsWith("/")) {
151+
path = "/" + path;
152+
}
153+
154+
console.log(path)
155+
const router = useRouter();
156+
router.push({
157+
path: path,
158+
query: { id: id },
159+
});
160+
},
161+
changeColor(sessionPath, defaultColor = "grey") {
162+
const theDefault = {};
163+
const state = useStorage(
164+
"my-progression-store",
165+
theDefault,
166+
localStorage,
167+
{
168+
mergeDefaults: true,
169+
}
170+
);
171+
if (sessionPath in state.value) {
172+
if (state.value[sessionPath].status == "started") {
173+
return "blue";
174+
} else {
175+
return "green";
176+
}
177+
} else {
178+
return defaultColor;
179+
}
180+
},
181+
},
182+
};
6183
</script>
7184

8185
<style>

0 commit comments

Comments
 (0)