From db9ea632107ed1e544b0980f7af174fbba66e9b6 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Sun, 26 Oct 2025 16:07:57 +0100 Subject: [PATCH] Add what's new page --- common/src/constants.ts | 13 +++--- web/components/page-base.tsx | 4 +- web/pages/news.tsx | 78 ++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 web/pages/news.tsx diff --git a/common/src/constants.ts b/common/src/constants.ts index ab2b65fc..2624af12 100644 --- a/common/src/constants.ts +++ b/common/src/constants.ts @@ -1,10 +1,11 @@ export const MIN_INT = Number.MIN_SAFE_INTEGER export const MAX_INT = Number.MAX_SAFE_INTEGER -export const supportEmail = 'hello@compassmeet.com'; -// export const marketingEmail = 'hello@compassmeet.com'; +export const supportEmail = 'hello@compassmeet.com' +// export const marketingEmail = 'hello@compassmeet.com' -export const githubRepo = "https://github.com/CompassConnections/Compass"; +export const githubRepoSlug = "CompassConnections/Compass" +export const githubRepo = `https://github.com/${githubRepoSlug}` export const githubIssues = `${githubRepo}/issues` export const paypalLink = "https://www.paypal.com/paypalme/CompassConnections" @@ -16,9 +17,9 @@ export const redditLink = "https://www.reddit.com/r/CompassConnect" export const xLink = "https://x.com/compassmeet" export const formLink = "https://forms.gle/tKnXUMAbEreMK6FC6" -export const pStyle = "mt-1 text-gray-800 dark:text-white whitespace-pre-line"; +export const pStyle = "mt-1 text-gray-800 dark:text-white whitespace-pre-line" -export const IS_MAINTENANCE = false; // set to true to enable maintenance mode banner +export const IS_MAINTENANCE = false // set to true to enable the maintenance mode banner -export const MIN_BIO_LENGTH = 250; +export const MIN_BIO_LENGTH = 250 diff --git a/web/components/page-base.tsx b/web/components/page-base.tsx index 2e7abc74..c8e8588a 100644 --- a/web/components/page-base.tsx +++ b/web/components/page-base.tsx @@ -1,4 +1,4 @@ -import {HomeIcon, QuestionMarkCircleIcon} from '@heroicons/react/outline' +import {HomeIcon, NewspaperIcon, QuestionMarkCircleIcon} from '@heroicons/react/outline' import { GlobeAltIcon, HomeIcon as SolidHomeIcon, @@ -117,11 +117,13 @@ const Social = {name: 'Social', href: '/social', icon: LinkIcon}; const Organization = {name: 'Organization', href: '/organization', icon: GlobeAltIcon}; const Vote = {name: 'Vote', href: '/vote', icon: MdThumbUp}; const Contact = {name: 'Contact', href: '/contact', icon: FaEnvelope}; +const News = {name: "What's new", href: '/news', icon: NewspaperIcon}; const base = [ About, faq, Vote, + News, Social, Organization, Contact, diff --git a/web/pages/news.tsx b/web/pages/news.tsx new file mode 100644 index 00000000..7c18384b --- /dev/null +++ b/web/pages/news.tsx @@ -0,0 +1,78 @@ +import React, {useEffect, useState} from "react" +import axios from "axios" +import ReactMarkdown from "react-markdown" +import {PageBase} from "web/components/page-base" +import {SEO} from "web/components/SEO" +import {Col} from "web/components/layout/col" +import {Title} from "web/components/widgets/title" +import Link from "next/link" +import {CompassLoadingIndicator} from "web/components/widgets/loading-indicator" +import {githubRepoSlug} from "common/constants"; + +type Release = { + id: number + name: string + tag_name: string + body: string + published_at: string + html_url: string +} + +export default function WhatsNew() { + const [releases, setReleases] = useState([]) + const [loading, setLoading] = useState(true) + const [error, setError] = useState(null) + + useEffect(() => { + async function fetchReleases() { + try { + const response = await axios.get( + `https://api.github.com/repos/${githubRepoSlug}/releases`, + { + headers: { + // Optional: if hitting rate limits, use a GitHub token + // Authorization: `token ${process.env.REACT_APP_GITHUB_TOKEN}` + }, + } + ) + setReleases(response.data) + } catch (err) { + setError("Failed to fetch releases") + } finally { + setLoading(false) + } + } + + fetchReleases() + }, []) + + return ( + + + What's New + {loading ? : + error ?

{error}

: + + {releases.map((release: Release) => ( +
+
+

{release.name || release.tag_name}

+ + {new Date(release.published_at).toLocaleDateString()} + +
+
+ {release.body || "_No release notes provided._"} +
+ View on GitHub +
+ ))} + + } +
+ ) +}