Skip to content

Commit b06d1db

Browse files
Add Suggest Feedback button to chapter pages (#2)
1 parent 22b3bfd commit b06d1db

2 files changed

Lines changed: 47 additions & 3 deletions

File tree

src/components/TableOfContents.astro

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
---
22
interface Props {
33
headings: { depth: number; slug: string; text: string }[];
4+
editUrl?: string;
5+
feedbackUrl?: string;
46
}
57
6-
const { headings } = Astro.props;
8+
const { headings, editUrl, feedbackUrl } = Astro.props;
79
const filtered = headings.filter((h) => h.depth >= 2 && h.depth <= 3);
810
---
911

@@ -31,6 +33,36 @@ const filtered = headings.filter((h) => h.depth >= 2 && h.depth <= 3);
3133
))}
3234
</ul>
3335
</nav>
36+
{(editUrl || feedbackUrl) && (
37+
<div class="mt-6 pt-4 border-t border-[var(--border-subtle)] flex flex-col gap-1.5">
38+
{editUrl && (
39+
<a
40+
href={editUrl}
41+
target="_blank"
42+
rel="noopener noreferrer"
43+
class="inline-flex items-center gap-1.5 text-[11px] text-[var(--text-tertiary)] hover:text-[var(--text-secondary)] transition-colors"
44+
>
45+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
46+
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" /><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" />
47+
</svg>
48+
Edit on GitHub
49+
</a>
50+
)}
51+
{feedbackUrl && (
52+
<a
53+
href={feedbackUrl}
54+
target="_blank"
55+
rel="noopener noreferrer"
56+
class="inline-flex items-center gap-1.5 text-[11px] text-[var(--text-tertiary)] hover:text-[var(--text-secondary)] transition-colors"
57+
>
58+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
59+
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
60+
</svg>
61+
Suggest Feedback
62+
</a>
63+
)}
64+
</div>
65+
)}
3466
</aside>
3567
)}
3668

src/layouts/ChapterLayout.astro

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const pageTitle = chapter
2525
: `${title} | The Agentic Engineering Guide`;
2626
2727
const editUrl = `https://github.com/Siddhant-K-code/agentic-engineering-guide/edit/main/src/content/chapters/${currentSlug}.mdx`;
28+
const feedbackUrl = `https://github.com/Siddhant-K-code/agentic-engineering-guide/issues/new?title=Feedback:+${encodeURIComponent(title)}&labels=feedback`;
2829
---
2930

3031
<BaseLayout title={pageTitle} description={description}>
@@ -52,7 +53,7 @@ const editUrl = `https://github.com/Siddhant-K-code/agentic-engineering-guide/ed
5253
Part {part} / {partTitle}
5354
</span>
5455
)}
55-
<div class="mt-3">
56+
<div class="mt-3 flex flex-wrap gap-3">
5657
<a
5758
href={editUrl}
5859
target="_blank"
@@ -64,6 +65,17 @@ const editUrl = `https://github.com/Siddhant-K-code/agentic-engineering-guide/ed
6465
</svg>
6566
Edit on GitHub
6667
</a>
68+
<a
69+
href={feedbackUrl}
70+
target="_blank"
71+
rel="noopener noreferrer"
72+
class="inline-flex items-center gap-1 text-xs text-[var(--text-tertiary)] hover:text-[var(--text-secondary)] transition-colors"
73+
>
74+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
75+
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
76+
</svg>
77+
Suggest Feedback
78+
</a>
6779
</div>
6880
</header>
6981

@@ -77,7 +89,7 @@ const editUrl = `https://github.com/Siddhant-K-code/agentic-engineering-guide/ed
7789
</article>
7890

7991
<!-- Right rail: Table of Contents -->
80-
<TableOfContents headings={headings} />
92+
<TableOfContents headings={headings} editUrl={editUrl} feedbackUrl={feedbackUrl} />
8193
</div>
8294
</main>
8395
</div>

0 commit comments

Comments
 (0)