Skip to content

Commit 47e4126

Browse files
committed
[Docs Site] Load WARP releases into WARP changelog
1 parent afd1b40 commit 47e4126

File tree

6 files changed

+62
-577
lines changed

6 files changed

+62
-577
lines changed

src/components/ProductChangelog.astro

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { getEntry, type CollectionEntry } from "astro:content";
33
import { marked } from "marked";
44
import { getChangelogs } from "~/util/changelogs";
55
import AnchorHeading from "~/components/AnchorHeading.astro";
6-
import { entryToString } from "~/util/container";
76
87
const page = await getEntry("docs", Astro.params.slug!);
98
@@ -76,57 +75,27 @@ if (!changelogs) {
7675
}
7776
{
7877
changelogs.map(([date, entries]) => (
79-
<div data-date={date}>
78+
<div>
79+
<AnchorHeading depth={2} title={date} />
8080
{(entries ?? []).map(async (entry) => {
81-
let description;
82-
if (entry.individual_page) {
83-
const link = entry.individual_page;
84-
85-
if (!link)
86-
throw new Error(
87-
`Changelog entry points to individual page but no link is provided`,
88-
);
89-
90-
const page = await getEntry("docs", link.slice(1, -1));
91-
92-
if (!page)
93-
throw new Error(
94-
`Changelog entry points to ${link.slice(1, -1)} but unable to find entry with that slug`,
95-
);
96-
97-
description = (await entryToString(page, Astro.locals)) ?? page.body;
98-
99-
return (
81+
return (
82+
<>
10083
<div data-product={entry.product.toLowerCase()}>
101-
<a href={entry.individual_page} class="no-underline">
102-
<AnchorHeading depth={2} title={page.data.title} />
103-
</a>
104-
<p class="text-xs">{entry.date}</p>
10584
{page.data.changelog_product_area_name && (
10685
<h3 class="!mt-4">
10786
<a href={entry.productLink}>{entry.product}</a>
10887
</h3>
10988
)}
110-
{<Fragment set:html={description} />}
111-
</div>
112-
);
113-
} else {
114-
description = marked.parse(entry.description as string);
115-
return (
116-
<>
117-
<AnchorHeading depth={2} title={date} />
118-
<div data-product={entry.product.toLowerCase()}>
119-
{page.data.changelog_product_area_name && (
120-
<h3 class="!mt-4">
121-
<a href={entry.productLink}>{entry.product}</a>
122-
</h3>
89+
{entry.title && <strong>{entry.title}</strong>}
90+
<Fragment
91+
set:html={marked.parse(
92+
entry.description ??
93+
`Refer to the dedicated page for [${entry.title}](${entry.link})`,
12394
)}
124-
{entry.title && <strong>{entry.title}</strong>}
125-
{<Fragment set:html={description} />}
126-
</div>
127-
</>
128-
);
129-
}
95+
/>
96+
</div>
97+
</>
98+
);
13099
})}
131100
</div>
132101
))

0 commit comments

Comments
 (0)