From 68c1f26b68d297b5930110b0abb744553adcc870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilse=20=C3=85sbakk=20Resell?= Date: Wed, 7 Oct 2026 11:22:47 +0200 Subject: [PATCH] feat: add temp data adapter for browse page Add data/mockBooks.ts, which loads the backend's test-data/books.json and maps it into the client's Book shape (googleBooksId -> id). Saved/favorited books are not persisted: bookmark buttons reset on page reload. Update App.tsx to render the actual BrowsePage instead of the placeholder. BrowsePage itself is unchanged. --- client/src/App.tsx | 6 ++---- client/src/data/mockBooks.ts | 11 +++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 client/src/data/mockBooks.ts diff --git a/client/src/App.tsx b/client/src/App.tsx index 9e704ea..25cc53c 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -1,10 +1,8 @@ import { BrowserRouter, Routes, Route } from "react-router"; import AppShell from "./components/AppShell/AppShell"; +import { BrowsePage } from "./pages/BrowsePage"; /* ---------- Temporary placeholder pages (delete when the real ones exist) ---------- */ -function BrowsePlaceholder() { -return

Browse page

; -} function ShelfPlaceholder() { return

My shelf page

; } @@ -18,7 +16,7 @@ export default function App() { }> - } /> + } /> } /> } /> diff --git a/client/src/data/mockBooks.ts b/client/src/data/mockBooks.ts new file mode 100644 index 0000000..d1d408d --- /dev/null +++ b/client/src/data/mockBooks.ts @@ -0,0 +1,11 @@ +import type {Book} from '../types/book'; +import booksJson from '../../../server/test-data/books.json'; + +export type ShelfEntry = {bookId: Book['id']; rating?: number}; + +export const mockBooks: Book[] = booksJson.map(({googleBooksId, ...rest}) => ({ + id: googleBooksId, + ...rest, +})); + +export const mockShelfEntries: ShelfEntry[] = []; \ No newline at end of file