From 9ecbce5a15882f4e7e499929c85f8488eb661445 Mon Sep 17 00:00:00 2001 From: Owen Date: Wed, 3 Jun 2026 10:02:53 +0200 Subject: [PATCH] pgnviewer lazy load and suspense --- TODO | 9 ++-- src/pages/Chessboard.tsx | 101 ++++++++++++++++++++++----------------- 2 files changed, 61 insertions(+), 49 deletions(-) diff --git a/TODO b/TODO index 10b2ad3..e38941a 100644 --- a/TODO +++ b/TODO @@ -3,12 +3,9 @@ FEN string Env Vars API base URL -- favicon and page titles +- favicon and page titles - SEO related things - rearrange buttons / header space - collapse on smaller screens - - Loading Chessboard with suspense and spinner -- toasts - - Lichess login - -- logger \ No newline at end of file +- logger +- contact form \ No newline at end of file diff --git a/src/pages/Chessboard.tsx b/src/pages/Chessboard.tsx index 9cc8d7c..b208d1a 100644 --- a/src/pages/Chessboard.tsx +++ b/src/pages/Chessboard.tsx @@ -1,10 +1,23 @@ +import { lazy, Suspense } from "react"; import CustomHeaders from "#/components/CustomHeaders.tsx"; import HeaderFields from "#/components/HeaderFields.tsx"; import LichessButton from "#/components/LichessButton.tsx"; -import PgnViewer from "#/components/PgnViewer.tsx"; import Section from "#/components/Section.tsx"; import { useChessGame } from "#/hooks/useChessGame.ts"; +const PgnViewer = lazy(() => import("#/components/PgnViewer.tsx")); + +const LoadingBoard = () => { + return ( +
+

Loading...

+
+
+
+
+ ); +}; + const Chessboard = () => { const { gameState, @@ -35,51 +48,53 @@ const Chessboard = () => {
-
- -
- -
-
-
+