Skip to content

Commit

Permalink
[ENG-1563] Add dynamic changelog link & remove old components (#2075)
Browse files Browse the repository at this point in the history
Add dynamic changelog link & remove old components
  • Loading branch information
utkubakir committed Feb 9, 2024
1 parent 7d12a89 commit 970c157
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 172 deletions.
13 changes: 11 additions & 2 deletions apps/landing/src/app/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ import Image from 'next/image';
import Link from 'next/link';
import { PropsWithChildren } from 'react';

import { getLatestRelease } from './docs/changelog/data';
import Logo from './logo.png';

export function Footer() {
export async function Footer() {
const latestRelease = await getLatestRelease();

return (
<footer id="footer" className="relative z-50 w-screen overflow-hidden pt-3 backdrop-blur">
<Image
Expand Down Expand Up @@ -70,7 +73,13 @@ export function Footer() {
<FooterLink link="/team">Team</FooterLink>
<FooterLink link="/docs/product/resources/faq">FAQ</FooterLink>
<FooterLink link="/careers">Careers</FooterLink>
<FooterLink link="/docs/changelog/beta/0.1.0">Changelog</FooterLink>
{latestRelease && (
<FooterLink
link={`/docs/changelog/${latestRelease.category}/${latestRelease.tag}`}
>
Changelog
</FooterLink>
)}
<FooterLink link="/blog">Blog</FooterLink>
</div>
<div className="col-span-1 flex flex-col space-y-2">
Expand Down
14 changes: 14 additions & 0 deletions apps/landing/src/app/docs/changelog/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,17 @@ export async function getReleasesCategories(): Promise<SectionMeta['categories']

return Object.values(categories);
}

export async function getLatestRelease(): Promise<{ tag: string; category: string } | undefined> {
const releases = await githubFetch(getRecentReleases);

for (const release of releases ?? []) {
if (!release.draft)
return {
tag: release.tag_name,
category: getReleaseFrontmatter(release).frontmatter.category
};
}

return undefined;
}
158 changes: 0 additions & 158 deletions apps/landing/src/components/Footer.tsx

This file was deleted.

12 changes: 0 additions & 12 deletions apps/landing/src/components/PageWrapper.tsx

This file was deleted.

0 comments on commit 970c157

Please sign in to comment.