From 7cdeb98161995cb3425201a04d698e08ca620bf9 Mon Sep 17 00:00:00 2001 From: johannes-hernehult Date: Wed, 17 Jun 2026 11:12:25 +0200 Subject: [PATCH] feat(guides): integrate GuideContext and persist new guides to IndexedDB - Wrap application root with IDBProvider and GuideProvider - Replace mock data in App component with real guides from useGuides hook - Update useNewGuide hook to save compiled guides to IndexedDB and update global state --- src/App.tsx | 8 +--- src/features/guides/hooks/useNewGuide.ts | 21 ++++++++- src/lib/contexts/dbinit.context.tsx | 55 ++++++++++++++++++++++++ src/lib/contexts/guide.context.tsx | 48 +++++++++++++++++++++ src/lib/db.ts | 19 ++++++++ src/main.tsx | 8 +++- 6 files changed, 150 insertions(+), 9 deletions(-) create mode 100644 src/lib/contexts/dbinit.context.tsx create mode 100644 src/lib/contexts/guide.context.tsx create mode 100644 src/lib/db.ts diff --git a/src/App.tsx b/src/App.tsx index aeaa96f..baa3960 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,13 +2,10 @@ import "./styles/reset.css"; import "./styles/App.css"; import { Outlet } from "react-router"; import { Link } from "react-router"; +import { useGuides } from "./lib/contexts/guide.context"; function App() { - const guides = [ - { id: 1, title: "Guide 1" }, - { id: 2, title: "Guide 2" }, - { id: 3, title: "Guide 3" }, - ]; + const { guides } = useGuides(); return ( <> @@ -18,7 +15,6 @@ function App() {