Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.

Commit e9fcc0a

Browse files
committed
feat: add a link to discussion thread
1 parent 3c39d7c commit e9fcc0a

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

components/PanelDocs.vue

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,31 @@ const sourceUrl = computed(() =>
6363
: undefined,
6464
)
6565
66+
const threadIdMappings: { [key: string]: number } = {
67+
'0.index.md': 85,
68+
'1.vue/1.index.md': 68,
69+
'1.vue/2.reactivity/index.md': 71,
70+
'1.vue/3.reactivity-2/index.md': 72,
71+
'1.vue/4.composition-api/index.md': 73,
72+
'1.vue/5.components/index.md': 74,
73+
'1.vue/6.summary/index.md': 75,
74+
'2.concepts/1.index.md': 76,
75+
'2.concepts/2.app-vue/index.md': 77,
76+
'2.concepts/3.routing/index.md': 78,
77+
'2.concepts/4.auto-imports/index.md': 79,
78+
'2.concepts/5.middleware/index.md': 80,
79+
'2.concepts/6.layout/index.md': 81,
80+
'2.concepts/7.rendering-modes/index.md': 82,
81+
'2.concepts/8.state-manegement/index.md': 83,
82+
'2.concepts/9.data-fetching/index.md': 84,
83+
}
84+
85+
const threadUrl = computed(() =>
86+
page.value?._file
87+
? `https://github.com/vuejs-jp/learn.nuxt.com/discussions/${threadIdMappings[page.value._file]}`
88+
: undefined,
89+
)
90+
6691
const docsEl = ref<HTMLElement | null>(null)
6792
const router = useRouter()
6893
router.beforeEach(() => {
@@ -118,7 +143,7 @@ router.beforeEach(() => {
118143
/>
119144
</div>
120145
</div>
121-
<div border="t base dashed" mt-8 p3>
146+
<div flex="~ items-center gap-4" border="t base dashed" mt-8 p3>
122147
<NuxtLink
123148
v-if="sourceUrl"
124149
:to="sourceUrl" target="_blank"
@@ -129,6 +154,17 @@ router.beforeEach(() => {
129154
<div i-ph-note-pencil-duotone />
130155
Edit this page
131156
</NuxtLink>
157+
<NuxtLink
158+
v-if="threadUrl"
159+
:to="threadUrl"
160+
target="_blank"
161+
flex="~ items-center gap-2"
162+
text-inherit op75
163+
hover="text-primary op100"
164+
>
165+
<div i-ph-arrow-square-out-fill />
166+
Ask your question
167+
</NuxtLink>
132168
</div>
133169
</article>
134170
<!-- Navigration Dropdown -->

0 commit comments

Comments
 (0)