From a4997a5fbc65913b55f2215eb3b868693bd76c51 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Sat, 14 Feb 2026 10:03:35 -0800 Subject: test: increase frontend coverage for Settings and improve FeedItem css --- frontend/coverage/src/App.tsx.html | 205 +++++++++++++++++++++---------------- 1 file changed, 119 insertions(+), 86 deletions(-) (limited to 'frontend/coverage/src/App.tsx.html') diff --git a/frontend/coverage/src/App.tsx.html b/frontend/coverage/src/App.tsx.html index ed02366..cd305cc 100644 --- a/frontend/coverage/src/App.tsx.html +++ b/frontend/coverage/src/App.tsx.html @@ -1,61 +1,68 @@ + - + + Code coverage report for src/App.tsx - - - - -
-
+ + + +
+

All files / src App.tsx

-
-
- 78.94% - Statements - 15/19 -
- -
- 66.66% - Branches - 4/6 -
- -
- 77.77% - Functions - 7/9 -
- -
- 78.94% - Lines - 15/19 -
+
+ +
+ 72.72% + Statements + 16/22 +
+ + +
+ 62.5% + Branches + 10/16 +
+ + +
+ 62.5% + Functions + 5/8 +
+ + +
+ 72.72% + Lines + 16/22 +
+ +

- Press n or j to go to the next uncovered block, b, - p or k for the previous block. + Press n or j to go to the next uncovered block, b, p or k for the previous block.

-
-
-

+    
+    
+
1 2 3 @@ -146,7 +153,17 @@ 88 89 90 -91  +91 +92 +93 +94 +95 +96 +97 +98 +99 +100  +        @@ -185,16 +202,18 @@     1x +  1x         +  +  +        -1x -1x       @@ -215,8 +234,14 @@       +2x +  +2x +  +      +2x   2x   @@ -237,9 +262,10 @@      
import React, { useEffect, useState } from 'react';
-import { BrowserRouter, Routes, Route, Navigate, useLocation, useNavigate } from 'react-router-dom';
+import { BrowserRouter, Routes, Route, Navigate, useLocation } from 'react-router-dom';
 import Login from './components/Login';
 import './App.css';
+import { apiFetch } from './utils';
  
 // Protected Route wrapper
 function RequireAuth({ children }: { children: React.ReactElement }) {
@@ -247,7 +273,7 @@ function RequireAuth({ children }: { children: React.ReactElement }) {
   const location = useLocation();
  
   useEffect(() => {
-    fetch('/api/auth')
+    apiFetch('/api/auth')
       .then((res) => {
         if (res.ok) {
           setAuth(true);
@@ -273,26 +299,25 @@ import FeedList from './components/FeedList';
 import FeedItems from './components/FeedItems';
 import Settings from './components/Settings';
  
-function Dashboard() {
-  const navigate = useNavigate();
-  return (
-    <div className="dashboard">
-      <header className="dashboard-header">
-        <h1>Neko Reader</h1>
-        <nav>
-          <button onClick={() => navigate('/settings')} className="nav-link" style={{ color: 'white', marginRight: '1rem', background: 'none', border: 'none', cursor: 'pointer', fontSize: 'inherit', fontFamily: 'inherit' }}>Settings</button>
+function Dashboard({ theme, setTheme }: { theme: string; setTheme: (t: string) => void }) {
+  const [sidebarVisible, setSidebarVisible] = useState(true);
  
-          <button onClick={() => {
-            fetch('/api/logout', { method: 'POST' })
-              .then(() => window.location.href = '/v2/login');
-          }} className="logout-btn">
-            Logout
-          </button>
-        </nav>
-      </header>
+  return (
+    <div
+      className={`dashboard ${sidebarVisible ? 'sidebar-visible' : 'sidebar-hidden'} theme-${theme}`}
+    >
       <div className="dashboard-content">
-        <aside className="dashboard-sidebar">
-          <FeedList />
+        {!sidebarVisible && (
+          <button
+            className="sidebar-toggle fixed-toggle"
+            onClick={() => setSidebarVisible(true)}
+            title="Show Sidebar"
+          >
+            🐱
+          </button>
+        )}
+        <aside className={`dashboard-sidebar ${sidebarVisible ? '' : 'hidden'}`}>
+          <FeedList theme={theme} setTheme={setTheme} setSidebarVisible={setSidebarVisible} />
         </aside>
         <main className="dashboard-main">
           <Routes>
@@ -308,15 +333,24 @@ function Dashboard() {
 }
  
 function App() {
+  const [theme, setTheme] = useState(localStorage.getItem('neko-theme') || 'light');
+ 
+  const handleSetTheme = (newTheme: string) => {
+    setTheme(newTheme);
+    localStorage.setItem('neko-theme', newTheme);
+  };
+ 
+  const basename = window.location.pathname.startsWith('/v2') ? '/v2' : '/';
+ 
   return (
-    <BrowserRouter basename="/v2">
+    <BrowserRouter basename={basename}>
       <Routes>
         <Route path="/login" element={<Login />} />
         <Route
           path="/*"
           element={
             <RequireAuth>
-              <Dashboard />
+              <Dashboard theme={theme} setTheme={handleSetTheme} />
             </RequireAuth>
           }
         />
@@ -328,22 +362,21 @@ function App() {
 export default App;
  
-
- -
- - - - - - - +
+
+ + + + + + + \ No newline at end of file -- cgit v1.2.3