Skip to content

Commit 65fbf9a

Browse files
tokuda109ubugeeei
andauthored
feat: add a link to discussion thread (#86)
* feat: add a link to discussion thread * Update components/PanelDocs.vue Co-authored-by: ubugeeei <[email protected]> * Update components/PanelDocs.vue Co-authored-by: ubugeeei <[email protected]> * Update components/PanelDocs.vue Co-authored-by: ubugeeei <[email protected]> * fix: type errors * chore --------- Co-authored-by: ubugeeei <[email protected]> Co-authored-by: Ubugeeei <[email protected]>
1 parent 3c39d7c commit 65fbf9a

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

components/PanelDocs.vue

+39-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- eslint-disable vue/return-in-computed-property -->
12
<script setup lang="ts">
23
import type { NavItem, ParsedContent } from '@nuxt/content'
34

@@ -63,6 +64,32 @@ const sourceUrl = computed(() =>
6364
: undefined,
6465
)
6566

67+
// NOTE: remove when hands-on finished (will be held on 2024-10-19)
68+
const THREAD_ID_MAP: Readonly<Record<string, number>> = {
69+
'0.index.md': 85,
70+
'1.vue/1.index.md': 68,
71+
'1.vue/2.reactivity/index.md': 71,
72+
'1.vue/3.reactivity-2/index.md': 72,
73+
'1.vue/4.composition-api/index.md': 73,
74+
'1.vue/5.components/index.md': 74,
75+
'1.vue/6.summary/index.md': 75,
76+
'2.concepts/1.index.md': 76,
77+
'2.concepts/2.app-vue/index.md': 77,
78+
'2.concepts/3.routing/index.md': 78,
79+
'2.concepts/4.auto-imports/index.md': 79,
80+
'2.concepts/5.middleware/index.md': 80,
81+
'2.concepts/6.layout/index.md': 81,
82+
'2.concepts/7.rendering-modes/index.md': 82,
83+
'2.concepts/8.state-manegement/index.md': 83,
84+
'2.concepts/9.data-fetching/index.md': 84,
85+
}
86+
87+
const threadUrl = computed<string | null>(() =>
88+
page.value?._file && THREAD_ID_MAP[page.value._file]
89+
? `https://github.com/vuejs-jp/learn.nuxt.com/discussions/${THREAD_ID_MAP[page.value._file]}`
90+
: null,
91+
)
92+
6693
const docsEl = ref<HTMLElement | null>(null)
6794
const router = useRouter()
6895
router.beforeEach(() => {
@@ -118,7 +145,7 @@ router.beforeEach(() => {
118145
/>
119146
</div>
120147
</div>
121-
<div border="t base dashed" mt-8 p3>
148+
<div flex="~ items-center gap-4" border="t base dashed" mt-8 p3>
122149
<NuxtLink
123150
v-if="sourceUrl"
124151
:to="sourceUrl" target="_blank"
@@ -129,6 +156,17 @@ router.beforeEach(() => {
129156
<div i-ph-note-pencil-duotone />
130157
Edit this page
131158
</NuxtLink>
159+
<NuxtLink
160+
v-if="threadUrl"
161+
:to="threadUrl"
162+
target="_blank"
163+
flex="~ items-center gap-2"
164+
text-inherit op75
165+
hover="text-primary op100"
166+
>
167+
<div i-ph-arrow-square-out-fill />
168+
Ask your question
169+
</NuxtLink>
132170
</div>
133171
</article>
134172
<!-- Navigration Dropdown -->

0 commit comments

Comments
 (0)