From d51169f6411b68a226d76d2d39826904de484929 Mon Sep 17 00:00:00 2001
From: Ariel Costas Guerrero <ariel@costas.dev>
Date: Wed, 19 Nov 2025 15:04:55 +0100
Subject: feat: Add About and Favourites pages, update routing and context
 management

- Added new routes for About and Favourites pages.
- Implemented About page with version information and credits.
- Created Favourites page with a placeholder message for empty favourites.
- Refactored RegionConfig import paths for consistency.
- Introduced PageTitleContext to manage page titles dynamically.
- Updated various components to utilize the new context for setting page titles.
- Enhanced AppShell layout with a responsive Drawer for navigation.
- Added CSS styles for new components and pages.
- Integrated commit hash display in the About page for version tracking.
---
 src/frontend/app/contexts/PageTitleContext.tsx | 46 ++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 src/frontend/app/contexts/PageTitleContext.tsx

(limited to 'src/frontend/app/contexts/PageTitleContext.tsx')

diff --git a/src/frontend/app/contexts/PageTitleContext.tsx b/src/frontend/app/contexts/PageTitleContext.tsx
new file mode 100644
index 0000000..396e409
--- /dev/null
+++ b/src/frontend/app/contexts/PageTitleContext.tsx
@@ -0,0 +1,46 @@
+import React, { createContext, useContext, useEffect, useState } from "react";
+
+interface PageTitleContextProps {
+  title: string;
+  setTitle: (title: string) => void;
+}
+
+const PageTitleContext = createContext<PageTitleContextProps | undefined>(
+  undefined
+);
+
+export const PageTitleProvider: React.FC<{ children: React.ReactNode }> = ({
+  children,
+}) => {
+  const [title, setTitle] = useState("Busurbano");
+
+  return (
+    <PageTitleContext.Provider value={{ title, setTitle }}>
+      {children}
+    </PageTitleContext.Provider>
+  );
+};
+
+export const usePageTitleContext = () => {
+  const context = useContext(PageTitleContext);
+  if (!context) {
+    throw new Error("usePageTitleContext must be used within a PageTitleProvider");
+  }
+  return context;
+};
+
+export const usePageTitle = (title: string) => {
+  const { setTitle } = usePageTitleContext();
+
+  useEffect(() => {
+    setTitle(title);
+    document.title = `${title} - Busurbano`;
+
+    return () => {
+      // Optional: Reset title on unmount?
+      // Usually not needed as the next page will set its own title.
+      // But if we navigate to a page without usePageTitle, it might be stale.
+      // Let's leave it for now.
+    };
+  }, [title, setTitle]);
+};
-- 
cgit v1.3

