Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 51 additions & 42 deletions src/pages/changelog/index.astro
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
---
import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro";
import { Badge } from "~/components";
import { Aside, Badge } from "~/components";
import { marked } from "marked";
import { getChangelogs } from "~/util/changelogs";

const { products, productAreas, changelogs } = await getChangelogs();
---

<StarlightPage frontmatter={{ title: "Changelogs", template: "splash" }}>
<Badge text="Beta" variant="caution" size="medium" />
<br />
<br />
<Aside>
Looking for API deprecations? They can be found on our <a
href="/deprecations/">dedicated deprecations page.</a
>
</Aside>
<p id="productDescription">
Subscribe to all Changelog posts via <a href="/changelog/index.xml">RSS</a>.
</p>
Expand Down Expand Up @@ -44,43 +46,48 @@ const { products, productAreas, changelogs } = await getChangelogs();
</select>
{
changelogs.map(([date, entries]) => (
<div style="overflow-anchor: none;" data-date={date}>
<h2>{date}</h2>
{entries?.map((entry) => (
<div
data-product={entry.product.toLowerCase()}
data-productArea={entry.productAreaName.toLowerCase()}
>
<h3>
<a href={entry.link}>{entry.product}</a>
</h3>
{["WAF", "DDoS protection"].includes(entry.product) ? (
<p
set:html={marked.parse(
entry.scheduled
? "**" +
"Scheduled changes for " +
(entry.date ?? "") +
"**"
: "**" + (entry.date ?? "") + "**",
)}
/>
) : (
<p set:html={marked.parse("**" + (entry.title ?? "") + "**")} />
)}
{["WAF", "DDoS protection"].includes(entry.product) ? (
<p
set:html={marked.parse(
"For more details, refer to the [changelog page](" +
entry.link +
").",
)}
/>
) : (
<p set:html={marked.parse(entry.description ?? "")} />
)}
</div>
))}
<div class="md:grid md:grid-cols-[20%_80%]" data-date={date}>
<div>
<h2 class="text-nowrap">{date}</h2>
</div>
<div class="!mt-0">
{entries?.map((entry) => (
<div
data-product={entry.product.toLowerCase()}
data-productArea={entry.productAreaName.toLowerCase()}
>
<h3>
<a href={entry.link}>{entry.product}</a>
</h3>
{["WAF", "DDoS protection"].includes(entry.product) && (
<p
set:html={marked.parse(
entry.scheduled
? "**" +
"Scheduled changes for " +
(entry.date ?? "") +
"**"
: "**" + (entry.date ?? "") + "**",
)}
/>
)}
{entry.title && (
<p set:html={marked.parse("**" + (entry.title ?? "") + "**")} />
)}
{["WAF", "DDoS protection"].includes(entry.product) ? (
<p
set:html={marked.parse(
"For more details, refer to the [changelog page](" +
entry.link +
").",
)}
/>
) : (
<p set:html={marked.parse(entry.description ?? "")} />
)}
</div>
))}
</div>
</div>
))
}
Expand All @@ -94,7 +101,9 @@ const { products, productAreas, changelogs } = await getChangelogs();
);
const navHeightPx = Number(navHeightRem.split("rem")[0]) * 16 + 16;

const headers = document.querySelectorAll<HTMLElement>("[data-date] > h2");
const headers = document.querySelectorAll<HTMLElement>(
"[data-date] > div > h2",
);
headers.forEach(
(header) => new StickyHeader(header, { offset: 0 - navHeightPx }),
);
Expand Down
34 changes: 34 additions & 0 deletions src/pages/deprecations/index.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro";
import { marked } from "marked";
import { getChangelogs } from "~/util/changelogs";

const { changelogs } = await getChangelogs({
deprecationsOnly: true,
});
---

<StarlightPage frontmatter={{ title: "Deprecations", template: "splash" }}>
<p>
Unless otherwise noted, all dates refer to the release date of the change.
</p>
<br />
{
changelogs.map(([date, entries]) => (
<div>
<h2>{date}</h2>
{entries?.map((entry) => (
<div
data-product={entry.product.toLowerCase()}
data-productArea={entry.productAreaName.toLowerCase()}
>
<h3>
<a href={entry.link}>{entry.product}</a>
</h3>
<p set:html={marked.parse(entry.description ?? "")} />
</div>
))}
</div>
))
}
</StarlightPage>
7 changes: 7 additions & 0 deletions src/util/changelogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { type CollectionEntry } from "astro:content";
export async function getChangelogs(opts?: {
filter?: Parameters<typeof getCollection<"changelogs">>[1];
wranglerOnly?: boolean;
deprecationsOnly?: boolean;
}) {
let changelogs;

Expand All @@ -22,6 +23,12 @@ export async function getChangelogs(opts?: {
);
}

if (opts?.deprecationsOnly) {
changelogs = changelogs.filter((x) => x.id === "api-deprecations");
} else {
changelogs = changelogs.filter((x) => x.id !== "api-deprecations");
}

const products = [...new Set(changelogs.flatMap((x) => x.data.productName))];
const productAreas = [
...new Set(changelogs.flatMap((x) => x.data.productArea)),
Expand Down
Loading