Merge branch 'main' into system-color-preference

This commit is contained in:
Waled Khatiz
2024-09-03 09:21:55 +10:00
committed by GitHub
40 changed files with 4624 additions and 396 deletions

7
src/app/.env/page.tsx Normal file
View File

@@ -0,0 +1,7 @@
import { redirect } from "next/navigation";
export default function WhyAreYouEvenHere() {
redirect("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
return null;
}

View File

@@ -6,8 +6,6 @@ export default function BrandingAssetsPage() {
return (
<main className="flex min-h-screen flex-col items-center justify-start">
<BrandingAssets />
<Footer />
<Navigation /> {/* At the bottom of the page */}
</main>
);
}

View File

@@ -6,8 +6,6 @@ export default function BrandingAssetsPage() {
return (
<main className="flex min-h-screen flex-col items-center justify-start">
<CreateThemePage />
<Footer />
<Navigation /> {/* At the bottom of the page */}
</main>
);
}

View File

@@ -7,8 +7,6 @@ export default function Download() {
return (
<main className="flex min-h-screen flex-col items-center justify-start">
<DownloadPage />
<Footer />
<Navigation /> {/* At the bottom of the page */}
</main>
);
}

View File

@@ -1,110 +0,0 @@
import { Feed } from "feed";
import { releaseNotes } from "@/lib/release-notes";
import type { ReleaseNote } from "@/lib/release-notes";
// Force feed.xml to be cached as static and remain constant for the lifetime of the current site build.
// The supplied releaseNotes array is constant per build, so this will always be the latest release notes.
export const dynamic = "force-static";
/** The default number of entries to include in the RSS feed. */
const RSS_ENTRY_LIMIT = 20;
/**
* Handles the GET request for the `feed.xml` endpoint.
* @returns The RSS feed for the Zen Browser release notes.
*/
export async function GET() {
// Just in case the release notes array is empty for whatever reason.
const latestDate = releaseNotes.length > 0
? formatRssDate(releaseNotes[0].date)
: new Date();
const feed = new Feed({
id: "https://www.zen-browser.app/release-notes",
link: "https://www.zen-browser.app/release-notes",
title: "Zen Browser Release Notes",
description: "Release Notes for the Zen Browser",
language: "en",
favicon: "https://www.zen-browser.app/favicon.ico",
copyright: `Zen Browser © ${new Date().getFullYear()} - Made with ❤️ by the Zen team.`,
updated: latestDate,
});
for (const releaseNote of releaseNotes.slice(0, RSS_ENTRY_LIMIT)) {
feed.addItem({
title: `Release notes for version ${releaseNote.version}`,
id: `https://www.zen-browser.app/release-notes/${releaseNote.version}`,
link: `https://www.zen-browser.app/release-notes/${releaseNote.version}`,
date: formatRssDate(releaseNote.date),
description: releaseNote.extra,
content: formatReleaseNote(releaseNote),
});
}
return new Response(feed.rss2(), {
headers: {
'Content-Type': 'application/xml; charset=utf-8',
},
});
}
/**
* Formats a date string in the format day/month/year.
*
* Note: If release notes change to ISO format, this will need to be updated.
* @param dateStr The date string to format.
* @returns The passed in date string as a Date object.
*/
function formatRssDate(dateStr: string) {
const splitDate = dateStr.split("/");
if (splitDate.length !== 3) {
throw new Error("Invalid date format");
}
const day = Number(splitDate[0]);
const month = Number(splitDate[1]) - 1;
const year = Number(splitDate[2]);
return new Date(year, month, day);
}
/**
* Formats the release note entry for use as the content of the RSS feed.
* @param releaseNote The release note to format.
* @returns The formatted release note as a HTML string.
*/
function formatReleaseNote(releaseNote: ReleaseNote) {
let content = "<p>If you encounter any issues, please report them on <a href=\"https://github.com/zen-browser/desktop/issues/\">the issues page</a>. Thanks everyone for your feedback! ❤️</p>";
if (releaseNote.extra) {
content += `<p>${releaseNote.extra.replace(/(\n)/g, "<br />")}</p>`
}
if (releaseNote.breakingChanges) {
content += `<h2>⚠️ Breaking changes</h2>`
content += `<ul>`
for (const breakingChange of releaseNote.breakingChanges) {
content += `<li>${breakingChange}</li>`
}
content += `</ul>`
}
if (releaseNote.features) {
content += `<h2>⭐ Features</h2>`
content += `<ul>`
for (const feature of releaseNote.features) {
content += `<li>${feature}</li>`
}
content += `</ul>`
}
if (releaseNote.fixes) {
content += `<h2>✓ Fixes</h2>`
content += `<ul>`
for (const fix of releaseNote.fixes) {
content += `<li>${fix.description}</li>`
}
content += `</ul>`
}
return content;
}

View File

@@ -3,8 +3,8 @@ import { Inter } from "next/font/google";
import "./globals.css";
import { ThemeProvider } from "@/components/theme-provider";
import StyledComponentsRegistry from "@/lib/styled-components-registry";
import {NextIntlClientProvider} from 'next-intl';
import {getLocale, getMessages} from 'next-intl/server';
import Footer from "@/components/footer";
import { Navigation } from "@/components/navigation";
const inter = Inter({ subsets: ["latin"] });
@@ -19,26 +19,27 @@ export default async function RootLayout({
}: Readonly<{
children: React.ReactNode;
}>) {
const locale = await getLocale();
const messages = await getMessages();
return (
<html lang={locale} suppressHydrationWarning>
<html suppressHydrationWarning>
<head>
<link rel="me" href="https://fosstodon.org/@zenbrowser"></link>
<link rel="alternate" type="application/rss+xml" title="Zen Browser Release Notes" href="https://www.zen-browser.app/feed.xml" />
</head>
<body className={inter.className}>
<NextIntlClientProvider messages={messages}>
<ThemeProvider
attribute="class"
enableSystem
disableTransitionOnChange
>
<StyledComponentsRegistry>{children}</StyledComponentsRegistry>
</ThemeProvider>
</NextIntlClientProvider>
<ThemeProvider
attribute="class"
enableSystem
disableTransitionOnChange
>
<StyledComponentsRegistry>
<div>
{children}
<Footer />
<Navigation /> {/* At the bottom of the page */}
</div>
</StyledComponentsRegistry>
</ThemeProvider>
</body>
</html>
);

8
src/app/not-found.tsx Normal file
View File

@@ -0,0 +1,8 @@
export default function NotFoundPage() {
return (
<main className="flex min-h-screen flex-col items-center justify-start">
<h1>404</h1>
</main>
);
}

View File

@@ -10,8 +10,6 @@ export default function Home() {
<main className="flex min-h-screen overflow-x-hidden flex-col items-center justify-start">
<Header />
<Features />
<Footer />
<Navigation /> {/* At the bottom of the page */}
</main>
);
}

View File

@@ -83,7 +83,7 @@ You can also optionally enable telemetry data collection and other Mozilla Resea
# 9. Contact Us
If you have any questions or concerns about this Privacy Policy or Zen Browser, please contact us at:
* Discord: [Zen Browser's Discord](https://discord.gg/nnShMQzR4b)
* Discord: [Zen Browser's Discord](https://discord.com/servers/mauro-s-little-sweatshop-1088172780480114748)
* GitHub: [Organization](https://github.com/zen-browser)
---
@@ -91,8 +91,6 @@ If you have any questions or concerns about this Privacy Policy or Zen Browser,
By using Zen Browser, you agree to this Privacy Policy. Remember, with Zen, your privacy is in your hands.`}
</Markdown>
</div>
<Footer />
<Navigation /> {/* At the bottom of the page */}
</main>
)
}

View File

@@ -30,16 +30,12 @@ export default function ReleaseNotePage({ params }: { params: { version: string
</Button>
</a>
</div>
<Footer />
<Navigation /> {/* At the bottom of the page */}
</main>
);
}
return (
<main className="flex min-h-screen flex-col items-center justify-center">
<ReleaseNote data={releaseNote} />
<Footer />
<Navigation /> {/* At the bottom of the page */}
</main>
);
}

View File

@@ -28,8 +28,6 @@ export default function ReleaseNotes() {
))}
</div>
</div>
<Footer />
<Navigation /> {/* At the bottom of the page */}
</main>
)
}

View File

@@ -49,8 +49,6 @@ export default async function ThemeInfoPage({ params }: { params: { theme: strin
return (
<main className="flex min-h-screen flex-col items-center justify-start">
<ThemePage themeID={theme} />
<Footer />
<Navigation /> {/* At the bottom of the page */}
</main>
);
}

View File

@@ -2,13 +2,13 @@
import Footer from "@/components/footer";
import MarketplacePage from "@/components/marketplace";
import { Navigation } from "@/components/navigation";
import { getAllThemes, ZenTheme } from "@/lib/themes";
import { GetStaticProps } from "next";
export default function ThemesMarketplace() {
export default async function ThemesMarketplace() {
return (
<main className="flex min-h-screen flex-col items-center justify-start">
<MarketplacePage />
<Footer />
<Navigation /> {/* At the bottom of the page */}
<MarketplacePage themes={await getAllThemes()} />
</main>
);
}

View File

@@ -7,8 +7,6 @@ export default function Download() {
return (
<main className="flex min-h-screen flex-col items-center justify-start">
<WelcomePage />
<Footer />
<Navigation /> {/* At the bottom of the page */}
</main>
);
}