From 3d1d33c2aac15e07c3b840a1fb9428e3feda8330 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Fri, 3 Oct 2025 02:25:55 -0700 Subject: initial firebase fcm implementation --- site/src/pages/Homepage.tsx | 125 +++++++++++++++++++++++++++----------------- 1 file changed, 78 insertions(+), 47 deletions(-) (limited to 'site/src/pages') diff --git a/site/src/pages/Homepage.tsx b/site/src/pages/Homepage.tsx index 2f35280..db658ca 100644 --- a/site/src/pages/Homepage.tsx +++ b/site/src/pages/Homepage.tsx @@ -4,6 +4,7 @@ import { useParams, useSearchParams } from "react-router-dom"; import { getGameTitle } from "../utils.ts"; import TitleBar from "../components/TitleBar"; import { GameNotes } from "../components/GameNotes"; +import NotificationButton from "../components/NotificationButton"; interface ArcadeNewsAPIData { fetch_time: number; @@ -14,8 +15,9 @@ export default function Home() { const { gameId } = useParams<{ gameId?: string }>(); const [searchParams] = useSearchParams(); const isMoe = searchParams.has("moe"); - const rssFeedUrl = import.meta.env.VITE_NEWS_BASE_URL + "/" +gameId + "_news.xml"; - const newsAPIBase = import.meta.env.VITE_NEWS_BASE_URL + const rssFeedUrl = + import.meta.env.VITE_NEWS_BASE_URL + "/" + gameId + "_news.xml"; + const newsAPIBase = import.meta.env.VITE_NEWS_BASE_URL; const [newsFeedData, setNewsFeedData] = useState( null, @@ -29,9 +31,7 @@ export default function Home() { setError(false); const newsDataFileName = gameId ? `${gameId}_news.json` : "news.json"; try { - const response = await fetch( - newsAPIBase+"/" + `${newsDataFileName}`, - ); + const response = await fetch(newsAPIBase + "/" + `${newsDataFileName}`); if (!response.ok) { throw new Error(`Failed to fetch news: ${response.statusText}`); } @@ -70,21 +70,31 @@ export default function Home() { className={`${isMoe ? "bg-pink-100" : "bg-gray-950"} min-h-screen flex items-center justify-center`} >
-
+
404
-

+

News Not Found

-

+

{gameId ? `Unable to fetch news for ${getGameTitle(gameId)}` - : "Unable to fetch news feed" - } + : "Unable to fetch news feed"}

-
-

- The news feed you're looking for might be temporarily unavailable or doesn't exist. +

+

+ The news feed you're looking for might be temporarily + unavailable or doesn't exist.

) : ( - + SECOND STYLE + +
+ +
+

+ News and Information for various arcade games is aggregated + here! +

+

+ RSS feeds are available on each game's individual page +

+

+ Please see the{" "} + + GitHub + {" "} + for API information +

+
+
+ + Receive Notifications + +
+ +

+ Enables notifications for the main feed +

+
+
+
+
+ )} - +