From b13f9b362c9642d6f726fa87e96807259265d362 Mon Sep 17 00:00:00 2001 From: Evan Reichard Date: Sun, 22 Mar 2026 13:36:02 -0400 Subject: [PATCH] theme draft 2 (done?) --- frontend/src/auth/ProtectedRoute.tsx | 4 +- frontend/src/components/Field.tsx | 2 +- frontend/src/components/Layout.tsx | 2 +- .../src/components/ReadingHistoryGraph.tsx | 16 +- frontend/src/components/Skeleton.tsx | 6 +- frontend/src/pages/ActivityPage.tsx | 9 +- frontend/src/pages/AdminImportPage.tsx | 29 ++- frontend/src/pages/AdminImportResultsPage.tsx | 28 +-- frontend/src/pages/AdminLogsPage.tsx | 8 +- frontend/src/pages/AdminPage.tsx | 57 ++--- frontend/src/pages/AdminUsersPage.tsx | 95 +++----- frontend/src/pages/ComponentDemoPage.tsx | 56 ++--- frontend/src/pages/DocumentPage.tsx | 204 ++++++------------ frontend/src/pages/HomePage.tsx | 97 +++------ frontend/src/pages/ProgressPage.tsx | 5 +- frontend/src/pages/RegisterPage.tsx | 10 +- frontend/src/pages/SearchPage.tsx | 44 ++-- frontend/src/pages/SettingsPage.tsx | 32 +-- 18 files changed, 257 insertions(+), 447 deletions(-) diff --git a/frontend/src/auth/ProtectedRoute.tsx b/frontend/src/auth/ProtectedRoute.tsx index d6be74d..cf3db8a 100644 --- a/frontend/src/auth/ProtectedRoute.tsx +++ b/frontend/src/auth/ProtectedRoute.tsx @@ -9,13 +9,11 @@ export function ProtectedRoute({ children }: ProtectedRouteProps) { const { isAuthenticated, isCheckingAuth } = useAuth(); const location = useLocation(); - // Show loading while checking authentication status if (isCheckingAuth) { - return
Loading...
; + return
Loading...
; } if (!isAuthenticated) { - // Redirect to login with the current location saved return ; } diff --git a/frontend/src/components/Field.tsx b/frontend/src/components/Field.tsx index ba34381..589d81a 100644 --- a/frontend/src/components/Field.tsx +++ b/frontend/src/components/Field.tsx @@ -9,7 +9,7 @@ interface FieldProps { export function Field({ label, children, isEditing: _isEditing = false }: FieldProps) { return (
-
{label}
+
{label}
{children}
); diff --git a/frontend/src/components/Layout.tsx b/frontend/src/components/Layout.tsx index d93cc49..c4b8eca 100644 --- a/frontend/src/components/Layout.tsx +++ b/frontend/src/components/Layout.tsx @@ -90,7 +90,7 @@ export default function Layout() { {isUserDropdownOpen && (
-
+
maxBX) { maxBX = lineX; @@ -164,8 +161,8 @@ export default function ReadingHistoryGraph({ data }: ReadingHistoryGraphProps) if (!data || data.length < 2) { return ( -
-

No data available

+
+

No data available

); } @@ -175,8 +172,8 @@ export default function ReadingHistoryGraph({ data }: ReadingHistoryGraphProps) return (
- - + +
{formatDate(point.date)} diff --git a/frontend/src/components/Skeleton.tsx b/frontend/src/components/Skeleton.tsx index 06a3ed0..72c25aa 100644 --- a/frontend/src/components/Skeleton.tsx +++ b/frontend/src/components/Skeleton.tsx @@ -15,7 +15,7 @@ export function Skeleton({ height, animation = 'pulse', }: SkeletonProps) { - const baseClasses = 'bg-gray-200 dark:bg-gray-600'; + const baseClasses = 'bg-surface-strong'; const variantClasses = { default: 'rounded', @@ -184,7 +184,7 @@ export function PageLoader({ message = 'Loading...', className = '' }: PageLoade return (
-
+

{message}

@@ -206,7 +206,7 @@ export function InlineLoader({ size = 'md', className = '' }: InlineLoaderProps) return (
); diff --git a/frontend/src/pages/ActivityPage.tsx b/frontend/src/pages/ActivityPage.tsx index e86341f..0699d04 100644 --- a/frontend/src/pages/ActivityPage.tsx +++ b/frontend/src/pages/ActivityPage.tsx @@ -13,10 +13,7 @@ export default function ActivityPage() { key: 'document_id' as const, header: 'Document', render: (_value, row) => ( - + {row.author || 'Unknown'} - {row.title || 'Unknown'} ), @@ -29,9 +26,7 @@ export default function ActivityPage() { { key: 'duration' as const, header: 'Duration', - render: value => { - return formatDuration(typeof value === 'number' ? value : 0); - }, + render: value => formatDuration(typeof value === 'number' ? value : 0), }, { key: 'end_percentage' as const, diff --git a/frontend/src/pages/AdminImportPage.tsx b/frontend/src/pages/AdminImportPage.tsx index 02abdc0..0427568 100644 --- a/frontend/src/pages/AdminImportPage.tsx +++ b/frontend/src/pages/AdminImportPage.tsx @@ -48,7 +48,6 @@ export default function AdminImportPage() { { onSuccess: _response => { showInfo('Import completed successfully'); - // Redirect to import results page after a short delay setTimeout(() => { window.location.href = '/admin/import-results'; }, 1500); @@ -65,22 +64,22 @@ export default function AdminImportPage() { }; if (isLoading && !currentPath) { - return
Loading...
; + return
Loading...
; } if (selectedDirectory) { return (
-
-

Selected Import Directory

+
+

Selected Import Directory

-
+

{selectedDirectory}

-
+
- - +
+ - - + - + {currentPath !== '/' && ( - - + - -
+ {currentPath}
+ @@ -153,12 +152,12 @@ export default function AdminImportPage() { ) : ( directories.map((item: DirectoryItem) => (
+ + diff --git a/frontend/src/pages/AdminImportResultsPage.tsx b/frontend/src/pages/AdminImportResultsPage.tsx index 034883c..43e27ce 100644 --- a/frontend/src/pages/AdminImportResultsPage.tsx +++ b/frontend/src/pages/AdminImportResultsPage.tsx @@ -8,27 +8,27 @@ export default function AdminImportResultsPage() { resultsData?.status === 200 ? (resultsData.data as ImportResultsResponse).results || [] : []; if (isLoading) { - return
Loading...
; + return
Loading...
; } return (
- - +
+ - - - - + {results.length === 0 ? ( - - diff --git a/frontend/src/pages/AdminLogsPage.tsx b/frontend/src/pages/AdminLogsPage.tsx index 94d2fbe..b3a3a59 100644 --- a/frontend/src/pages/AdminLogsPage.tsx +++ b/frontend/src/pages/AdminLogsPage.tsx @@ -26,18 +26,18 @@ export default function AdminLogsPage() { return (
-
+
- + setFilter(e.target.value)} - className="w-full flex-1 appearance-none rounded-none border border-gray-300 bg-white p-2 text-base text-gray-700 shadow-sm placeholder:text-gray-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-purple-600" + className="w-full flex-1 appearance-none rounded-none border border-border bg-surface p-2 text-base text-content shadow-sm placeholder:text-content-subtle focus:border-transparent focus:outline-none focus:ring-2 focus:ring-primary-600" placeholder="JQ Filter" />
@@ -51,7 +51,7 @@ export default function AdminLogsPage() {
{isLoading ? ( diff --git a/frontend/src/pages/AdminPage.tsx b/frontend/src/pages/AdminPage.tsx index e85cb85..fccc11a 100644 --- a/frontend/src/pages/AdminPage.tsx +++ b/frontend/src/pages/AdminPage.tsx @@ -42,19 +42,14 @@ export default function AdminPage() { const filename = `AnthoLumeBackup_${new Date().toISOString().replace(/[:.]/g, '')}.zip`; - // Stream the response directly to disk using File System Access API - // This avoids loading multi-GB files into browser memory if ('showSaveFilePicker' in window && typeof window.showSaveFilePicker === 'function') { try { - // Modern browsers: Use File System Access API for direct disk writes const handle = await window.showSaveFilePicker({ suggestedName: filename, types: [{ description: 'ZIP Archive', accept: { 'application/zip': ['.zip'] } }], }); const writable = await handle.createWritable(); - - // Stream response body directly to file without buffering const reader = response.body?.getReader(); if (!reader) throw new Error('Unable to read response'); @@ -67,13 +62,11 @@ export default function AdminPage() { await writable.close(); showInfo('Backup completed successfully'); } catch (err) { - // User cancelled or error if ((err as Error).name !== 'AbortError') { showError('Backup failed: ' + (err as Error).message); } } } else { - // Fallback for older browsers showError( 'Your browser does not support large file downloads. Please use Chrome, Edge, or Safari.' ); @@ -113,52 +106,34 @@ export default function AdminPage() { const handleMetadataMatch = () => { postAdminAction.mutate( + { data: { action: 'METADATA_MATCH' } }, { - data: { - action: 'METADATA_MATCH', - }, - }, - { - onSuccess: () => { - showInfo('Metadata matching started'); - }, - onError: error => { - showError('Metadata matching failed: ' + getErrorMessage(error)); - }, + onSuccess: () => showInfo('Metadata matching started'), + onError: error => showError('Metadata matching failed: ' + getErrorMessage(error)), } ); }; const handleCacheTables = () => { postAdminAction.mutate( + { data: { action: 'CACHE_TABLES' } }, { - data: { - action: 'CACHE_TABLES', - }, - }, - { - onSuccess: () => { - showInfo('Cache tables started'); - }, - onError: error => { - showError('Cache tables failed: ' + getErrorMessage(error)); - }, + onSuccess: () => showInfo('Cache tables started'), + onError: error => showError('Cache tables failed: ' + getErrorMessage(error)), } ); }; if (isLoading) { - return
Loading...
; + return
Loading...
; } return (
- {/* Backup & Restore Card */} -
-

Backup & Restore

+
+

Backup & Restore

- {/* Backup Form */} - +
- {/* Restore Form */} -
+
- {/* Tasks Card */} -
-

Tasks

-
+ Document + Status + Error
@@ -39,22 +39,24 @@ export default function AdminImportResultsPage() { results.map((result: ImportResult, index: number) => (
- Name: + Name: {result.id ? ( - {result.name} + + {result.name} + ) : ( N/A )} - File: + File: {result.path} +

{result.status}

+

{result.error || ''}

- +
+

Tasks

+
+

Metadata Matching

diff --git a/frontend/src/pages/AdminUsersPage.tsx b/frontend/src/pages/AdminUsersPage.tsx index 533fb00..7597193 100644 --- a/frontend/src/pages/AdminUsersPage.tsx +++ b/frontend/src/pages/AdminUsersPage.tsx @@ -39,9 +39,7 @@ export default function AdminUsersPage() { setNewIsAdmin(false); refetch(); }, - onError: error => { - showError('Failed to create user: ' + getErrorMessage(error)); - }, + onError: error => showError('Failed to create user: ' + getErrorMessage(error)), } ); }; @@ -49,19 +47,14 @@ export default function AdminUsersPage() { const handleDeleteUser = (userId: string) => { updateUser.mutate( { - data: { - operation: 'DELETE', - user: userId, - }, + data: { operation: 'DELETE', user: userId }, }, { onSuccess: () => { showInfo('User deleted successfully'); refetch(); }, - onError: error => { - showError('Failed to delete user: ' + getErrorMessage(error)); - }, + onError: error => showError('Failed to delete user: ' + getErrorMessage(error)), } ); }; @@ -71,20 +64,14 @@ export default function AdminUsersPage() { updateUser.mutate( { - data: { - operation: 'UPDATE', - user: userId, - password, - }, + data: { operation: 'UPDATE', user: userId, password }, }, { onSuccess: () => { showInfo('Password updated successfully'); refetch(); }, - onError: error => { - showError('Failed to update password: ' + getErrorMessage(error)); - }, + onError: error => showError('Failed to update password: ' + getErrorMessage(error)), } ); }; @@ -92,50 +79,40 @@ export default function AdminUsersPage() { const handleToggleAdmin = (userId: string, isAdmin: boolean) => { updateUser.mutate( { - data: { - operation: 'UPDATE', - user: userId, - is_admin: isAdmin, - }, + data: { operation: 'UPDATE', user: userId, is_admin: isAdmin }, }, { onSuccess: () => { - const role = isAdmin ? 'admin' : 'user'; - showInfo(`User permissions updated to ${role}`); + showInfo(`User permissions updated to ${isAdmin ? 'admin' : 'user'}`); refetch(); }, - onError: error => { - showError('Failed to update admin status: ' + getErrorMessage(error)); - }, + onError: error => showError('Failed to update admin status: ' + getErrorMessage(error)), } ); }; if (isLoading) { - return
Loading...
; + return
Loading...
; } return (
{showAddForm && ( -
- +
+ setNewUsername(e.target.value)} placeholder="Username" - className="bg-gray-300 p-2 text-black dark:bg-gray-700 dark:text-white" + className="bg-surface p-2 text-content" /> setNewPassword(e.target.value)} placeholder="Password" - className="bg-gray-300 p-2 text-black dark:bg-gray-700 dark:text-white" + className="bg-surface p-2 text-content" />
Admin