From fcc5ad135aa87c85f4ae5b26fd354c8618ca63cb Mon Sep 17 00:00:00 2001 From: Benson Wong Date: Sun, 17 Aug 2025 09:42:06 -0700 Subject: [PATCH] UI: Allow editing of title (#246) - make

title contentEditable - title setting persists across reloads in localStorage --- ui/src/App.tsx | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 85050db0..b6493b1b 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -1,3 +1,4 @@ +import { useEffect, useCallback } from "react"; import { BrowserRouter as Router, Routes, Route, Navigate, NavLink } from "react-router-dom"; import { useTheme } from "./contexts/ThemeProvider"; import { APIProvider } from "./contexts/APIProvider"; @@ -6,9 +7,23 @@ import ModelPage from "./pages/Models"; import ActivityPage from "./pages/Activity"; import ConnectionStatus from "./components/ConnectionStatus"; import { RiSunFill, RiMoonFill } from "react-icons/ri"; +import { usePersistentState } from "./hooks/usePersistentState"; function App() { const { isNarrow, toggleTheme, isDarkMode } = useTheme(); + const [appTitle, setAppTitle] = usePersistentState("app-title", "llama-swap"); + + const handleTitleChange = useCallback( + (newTitle: string) => { + setAppTitle(newTitle); + document.title = newTitle; + }, + [setAppTitle] + ); + + useEffect(() => { + document.title = appTitle; // Set initial title + }, [appTitle]); return ( @@ -16,7 +31,28 @@ function App() {