From fa9a154c5d5809ce6d73cc7b6a12b1ccc1741faf Mon Sep 17 00:00:00 2001 From: maziggy Date: Wed, 21 Jan 2026 16:51:17 +0100 Subject: [PATCH] Added back navigation to user management page --- frontend/src/pages/SettingsPage.tsx | 45 +- frontend/src/pages/UsersPage.tsx | 37 +- static/assets/index-BK0uiRXP.js | 8665 --------------------------- static/assets/index-BNJwArDp.js | 8665 +++++++++++++++++++++++++++ static/index.html | 2 +- 5 files changed, 8722 insertions(+), 8692 deletions(-) delete mode 100644 static/assets/index-BK0uiRXP.js create mode 100644 static/assets/index-BNJwArDp.js diff --git a/frontend/src/pages/SettingsPage.tsx b/frontend/src/pages/SettingsPage.tsx index 7204698ba..7527ac7e3 100644 --- a/frontend/src/pages/SettingsPage.tsx +++ b/frontend/src/pages/SettingsPage.tsx @@ -1,7 +1,7 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; import { Loader2, Plus, Plug, AlertTriangle, RotateCcw, Bell, Download, RefreshCw, ExternalLink, Globe, Droplets, Thermometer, FileText, Edit2, Send, CheckCircle, XCircle, History, Trash2, Upload, Zap, TrendingUp, Calendar, DollarSign, Power, PowerOff, Key, Copy, Database, Info, X, Shield, Printer, Cylinder, Wifi, Home, Video, Users, Lock, Unlock } from 'lucide-react'; import { useTranslation } from 'react-i18next'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate, useSearchParams } from 'react-router-dom'; import { api } from '../api/client'; import { useAuth } from '../contexts/AuthContext'; import { formatDateOnly } from '../utils/date'; @@ -29,9 +29,13 @@ import { useTheme, type ThemeStyle, type DarkBackground, type LightBackground, t import { useState, useEffect, useRef, useCallback } from 'react'; import { Palette } from 'lucide-react'; +const validTabs = ['general', 'network', 'plugs', 'notifications', 'filament', 'apikeys', 'virtual-printer', 'users'] as const; +type TabType = typeof validTabs[number]; + export function SettingsPage() { const queryClient = useQueryClient(); const navigate = useNavigate(); + const [searchParams, setSearchParams] = useSearchParams(); const { t, i18n } = useTranslation(); const { showToast, showPersistentToast, dismissToast } = useToast(); const { authEnabled, user, refreshAuth } = useAuth(); @@ -50,7 +54,22 @@ export function SettingsPage() { const [editingTemplate, setEditingTemplate] = useState(null); const [showLogViewer, setShowLogViewer] = useState(false); const [defaultView, setDefaultViewState] = useState(getDefaultView()); - const [activeTab, setActiveTab] = useState<'general' | 'network' | 'plugs' | 'notifications' | 'filament' | 'apikeys' | 'virtual-printer' | 'users'>('general'); + + // Initialize tab from URL params + const tabParam = searchParams.get('tab'); + const initialTab = tabParam && validTabs.includes(tabParam as TabType) ? tabParam as TabType : 'general'; + const [activeTab, setActiveTab] = useState(initialTab); + + // Update URL when tab changes + const handleTabChange = (tab: TabType) => { + setActiveTab(tab); + if (tab === 'general') { + searchParams.delete('tab'); + } else { + searchParams.set('tab', tab); + } + setSearchParams(searchParams, { replace: true }); + }; const [showCreateAPIKey, setShowCreateAPIKey] = useState(false); const [newAPIKeyName, setNewAPIKeyName] = useState(''); const [newAPIKeyPermissions, setNewAPIKeyPermissions] = useState({ @@ -481,7 +500,7 @@ export function SettingsPage() { {/* Tab Navigation */}
{user.role === 'admin' ? 'Admin' : 'User'} @@ -2992,7 +3011,7 @@ export function SettingsPage() { Manage Users - + {user?.role === 'admin' && ( +
+

+ + User Management +

+

+ Manage users and their access to your Bambuddy instance +

+