feat: turn every entity and page into separately openable deep links with browser history and add light/dark mode settings toggle
Browse files- studio/src/App.jsx +74 -27
- studio/src/components/Navbar.jsx +121 -97
- studio/src/components/PRReviewDeck.jsx +14 -4
- studio/src/components/WorkspaceHub.jsx +61 -12
- studio/src/context/ThemeContext.jsx +39 -0
- studio/src/index.css +146 -0
- studio/src/main.jsx +24 -21
studio/src/App.jsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import { useNavigate,
|
| 2 |
import { useAuth } from './context/AuthContext.jsx';
|
| 3 |
import React, { useState, useEffect, useCallback } from 'react';
|
| 4 |
import { api } from './api/client';
|
|
@@ -17,6 +17,7 @@ import { RefreshCw, CheckCircle2, AlertCircle, Sparkles, GitBranch, ArrowLeft }
|
|
| 17 |
export default function App() {
|
| 18 |
const { isAuthenticated, logout: authLogout, user: authUser } = useAuth();
|
| 19 |
const navigate = useNavigate();
|
|
|
|
| 20 |
|
| 21 |
const [workspaces, setWorkspaces] = useState([]);
|
| 22 |
const [currentWorkspace, setCurrentWorkspace] = useState(null); // Defaults to null -> shows WorkspaceHub!
|
|
@@ -60,6 +61,49 @@ export default function App() {
|
|
| 60 |
init();
|
| 61 |
}, []);
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
// Fetch workspace details based on active tab
|
| 64 |
const refreshData = useCallback(async () => {
|
| 65 |
if (!currentWorkspace?.id) return;
|
|
@@ -101,7 +145,6 @@ export default function App() {
|
|
| 101 |
const statusRes = await api.getWorkspaceStatus(wsId);
|
| 102 |
if (statusRes?.stats) {
|
| 103 |
setStats(statusRes.stats);
|
| 104 |
-
// Also update counts in current workspace object
|
| 105 |
if (statusRes.stats.total_documents !== undefined || statusRes.stats.knowledge_items !== undefined) {
|
| 106 |
setCurrentWorkspace((prev) => {
|
| 107 |
if (!prev) return prev;
|
|
@@ -152,20 +195,28 @@ export default function App() {
|
|
| 152 |
};
|
| 153 |
setWorkspaces((prev) => [wsItem, ...prev]);
|
| 154 |
setCurrentWorkspace(wsItem);
|
| 155 |
-
setActiveTab('quickstart'); // Automatically shows GitHub-style CLI instructions!
|
| 156 |
showToast(`Workspace "${name}" created! Follow CLI instructions to populate.`);
|
|
|
|
| 157 |
} catch (err) {
|
| 158 |
showToast(`Create failed: ${err.message}`, 'error');
|
| 159 |
}
|
| 160 |
};
|
| 161 |
|
| 162 |
const handleSelectWorkspace = (ws) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
setCurrentWorkspace(ws);
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
|
|
|
|
|
|
|
|
|
| 169 |
}
|
| 170 |
};
|
| 171 |
|
|
@@ -240,29 +291,21 @@ export default function App() {
|
|
| 240 |
navigate('/login', { replace: true });
|
| 241 |
};
|
| 242 |
|
| 243 |
-
//
|
| 244 |
-
if (!isAuthenticated) {
|
| 245 |
-
return <Navigate to="/login" replace />;
|
| 246 |
-
}
|
| 247 |
-
|
| 248 |
-
// Check if current workspace is completely empty
|
| 249 |
const isWorkspaceEmpty = currentWorkspace &&
|
| 250 |
(currentWorkspace.d_count === 0 && currentWorkspace.k_count === 0) &&
|
| 251 |
dismissedEmptyStateFor !== currentWorkspace.id;
|
| 252 |
|
| 253 |
return (
|
| 254 |
-
<div className="min-h-screen bg-[#
|
| 255 |
-
{/*
|
| 256 |
<Navbar
|
| 257 |
-
searchQuery={searchQuery}
|
| 258 |
-
onSearchChange={setSearchQuery}
|
| 259 |
workspaces={workspaces}
|
| 260 |
currentWorkspace={currentWorkspace}
|
| 261 |
onSelectWorkspace={handleSelectWorkspace}
|
| 262 |
-
onOpenHub={() => setCurrentWorkspace(null)}
|
| 263 |
onCreateWorkspace={handleCreateWorkspace}
|
| 264 |
activeTab={activeTab}
|
| 265 |
-
onSelectTab={
|
| 266 |
stats={stats}
|
| 267 |
currentUser={currentUser}
|
| 268 |
onLogout={handleLogout}
|
|
@@ -293,13 +336,14 @@ export default function App() {
|
|
| 293 |
{/* Workspace Context Bar */}
|
| 294 |
<div className="flex items-center justify-between text-xs text-slate-400">
|
| 295 |
<div className="flex items-center space-x-2">
|
| 296 |
-
<
|
|
|
|
| 297 |
onClick={() => setCurrentWorkspace(null)}
|
| 298 |
className="hover:text-emerald-400 transition flex items-center space-x-1 font-semibold"
|
| 299 |
>
|
| 300 |
<ArrowLeft className="w-3.5 h-3.5" />
|
| 301 |
<span>Workspaces</span>
|
| 302 |
-
</
|
| 303 |
<span className="text-slate-600">/</span>
|
| 304 |
<span className="font-semibold text-white flex items-center space-x-1">
|
| 305 |
<GitBranch className="w-3.5 h-3.5 text-emerald-400" />
|
|
@@ -308,19 +352,20 @@ export default function App() {
|
|
| 308 |
<span className="px-2 py-0.5 rounded bg-emerald-500/10 text-emerald-400 font-mono border border-emerald-500/20 font-bold">
|
| 309 |
main
|
| 310 |
</span>
|
| 311 |
-
<span className="text-slate-600">
|
| 312 |
<span className="text-slate-400 font-mono text-[11px] truncate max-w-[200px] sm:max-w-none">
|
| 313 |
Workspace: {currentWorkspace.id}
|
| 314 |
</span>
|
| 315 |
</div>
|
| 316 |
|
| 317 |
<div className="flex items-center space-x-2">
|
| 318 |
-
<
|
|
|
|
| 319 |
onClick={() => setActiveTab('staging')}
|
| 320 |
-
className="px-2.5 py-1 rounded-md bg-[#238636] hover:bg-[#2EA043] text-white font-semibold text-xs transition"
|
| 321 |
>
|
| 322 |
+ Stage Document
|
| 323 |
-
</
|
| 324 |
<button
|
| 325 |
onClick={() => refreshData()}
|
| 326 |
className="flex items-center space-x-1 px-2.5 py-1 rounded-md bg-[#161B22] hover:bg-[#21262D] border border-[#30363D] text-slate-300 hover:text-white transition"
|
|
@@ -340,7 +385,7 @@ export default function App() {
|
|
| 340 |
onRefresh={refreshData}
|
| 341 |
onDismissEmptyState={() => {
|
| 342 |
setDismissedEmptyStateFor(currentWorkspace.id);
|
| 343 |
-
|
| 344 |
}}
|
| 345 |
/>
|
| 346 |
) : (
|
|
@@ -362,6 +407,8 @@ export default function App() {
|
|
| 362 |
onReviewProposal={handleReview}
|
| 363 |
onBatchReview={handleBatchReview}
|
| 364 |
loading={loading}
|
|
|
|
|
|
|
| 365 |
/>
|
| 366 |
)}
|
| 367 |
|
|
|
|
| 1 |
+
import { useNavigate, useLocation, Link } from 'react-router-dom';
|
| 2 |
import { useAuth } from './context/AuthContext.jsx';
|
| 3 |
import React, { useState, useEffect, useCallback } from 'react';
|
| 4 |
import { api } from './api/client';
|
|
|
|
| 17 |
export default function App() {
|
| 18 |
const { isAuthenticated, logout: authLogout, user: authUser } = useAuth();
|
| 19 |
const navigate = useNavigate();
|
| 20 |
+
const location = useLocation();
|
| 21 |
|
| 22 |
const [workspaces, setWorkspaces] = useState([]);
|
| 23 |
const [currentWorkspace, setCurrentWorkspace] = useState(null); // Defaults to null -> shows WorkspaceHub!
|
|
|
|
| 61 |
init();
|
| 62 |
}, []);
|
| 63 |
|
| 64 |
+
// Parse deep URL parameters for native browser Back/Forward & direct opening
|
| 65 |
+
const pathname = location.pathname;
|
| 66 |
+
const pathParts = pathname.split('/').filter(Boolean);
|
| 67 |
+
const isWsPath = pathParts[0] === 'workspaces';
|
| 68 |
+
const urlWsId = isWsPath ? pathParts[1] : null;
|
| 69 |
+
const urlTab = isWsPath ? (pathParts[2] || 'diff') : 'diff';
|
| 70 |
+
const urlProposalId = (isWsPath && pathParts[2] === 'prs') ? pathParts[3] : null;
|
| 71 |
+
|
| 72 |
+
// Synchronize state whenever URL or workspaces change
|
| 73 |
+
useEffect(() => {
|
| 74 |
+
if (urlWsId) {
|
| 75 |
+
const match = workspaces.find((w) => w.id === urlWsId);
|
| 76 |
+
if (match) {
|
| 77 |
+
if (!currentWorkspace || currentWorkspace.id !== match.id) {
|
| 78 |
+
setCurrentWorkspace(match);
|
| 79 |
+
}
|
| 80 |
+
} else {
|
| 81 |
+
// Fallback placeholder while workspaces load or if direct deep link
|
| 82 |
+
if (!currentWorkspace || currentWorkspace.id !== urlWsId) {
|
| 83 |
+
setCurrentWorkspace({ id: urlWsId, name: urlWsId, d_count: 0, k_count: 0 });
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
if (urlTab && activeTab !== urlTab) {
|
| 88 |
+
setActiveTab(urlTab);
|
| 89 |
+
}
|
| 90 |
+
} else if (pathname === '/' || pathname === '/workspaces' || pathname === '/profile' || pathname === '/settings') {
|
| 91 |
+
if (currentWorkspace !== null) {
|
| 92 |
+
setCurrentWorkspace(null);
|
| 93 |
+
}
|
| 94 |
+
}
|
| 95 |
+
}, [pathname, urlWsId, urlTab, workspaces]);
|
| 96 |
+
|
| 97 |
+
// Update currentWorkspace reference if workspaces list gets fresh counts
|
| 98 |
+
useEffect(() => {
|
| 99 |
+
if (currentWorkspace?.id && workspaces.length > 0) {
|
| 100 |
+
const fresh = workspaces.find((w) => w.id === currentWorkspace.id);
|
| 101 |
+
if (fresh && (fresh.name !== currentWorkspace.name || fresh.d_count !== currentWorkspace.d_count || fresh.k_count !== currentWorkspace.k_count)) {
|
| 102 |
+
setCurrentWorkspace((prev) => prev ? { ...prev, ...fresh } : fresh);
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
}, [workspaces]);
|
| 106 |
+
|
| 107 |
// Fetch workspace details based on active tab
|
| 108 |
const refreshData = useCallback(async () => {
|
| 109 |
if (!currentWorkspace?.id) return;
|
|
|
|
| 145 |
const statusRes = await api.getWorkspaceStatus(wsId);
|
| 146 |
if (statusRes?.stats) {
|
| 147 |
setStats(statusRes.stats);
|
|
|
|
| 148 |
if (statusRes.stats.total_documents !== undefined || statusRes.stats.knowledge_items !== undefined) {
|
| 149 |
setCurrentWorkspace((prev) => {
|
| 150 |
if (!prev) return prev;
|
|
|
|
| 195 |
};
|
| 196 |
setWorkspaces((prev) => [wsItem, ...prev]);
|
| 197 |
setCurrentWorkspace(wsItem);
|
|
|
|
| 198 |
showToast(`Workspace "${name}" created! Follow CLI instructions to populate.`);
|
| 199 |
+
navigate(`/workspaces/${wsItem.id}/quickstart`);
|
| 200 |
} catch (err) {
|
| 201 |
showToast(`Create failed: ${err.message}`, 'error');
|
| 202 |
}
|
| 203 |
};
|
| 204 |
|
| 205 |
const handleSelectWorkspace = (ws) => {
|
| 206 |
+
if (!ws) {
|
| 207 |
+
setCurrentWorkspace(null);
|
| 208 |
+
navigate('/');
|
| 209 |
+
return;
|
| 210 |
+
}
|
| 211 |
setCurrentWorkspace(ws);
|
| 212 |
+
const targetTab = ((ws.d_count === 0 && ws.k_count === 0) || ws.is_new) ? 'quickstart' : 'diff';
|
| 213 |
+
navigate(`/workspaces/${ws.id}/${targetTab}`);
|
| 214 |
+
};
|
| 215 |
+
|
| 216 |
+
const handleTabChange = (tabId) => {
|
| 217 |
+
setActiveTab(tabId);
|
| 218 |
+
if (currentWorkspace?.id) {
|
| 219 |
+
navigate(`/workspaces/${currentWorkspace.id}/${tabId}`);
|
| 220 |
}
|
| 221 |
};
|
| 222 |
|
|
|
|
| 291 |
navigate('/login', { replace: true });
|
| 292 |
};
|
| 293 |
|
| 294 |
+
// Determine if workspace is completely empty (0 docs and 0 facts, and user hasn't explicitly dismissed the quickstart)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 295 |
const isWorkspaceEmpty = currentWorkspace &&
|
| 296 |
(currentWorkspace.d_count === 0 && currentWorkspace.k_count === 0) &&
|
| 297 |
dismissedEmptyStateFor !== currentWorkspace.id;
|
| 298 |
|
| 299 |
return (
|
| 300 |
+
<div className="min-h-screen bg-[#080B11] text-slate-100 flex flex-col font-sans transition-colors duration-200">
|
| 301 |
+
{/* Three-tier GitHub/Vercel style Navbar */}
|
| 302 |
<Navbar
|
|
|
|
|
|
|
| 303 |
workspaces={workspaces}
|
| 304 |
currentWorkspace={currentWorkspace}
|
| 305 |
onSelectWorkspace={handleSelectWorkspace}
|
|
|
|
| 306 |
onCreateWorkspace={handleCreateWorkspace}
|
| 307 |
activeTab={activeTab}
|
| 308 |
+
onSelectTab={handleTabChange}
|
| 309 |
stats={stats}
|
| 310 |
currentUser={currentUser}
|
| 311 |
onLogout={handleLogout}
|
|
|
|
| 336 |
{/* Workspace Context Bar */}
|
| 337 |
<div className="flex items-center justify-between text-xs text-slate-400">
|
| 338 |
<div className="flex items-center space-x-2">
|
| 339 |
+
<Link
|
| 340 |
+
to="/"
|
| 341 |
onClick={() => setCurrentWorkspace(null)}
|
| 342 |
className="hover:text-emerald-400 transition flex items-center space-x-1 font-semibold"
|
| 343 |
>
|
| 344 |
<ArrowLeft className="w-3.5 h-3.5" />
|
| 345 |
<span>Workspaces</span>
|
| 346 |
+
</Link>
|
| 347 |
<span className="text-slate-600">/</span>
|
| 348 |
<span className="font-semibold text-white flex items-center space-x-1">
|
| 349 |
<GitBranch className="w-3.5 h-3.5 text-emerald-400" />
|
|
|
|
| 352 |
<span className="px-2 py-0.5 rounded bg-emerald-500/10 text-emerald-400 font-mono border border-emerald-500/20 font-bold">
|
| 353 |
main
|
| 354 |
</span>
|
| 355 |
+
<span className="text-slate-600">•</span>
|
| 356 |
<span className="text-slate-400 font-mono text-[11px] truncate max-w-[200px] sm:max-w-none">
|
| 357 |
Workspace: {currentWorkspace.id}
|
| 358 |
</span>
|
| 359 |
</div>
|
| 360 |
|
| 361 |
<div className="flex items-center space-x-2">
|
| 362 |
+
<Link
|
| 363 |
+
to={`/workspaces/${currentWorkspace.id}/staging`}
|
| 364 |
onClick={() => setActiveTab('staging')}
|
| 365 |
+
className="px-2.5 py-1 rounded-md bg-[#238636] hover:bg-[#2EA043] text-white font-semibold text-xs transition block no-underline"
|
| 366 |
>
|
| 367 |
+ Stage Document
|
| 368 |
+
</Link>
|
| 369 |
<button
|
| 370 |
onClick={() => refreshData()}
|
| 371 |
className="flex items-center space-x-1 px-2.5 py-1 rounded-md bg-[#161B22] hover:bg-[#21262D] border border-[#30363D] text-slate-300 hover:text-white transition"
|
|
|
|
| 385 |
onRefresh={refreshData}
|
| 386 |
onDismissEmptyState={() => {
|
| 387 |
setDismissedEmptyStateFor(currentWorkspace.id);
|
| 388 |
+
handleTabChange('diff');
|
| 389 |
}}
|
| 390 |
/>
|
| 391 |
) : (
|
|
|
|
| 407 |
onReviewProposal={handleReview}
|
| 408 |
onBatchReview={handleBatchReview}
|
| 409 |
loading={loading}
|
| 410 |
+
workspaceId={currentWorkspace.id}
|
| 411 |
+
selectedProposalId={urlProposalId}
|
| 412 |
/>
|
| 413 |
)}
|
| 414 |
|
studio/src/components/Navbar.jsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
| 1 |
import React, { useState, useRef, useEffect } from 'react';
|
|
|
|
|
|
|
| 2 |
import {
|
| 3 |
FileDiff,
|
| 4 |
GitPullRequest,
|
|
@@ -23,24 +25,26 @@ import {
|
|
| 23 |
Sparkles,
|
| 24 |
Terminal,
|
| 25 |
Grid,
|
| 26 |
-
ArrowLeft
|
|
|
|
|
|
|
|
|
|
| 27 |
} from 'lucide-react';
|
| 28 |
|
| 29 |
export default function Navbar({
|
| 30 |
workspaces,
|
| 31 |
currentWorkspace,
|
| 32 |
onSelectWorkspace,
|
| 33 |
-
onOpenHub,
|
| 34 |
onCreateWorkspace,
|
| 35 |
activeTab,
|
| 36 |
onSelectTab,
|
| 37 |
stats,
|
| 38 |
currentUser,
|
| 39 |
-
onOpenAuth,
|
| 40 |
onLogout,
|
| 41 |
onRefresh,
|
| 42 |
-
refreshing
|
| 43 |
}) {
|
|
|
|
| 44 |
const [showWsDropdown, setShowWsDropdown] = useState(false);
|
| 45 |
const [copiedApiKey, setCopiedApiKey] = useState(false);
|
| 46 |
|
|
@@ -93,50 +97,51 @@ export default function Navbar({
|
|
| 93 |
const pendingProposals = stats?.pending_proposals ?? 0;
|
| 94 |
|
| 95 |
const tabs = [
|
| 96 |
-
{ id: 'diff', label: 'Semantic Diff', icon: FileDiff, badge: pendingProposals > 0 ? `${pendingProposals}` :
|
| 97 |
-
{ id: 'prs', label: '
|
| 98 |
-
{ id: 'graph', label: '
|
| 99 |
-
{ id: 'staging', label: '
|
| 100 |
-
{ id: 'rules', label: 'Policy
|
| 101 |
-
{ id: 'knowledge', label: '
|
| 102 |
-
{ id: 'audit', label: 'Audit
|
| 103 |
{ id: 'quickstart', label: 'CLI Quickstart', icon: Terminal },
|
| 104 |
];
|
| 105 |
|
| 106 |
return (
|
| 107 |
-
<header className="
|
| 108 |
{/* --------------------------------------------------------------------- */}
|
| 109 |
-
{/* TIER 1: Global Platform Bar (#010409)
|
| 110 |
{/* --------------------------------------------------------------------- */}
|
| 111 |
-
<div className="
|
| 112 |
-
{/* Left: Brand & Workspace
|
| 113 |
-
<div className="flex items-center space-x-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
onClick={
|
| 117 |
className="flex items-center space-x-2.5 cursor-pointer group"
|
| 118 |
title="Return to Workspaces Hub"
|
| 119 |
>
|
| 120 |
-
<div className="w-8 h-8 rounded-lg bg-gradient-to-tr from-emerald-500 via-teal-500 to-sky-500 p-
|
| 121 |
<div className="w-full h-full bg-[#010409] rounded-[6px] flex items-center justify-center">
|
| 122 |
<Layers className="w-4 h-4 text-emerald-400" />
|
| 123 |
</div>
|
| 124 |
</div>
|
| 125 |
<div className="flex flex-col">
|
| 126 |
-
<span className="font-extrabold text-sm text-white tracking-tight group-hover:text-emerald-
|
| 127 |
DiffWeave
|
| 128 |
</span>
|
| 129 |
<span className="text-[10px] text-slate-400 font-mono -mt-1">
|
| 130 |
Document Git Platform
|
| 131 |
</span>
|
| 132 |
</div>
|
| 133 |
-
</
|
| 134 |
|
| 135 |
<span className="text-slate-600 hidden sm:inline">/</span>
|
| 136 |
|
| 137 |
-
{/* Hub Button */}
|
| 138 |
-
<
|
| 139 |
-
|
|
|
|
| 140 |
className={`hidden sm:flex items-center space-x-1.5 px-2.5 py-1 rounded-md border text-xs font-semibold transition ${
|
| 141 |
!currentWorkspace
|
| 142 |
? 'bg-emerald-500/10 border-emerald-500/30 text-emerald-400'
|
|
@@ -145,7 +150,7 @@ export default function Navbar({
|
|
| 145 |
>
|
| 146 |
<Grid className="w-3.5 h-3.5" />
|
| 147 |
<span>Workspaces</span>
|
| 148 |
-
</
|
| 149 |
|
| 150 |
{/* Workspace Dropdown */}
|
| 151 |
<div ref={wsDropdownRef} className="relative">
|
|
@@ -154,7 +159,7 @@ export default function Navbar({
|
|
| 154 |
setShowWsDropdown((prev) => !prev);
|
| 155 |
setShowUserDropdown(false);
|
| 156 |
}}
|
| 157 |
-
className="flex items-center space-x-1.5 px-2.5 py-1 rounded-md bg-[#161B22] hover:bg-[#21262D] border border-[#30363D] text-slate-200 transition
|
| 158 |
>
|
| 159 |
<span className={`w-2 h-2 rounded-full ${currentWorkspace ? 'bg-emerald-400 animate-pulse' : 'bg-slate-500'}`} />
|
| 160 |
<span className="truncate max-w-[150px] text-xs font-semibold">
|
|
@@ -165,46 +170,35 @@ export default function Navbar({
|
|
| 165 |
|
| 166 |
{showWsDropdown && (
|
| 167 |
<div className="absolute left-0 mt-1.5 w-64 bg-[#161B22] border border-[#30363D] rounded-xl shadow-2xl p-2 z-50 space-y-1">
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
onClick={() => {
|
| 171 |
-
onOpenHub();
|
| 172 |
-
setShowWsDropdown(false);
|
| 173 |
-
}}
|
| 174 |
-
className="w-full text-left px-2.5 py-1.5 rounded-lg text-xs transition flex items-center space-x-2 text-emerald-400 hover:bg-[#21262D] font-bold pb-2 border-b border-[#30363D]"
|
| 175 |
-
>
|
| 176 |
-
<Grid className="w-3.5 h-3.5" />
|
| 177 |
-
<span>View All Workspaces (Hub)</span>
|
| 178 |
-
</button>
|
| 179 |
-
|
| 180 |
-
<div className="text-[10px] font-bold text-slate-400 px-2 pt-2 pb-1 uppercase tracking-wider">
|
| 181 |
-
Workspaces ({workspaces.length})
|
| 182 |
</div>
|
| 183 |
|
| 184 |
-
<div className="max-h-
|
| 185 |
{workspaces.map((w) => (
|
| 186 |
-
<
|
| 187 |
key={w.id}
|
|
|
|
| 188 |
onClick={() => {
|
| 189 |
-
onSelectWorkspace(w);
|
| 190 |
setShowWsDropdown(false);
|
|
|
|
| 191 |
}}
|
| 192 |
className={`w-full text-left px-2.5 py-1.5 rounded text-xs transition flex items-center justify-between ${
|
| 193 |
currentWorkspace?.id === w.id
|
| 194 |
? 'bg-emerald-500/20 text-emerald-300 font-bold'
|
| 195 |
-
: 'text-slate-300 hover:bg-[#21262D]'
|
| 196 |
}`}
|
| 197 |
>
|
| 198 |
-
<div className="
|
| 199 |
-
<
|
| 200 |
-
<span className="text-[10px] text-slate-
|
| 201 |
-
{w.d_count ?? 0} docs
|
| 202 |
</span>
|
| 203 |
</div>
|
| 204 |
{currentWorkspace?.id === w.id && (
|
| 205 |
<CheckCircle2 className="w-3.5 h-3.5 text-emerald-400 shrink-0" />
|
| 206 |
)}
|
| 207 |
-
</
|
| 208 |
))}
|
| 209 |
</div>
|
| 210 |
|
|
@@ -225,15 +219,29 @@ export default function Navbar({
|
|
| 225 |
</div>
|
| 226 |
</div>
|
| 227 |
|
| 228 |
-
{/* Right: FastMCP Bridge status & User Profile */}
|
| 229 |
-
<div className="flex items-center space-x-
|
| 230 |
{/* FastMCP Connected Pill */}
|
| 231 |
<div className="hidden md:flex items-center space-x-1.5 px-2.5 py-1 rounded-full bg-[#161B22] border border-[#30363D] text-[11px] text-slate-400 font-mono">
|
| 232 |
-
<span className="w-2 h-2 rounded-full bg-emerald-400
|
| 233 |
<Cpu className="w-3 h-3 text-emerald-400" />
|
| 234 |
<span>FastMCP: Active</span>
|
| 235 |
</div>
|
| 236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
{/* User Menu */}
|
| 238 |
{currentUser ? (
|
| 239 |
<div ref={userDropdownRef} className="relative">
|
|
@@ -259,53 +267,65 @@ export default function Navbar({
|
|
| 259 |
<p className="font-bold text-white">{currentUser.username || 'User'}</p>
|
| 260 |
<p className="text-[11px] text-slate-400 font-mono truncate">{currentUser.email || 'user@docweave.io'}</p>
|
| 261 |
</div>
|
| 262 |
-
<
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
onOpenHub();
|
| 266 |
-
}}
|
| 267 |
className="w-full text-left px-2 py-1.5 rounded text-slate-300 hover:bg-[#21262D] flex items-center space-x-2"
|
| 268 |
>
|
| 269 |
<Grid className="w-3.5 h-3.5 text-sky-400" />
|
| 270 |
<span>Workspaces Hub</span>
|
| 271 |
-
</
|
| 272 |
-
<
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
const tok = localStorage.getItem("diffweave_token") || localStorage.getItem("token") || "";
|
| 276 |
-
if (tok) {
|
| 277 |
-
navigator.clipboard.writeText(tok);
|
| 278 |
-
alert("Personal Access Token / API Key copied to clipboard!");
|
| 279 |
-
} else {
|
| 280 |
-
alert("No active API token found.");
|
| 281 |
-
}
|
| 282 |
-
}}
|
| 283 |
className="w-full text-left px-2 py-1.5 rounded text-slate-300 hover:bg-[#21262D] flex items-center space-x-2"
|
| 284 |
>
|
| 285 |
-
<
|
| 286 |
-
<span>
|
| 287 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
<button
|
| 289 |
onClick={() => {
|
| 290 |
setShowUserDropdown(false);
|
| 291 |
-
|
| 292 |
}}
|
| 293 |
-
className="w-full text-left px-2 py-1.5 rounded text-
|
| 294 |
>
|
| 295 |
-
<
|
| 296 |
-
|
|
|
|
|
|
|
|
|
|
| 297 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
</div>
|
| 299 |
)}
|
| 300 |
</div>
|
| 301 |
) : (
|
| 302 |
-
<
|
| 303 |
-
|
| 304 |
-
className="
|
| 305 |
>
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
</button>
|
| 309 |
)}
|
| 310 |
</div>
|
| 311 |
</div>
|
|
@@ -318,13 +338,14 @@ export default function Navbar({
|
|
| 318 |
<div className="px-4 sm:px-6 py-3.5 flex flex-col sm:flex-row sm:items-center justify-between gap-3">
|
| 319 |
{/* Workspace Title & Badge */}
|
| 320 |
<div className="flex items-center space-x-2.5">
|
| 321 |
-
<
|
| 322 |
-
|
|
|
|
| 323 |
className="p-1 rounded-md hover:bg-[#161B22] text-slate-400 hover:text-white transition"
|
| 324 |
title="Back to All Workspaces"
|
| 325 |
>
|
| 326 |
<ArrowLeft className="w-4 h-4" />
|
| 327 |
-
</
|
| 328 |
<Files className="w-5 h-5 text-emerald-400" />
|
| 329 |
<div className="flex items-center space-x-2">
|
| 330 |
<span className="text-white font-bold text-base sm:text-lg">
|
|
@@ -347,28 +368,31 @@ export default function Navbar({
|
|
| 347 |
<div className="flex items-center space-x-1.5 px-2.5 py-1 rounded-md bg-[#161B22] border border-[#30363D] text-slate-300">
|
| 348 |
<Database className="w-3.5 h-3.5 text-emerald-400" />
|
| 349 |
<span>Verified Truth:</span>
|
| 350 |
-
<span className="text-white font-bold font-mono">{verifiedFacts}
|
| 351 |
</div>
|
| 352 |
|
| 353 |
-
<
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
|
|
|
|
|
|
| 358 |
</div>
|
| 359 |
</div>
|
| 360 |
|
| 361 |
{/* ----------------------------------------------------------------- */}
|
| 362 |
-
{/* TIER 3:
|
| 363 |
{/* ----------------------------------------------------------------- */}
|
| 364 |
-
<nav className="px-4 sm:px-6
|
| 365 |
{tabs.map((tab) => {
|
| 366 |
const Icon = tab.icon;
|
| 367 |
const isActive = activeTab === tab.id;
|
| 368 |
return (
|
| 369 |
-
<
|
| 370 |
key={tab.id}
|
| 371 |
-
|
|
|
|
| 372 |
className={`flex items-center space-x-2 px-3.5 py-2.5 border-b-2 transition whitespace-nowrap ${
|
| 373 |
isActive
|
| 374 |
? 'border-emerald-500 text-white font-bold'
|
|
@@ -388,7 +412,7 @@ export default function Navbar({
|
|
| 388 |
{tab.badge}
|
| 389 |
</span>
|
| 390 |
)}
|
| 391 |
-
</
|
| 392 |
);
|
| 393 |
})}
|
| 394 |
</nav>
|
|
|
|
| 1 |
import React, { useState, useRef, useEffect } from 'react';
|
| 2 |
+
import { Link } from 'react-router-dom';
|
| 3 |
+
import { useTheme } from '../context/ThemeContext.jsx';
|
| 4 |
import {
|
| 5 |
FileDiff,
|
| 6 |
GitPullRequest,
|
|
|
|
| 25 |
Sparkles,
|
| 26 |
Terminal,
|
| 27 |
Grid,
|
| 28 |
+
ArrowLeft,
|
| 29 |
+
Sun,
|
| 30 |
+
Moon,
|
| 31 |
+
Settings
|
| 32 |
} from 'lucide-react';
|
| 33 |
|
| 34 |
export default function Navbar({
|
| 35 |
workspaces,
|
| 36 |
currentWorkspace,
|
| 37 |
onSelectWorkspace,
|
|
|
|
| 38 |
onCreateWorkspace,
|
| 39 |
activeTab,
|
| 40 |
onSelectTab,
|
| 41 |
stats,
|
| 42 |
currentUser,
|
|
|
|
| 43 |
onLogout,
|
| 44 |
onRefresh,
|
| 45 |
+
refreshing
|
| 46 |
}) {
|
| 47 |
+
const { theme, toggleTheme } = useTheme();
|
| 48 |
const [showWsDropdown, setShowWsDropdown] = useState(false);
|
| 49 |
const [copiedApiKey, setCopiedApiKey] = useState(false);
|
| 50 |
|
|
|
|
| 97 |
const pendingProposals = stats?.pending_proposals ?? 0;
|
| 98 |
|
| 99 |
const tabs = [
|
| 100 |
+
{ id: 'diff', label: 'Semantic Diff', icon: FileDiff, badge: pendingProposals > 0 ? `${pendingProposals}` : null },
|
| 101 |
+
{ id: 'prs', label: 'PR Review Deck', icon: GitPullRequest, badge: pendingProposals > 0 ? `${pendingProposals} pending` : null },
|
| 102 |
+
{ id: 'graph', label: 'Knowledge Graph', icon: Network },
|
| 103 |
+
{ id: 'staging', label: 'Ingestion Staging', icon: Files, badge: totalDocs > 0 ? `${totalDocs} docs` : null },
|
| 104 |
+
{ id: 'rules', label: 'Policy Rules CI', icon: ShieldCheck },
|
| 105 |
+
{ id: 'knowledge', label: 'Truth Register', icon: Database, badge: verifiedFacts > 0 ? `${verifiedFacts} facts` : null },
|
| 106 |
+
{ id: 'audit', label: 'Audit & Provenance', icon: History },
|
| 107 |
{ id: 'quickstart', label: 'CLI Quickstart', icon: Terminal },
|
| 108 |
];
|
| 109 |
|
| 110 |
return (
|
| 111 |
+
<header className="sticky top-0 z-40 bg-[#010409] border-b border-[#30363D] shadow-md select-none">
|
| 112 |
{/* --------------------------------------------------------------------- */}
|
| 113 |
+
{/* TIER 1: Global Platform Bar (#010409) */}
|
| 114 |
{/* --------------------------------------------------------------------- */}
|
| 115 |
+
<div className="px-4 sm:px-6 py-2.5 flex items-center justify-between border-b border-[#21262D]">
|
| 116 |
+
{/* Left: Brand Logo & Workspace Switcher */}
|
| 117 |
+
<div className="flex items-center space-x-4">
|
| 118 |
+
<Link
|
| 119 |
+
to="/"
|
| 120 |
+
onClick={() => onSelectWorkspace && onSelectWorkspace(null)}
|
| 121 |
className="flex items-center space-x-2.5 cursor-pointer group"
|
| 122 |
title="Return to Workspaces Hub"
|
| 123 |
>
|
| 124 |
+
<div className="w-8 h-8 rounded-lg bg-gradient-to-tr from-emerald-500 via-teal-500 to-sky-500 p-[1px] shadow-sm group-hover:scale-105 transition">
|
| 125 |
<div className="w-full h-full bg-[#010409] rounded-[6px] flex items-center justify-center">
|
| 126 |
<Layers className="w-4 h-4 text-emerald-400" />
|
| 127 |
</div>
|
| 128 |
</div>
|
| 129 |
<div className="flex flex-col">
|
| 130 |
+
<span className="font-extrabold text-sm text-white tracking-tight group-hover:text-emerald-300 transition">
|
| 131 |
DiffWeave
|
| 132 |
</span>
|
| 133 |
<span className="text-[10px] text-slate-400 font-mono -mt-1">
|
| 134 |
Document Git Platform
|
| 135 |
</span>
|
| 136 |
</div>
|
| 137 |
+
</Link>
|
| 138 |
|
| 139 |
<span className="text-slate-600 hidden sm:inline">/</span>
|
| 140 |
|
| 141 |
+
{/* Hub Link Button */}
|
| 142 |
+
<Link
|
| 143 |
+
to="/"
|
| 144 |
+
onClick={() => onSelectWorkspace && onSelectWorkspace(null)}
|
| 145 |
className={`hidden sm:flex items-center space-x-1.5 px-2.5 py-1 rounded-md border text-xs font-semibold transition ${
|
| 146 |
!currentWorkspace
|
| 147 |
? 'bg-emerald-500/10 border-emerald-500/30 text-emerald-400'
|
|
|
|
| 150 |
>
|
| 151 |
<Grid className="w-3.5 h-3.5" />
|
| 152 |
<span>Workspaces</span>
|
| 153 |
+
</Link>
|
| 154 |
|
| 155 |
{/* Workspace Dropdown */}
|
| 156 |
<div ref={wsDropdownRef} className="relative">
|
|
|
|
| 159 |
setShowWsDropdown((prev) => !prev);
|
| 160 |
setShowUserDropdown(false);
|
| 161 |
}}
|
| 162 |
+
className="flex items-center space-x-1.5 px-2.5 py-1 rounded-md bg-[#161B22] hover:bg-[#21262D] border border-[#30363D] text-slate-200 transition"
|
| 163 |
>
|
| 164 |
<span className={`w-2 h-2 rounded-full ${currentWorkspace ? 'bg-emerald-400 animate-pulse' : 'bg-slate-500'}`} />
|
| 165 |
<span className="truncate max-w-[150px] text-xs font-semibold">
|
|
|
|
| 170 |
|
| 171 |
{showWsDropdown && (
|
| 172 |
<div className="absolute left-0 mt-1.5 w-64 bg-[#161B22] border border-[#30363D] rounded-xl shadow-2xl p-2 z-50 space-y-1">
|
| 173 |
+
<div className="px-2 py-1 text-[11px] font-semibold text-slate-400 border-b border-[#30363D]">
|
| 174 |
+
Document Workspaces ({workspaces.length})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
</div>
|
| 176 |
|
| 177 |
+
<div className="max-h-56 overflow-y-auto space-y-0.5 py-1">
|
| 178 |
{workspaces.map((w) => (
|
| 179 |
+
<Link
|
| 180 |
key={w.id}
|
| 181 |
+
to={`/workspaces/${w.id}/diff`}
|
| 182 |
onClick={() => {
|
|
|
|
| 183 |
setShowWsDropdown(false);
|
| 184 |
+
onSelectWorkspace && onSelectWorkspace(w);
|
| 185 |
}}
|
| 186 |
className={`w-full text-left px-2.5 py-1.5 rounded text-xs transition flex items-center justify-between ${
|
| 187 |
currentWorkspace?.id === w.id
|
| 188 |
? 'bg-emerald-500/20 text-emerald-300 font-bold'
|
| 189 |
+
: 'text-slate-300 hover:bg-[#21262D] hover:text-white'
|
| 190 |
}`}
|
| 191 |
>
|
| 192 |
+
<div className="truncate pr-2">
|
| 193 |
+
<p className="truncate">{w.name}</p>
|
| 194 |
+
<span className="text-[10px] text-slate-500 font-mono">
|
| 195 |
+
{w.d_count ?? 0} docs • {w.k_count ?? 0} facts
|
| 196 |
</span>
|
| 197 |
</div>
|
| 198 |
{currentWorkspace?.id === w.id && (
|
| 199 |
<CheckCircle2 className="w-3.5 h-3.5 text-emerald-400 shrink-0" />
|
| 200 |
)}
|
| 201 |
+
</Link>
|
| 202 |
))}
|
| 203 |
</div>
|
| 204 |
|
|
|
|
| 219 |
</div>
|
| 220 |
</div>
|
| 221 |
|
| 222 |
+
{/* Right: FastMCP Bridge status, Theme Quick Toggle & User Profile */}
|
| 223 |
+
<div className="flex items-center space-x-2.5">
|
| 224 |
{/* FastMCP Connected Pill */}
|
| 225 |
<div className="hidden md:flex items-center space-x-1.5 px-2.5 py-1 rounded-full bg-[#161B22] border border-[#30363D] text-[11px] text-slate-400 font-mono">
|
| 226 |
+
<span className="w-2 h-2 rounded-full bg-emerald-400" />
|
| 227 |
<Cpu className="w-3 h-3 text-emerald-400" />
|
| 228 |
<span>FastMCP: Active</span>
|
| 229 |
</div>
|
| 230 |
|
| 231 |
+
{/* Quick Light/Dark Mode Toggle */}
|
| 232 |
+
<button
|
| 233 |
+
onClick={toggleTheme}
|
| 234 |
+
className="p-1.5 rounded-lg bg-[#161B22] hover:bg-[#21262D] border border-[#30363D] text-slate-300 hover:text-white transition flex items-center justify-center"
|
| 235 |
+
title={`Switch to ${theme === 'dark' ? 'Light' : 'Dark'} Mode`}
|
| 236 |
+
aria-label="Toggle interface theme"
|
| 237 |
+
>
|
| 238 |
+
{theme === 'dark' ? (
|
| 239 |
+
<Sun className="w-4 h-4 text-amber-400" />
|
| 240 |
+
) : (
|
| 241 |
+
<Moon className="w-4 h-4 text-indigo-400" />
|
| 242 |
+
)}
|
| 243 |
+
</button>
|
| 244 |
+
|
| 245 |
{/* User Menu */}
|
| 246 |
{currentUser ? (
|
| 247 |
<div ref={userDropdownRef} className="relative">
|
|
|
|
| 267 |
<p className="font-bold text-white">{currentUser.username || 'User'}</p>
|
| 268 |
<p className="text-[11px] text-slate-400 font-mono truncate">{currentUser.email || 'user@docweave.io'}</p>
|
| 269 |
</div>
|
| 270 |
+
<Link
|
| 271 |
+
to="/"
|
| 272 |
+
onClick={() => setShowUserDropdown(false)}
|
|
|
|
|
|
|
| 273 |
className="w-full text-left px-2 py-1.5 rounded text-slate-300 hover:bg-[#21262D] flex items-center space-x-2"
|
| 274 |
>
|
| 275 |
<Grid className="w-3.5 h-3.5 text-sky-400" />
|
| 276 |
<span>Workspaces Hub</span>
|
| 277 |
+
</Link>
|
| 278 |
+
<Link
|
| 279 |
+
to="/profile"
|
| 280 |
+
onClick={() => setShowUserDropdown(false)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
className="w-full text-left px-2 py-1.5 rounded text-slate-300 hover:bg-[#21262D] flex items-center space-x-2"
|
| 282 |
>
|
| 283 |
+
<User className="w-3.5 h-3.5 text-emerald-400" />
|
| 284 |
+
<span>Developer Profile</span>
|
| 285 |
+
</Link>
|
| 286 |
+
<Link
|
| 287 |
+
to="/settings"
|
| 288 |
+
onClick={() => setShowUserDropdown(false)}
|
| 289 |
+
className="w-full text-left px-2 py-1.5 rounded text-slate-300 hover:bg-[#21262D] flex items-center space-x-2"
|
| 290 |
+
>
|
| 291 |
+
<Settings className="w-3.5 h-3.5 text-sky-400" />
|
| 292 |
+
<span>Platform Settings</span>
|
| 293 |
+
</Link>
|
| 294 |
<button
|
| 295 |
onClick={() => {
|
| 296 |
setShowUserDropdown(false);
|
| 297 |
+
handleCopyApiKey();
|
| 298 |
}}
|
| 299 |
+
className="w-full text-left px-2 py-1.5 rounded text-slate-300 hover:bg-[#21262D] flex items-center justify-between"
|
| 300 |
>
|
| 301 |
+
<div className="flex items-center space-x-2">
|
| 302 |
+
<Key className="w-3.5 h-3.5 text-amber-400" />
|
| 303 |
+
<span>{copiedApiKey ? 'Copied Token!' : 'Copy API Key'}</span>
|
| 304 |
+
</div>
|
| 305 |
+
{copiedApiKey && <span className="text-[10px] text-emerald-400 font-bold">✓</span>}
|
| 306 |
</button>
|
| 307 |
+
<div className="pt-1 border-t border-[#30363D]">
|
| 308 |
+
<button
|
| 309 |
+
onClick={() => {
|
| 310 |
+
setShowUserDropdown(false);
|
| 311 |
+
onLogout();
|
| 312 |
+
}}
|
| 313 |
+
className="w-full text-left px-2 py-1.5 rounded text-rose-400 hover:bg-rose-950/30 flex items-center space-x-2"
|
| 314 |
+
>
|
| 315 |
+
<LogOut className="w-3.5 h-3.5" />
|
| 316 |
+
<span>Sign Out</span>
|
| 317 |
+
</button>
|
| 318 |
+
</div>
|
| 319 |
</div>
|
| 320 |
)}
|
| 321 |
</div>
|
| 322 |
) : (
|
| 323 |
+
<Link
|
| 324 |
+
to="/login"
|
| 325 |
+
className="px-3 py-1 text-xs font-semibold text-white bg-emerald-600 hover:bg-emerald-500 rounded-md transition"
|
| 326 |
>
|
| 327 |
+
Sign In
|
| 328 |
+
</Link>
|
|
|
|
| 329 |
)}
|
| 330 |
</div>
|
| 331 |
</div>
|
|
|
|
| 338 |
<div className="px-4 sm:px-6 py-3.5 flex flex-col sm:flex-row sm:items-center justify-between gap-3">
|
| 339 |
{/* Workspace Title & Badge */}
|
| 340 |
<div className="flex items-center space-x-2.5">
|
| 341 |
+
<Link
|
| 342 |
+
to="/"
|
| 343 |
+
onClick={() => onSelectWorkspace && onSelectWorkspace(null)}
|
| 344 |
className="p-1 rounded-md hover:bg-[#161B22] text-slate-400 hover:text-white transition"
|
| 345 |
title="Back to All Workspaces"
|
| 346 |
>
|
| 347 |
<ArrowLeft className="w-4 h-4" />
|
| 348 |
+
</Link>
|
| 349 |
<Files className="w-5 h-5 text-emerald-400" />
|
| 350 |
<div className="flex items-center space-x-2">
|
| 351 |
<span className="text-white font-bold text-base sm:text-lg">
|
|
|
|
| 368 |
<div className="flex items-center space-x-1.5 px-2.5 py-1 rounded-md bg-[#161B22] border border-[#30363D] text-slate-300">
|
| 369 |
<Database className="w-3.5 h-3.5 text-emerald-400" />
|
| 370 |
<span>Verified Truth:</span>
|
| 371 |
+
<span className="text-white font-bold font-mono">{verifiedFacts}</span>
|
| 372 |
</div>
|
| 373 |
|
| 374 |
+
<button
|
| 375 |
+
onClick={onRefresh}
|
| 376 |
+
className="p-1.5 rounded-md bg-[#161B22] hover:bg-[#21262D] border border-[#30363D] text-slate-400 hover:text-white transition"
|
| 377 |
+
title="Refresh Workspace Data"
|
| 378 |
+
>
|
| 379 |
+
<RefreshCw className={`w-3.5 h-3.5 ${refreshing ? 'animate-spin text-emerald-400' : ''}`} />
|
| 380 |
+
</button>
|
| 381 |
</div>
|
| 382 |
</div>
|
| 383 |
|
| 384 |
{/* ----------------------------------------------------------------- */}
|
| 385 |
+
{/* TIER 3: Workspace Navigation Tabs (GitHub-style deep Link tabs) */}
|
| 386 |
{/* ----------------------------------------------------------------- */}
|
| 387 |
+
<nav className="flex px-4 sm:px-6 space-x-1 overflow-x-auto border-t border-[#21262D] text-xs font-medium no-scrollbar">
|
| 388 |
{tabs.map((tab) => {
|
| 389 |
const Icon = tab.icon;
|
| 390 |
const isActive = activeTab === tab.id;
|
| 391 |
return (
|
| 392 |
+
<Link
|
| 393 |
key={tab.id}
|
| 394 |
+
to={`/workspaces/${currentWorkspace.id}/${tab.id}`}
|
| 395 |
+
onClick={() => onSelectTab && onSelectTab(tab.id)}
|
| 396 |
className={`flex items-center space-x-2 px-3.5 py-2.5 border-b-2 transition whitespace-nowrap ${
|
| 397 |
isActive
|
| 398 |
? 'border-emerald-500 text-white font-bold'
|
|
|
|
| 412 |
{tab.badge}
|
| 413 |
</span>
|
| 414 |
)}
|
| 415 |
+
</Link>
|
| 416 |
);
|
| 417 |
})}
|
| 418 |
</nav>
|
studio/src/components/PRReviewDeck.jsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import React, { useState } from 'react';
|
| 2 |
import {
|
| 3 |
GitPullRequest,
|
|
@@ -17,11 +18,19 @@ import {
|
|
| 17 |
} from 'lucide-react';
|
| 18 |
import confetti from 'canvas-confetti';
|
| 19 |
|
| 20 |
-
export default function PRReviewDeck({ proposals, onReviewProposal, onBatchReview, loading }) {
|
| 21 |
const [selectedProposal, setSelectedProposal] = useState(null);
|
| 22 |
const [filterStatus, setFilterStatus] = useState('PENDING');
|
| 23 |
const [reviewComment, setReviewComment] = useState('');
|
| 24 |
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
if (loading) {
|
| 27 |
return (
|
|
@@ -109,10 +118,11 @@ export default function PRReviewDeck({ proposals, onReviewProposal, onBatchRevie
|
|
| 109 |
const conf = Math.round((changes.confidence || (changes.proposed?.confidence) || 0.95) * 100);
|
| 110 |
|
| 111 |
return (
|
| 112 |
-
<
|
| 113 |
key={pr.id}
|
|
|
|
| 114 |
onClick={() => setSelectedProposal(pr)}
|
| 115 |
-
className={`p-3.5 rounded-xl border transition cursor-pointer text-xs ${
|
| 116 |
isSelected
|
| 117 |
? 'bg-[#121828] border-emerald-500/50 shadow-md shadow-emerald-500/5'
|
| 118 |
: 'bg-[#0D121F] border-slate-800 hover:border-slate-700'
|
|
@@ -144,7 +154,7 @@ export default function PRReviewDeck({ proposals, onReviewProposal, onBatchRevie
|
|
| 144 |
<span>{pr.proposal_type} DELTA</span>
|
| 145 |
<span>{pr.created_at ? new Date(pr.created_at).toLocaleTimeString() : 'Just now'}</span>
|
| 146 |
</div>
|
| 147 |
-
</
|
| 148 |
);
|
| 149 |
})}
|
| 150 |
</div>
|
|
|
|
| 1 |
+
import { Link } from 'react-router-dom';
|
| 2 |
import React, { useState } from 'react';
|
| 3 |
import {
|
| 4 |
GitPullRequest,
|
|
|
|
| 18 |
} from 'lucide-react';
|
| 19 |
import confetti from 'canvas-confetti';
|
| 20 |
|
| 21 |
+
export default function PRReviewDeck({ proposals = [], onReviewProposal, onBatchReview, loading, workspaceId, selectedProposalId }) {
|
| 22 |
const [selectedProposal, setSelectedProposal] = useState(null);
|
| 23 |
const [filterStatus, setFilterStatus] = useState('PENDING');
|
| 24 |
const [reviewComment, setReviewComment] = useState('');
|
| 25 |
const [isSubmitting, setIsSubmitting] = useState(false);
|
| 26 |
+
// Auto-select proposal from URL if provided
|
| 27 |
+
React.useEffect(() => {
|
| 28 |
+
if (selectedProposalId && proposals?.length) {
|
| 29 |
+
const match = proposals.find((p) => p.id === selectedProposalId || p.id.startsWith(selectedProposalId));
|
| 30 |
+
if (match) setSelectedProposal(match);
|
| 31 |
+
}
|
| 32 |
+
}, [selectedProposalId, proposals]);
|
| 33 |
+
|
| 34 |
|
| 35 |
if (loading) {
|
| 36 |
return (
|
|
|
|
| 118 |
const conf = Math.round((changes.confidence || (changes.proposed?.confidence) || 0.95) * 100);
|
| 119 |
|
| 120 |
return (
|
| 121 |
+
<Link
|
| 122 |
key={pr.id}
|
| 123 |
+
to={`/workspaces/${workspaceId || 'default'}/prs/${pr.id}`}
|
| 124 |
onClick={() => setSelectedProposal(pr)}
|
| 125 |
+
className={`p-3.5 rounded-xl border transition cursor-pointer text-xs block no-underline ${
|
| 126 |
isSelected
|
| 127 |
? 'bg-[#121828] border-emerald-500/50 shadow-md shadow-emerald-500/5'
|
| 128 |
: 'bg-[#0D121F] border-slate-800 hover:border-slate-700'
|
|
|
|
| 154 |
<span>{pr.proposal_type} DELTA</span>
|
| 155 |
<span>{pr.created_at ? new Date(pr.created_at).toLocaleTimeString() : 'Just now'}</span>
|
| 156 |
</div>
|
| 157 |
+
</Link>
|
| 158 |
);
|
| 159 |
})}
|
| 160 |
</div>
|
studio/src/components/WorkspaceHub.jsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
| 1 |
import React, { useState, useMemo } from 'react';
|
|
|
|
|
|
|
| 2 |
import {
|
| 3 |
Layers,
|
| 4 |
Search,
|
|
@@ -30,7 +32,9 @@ import {
|
|
| 30 |
LogOut,
|
| 31 |
Info,
|
| 32 |
Server,
|
| 33 |
-
Key
|
|
|
|
|
|
|
| 34 |
} from 'lucide-react';
|
| 35 |
|
| 36 |
const GRADIENTS = [
|
|
@@ -50,6 +54,9 @@ export default function WorkspaceHub({
|
|
| 50 |
currentUser,
|
| 51 |
onLogout
|
| 52 |
}) {
|
|
|
|
|
|
|
|
|
|
| 53 |
const [searchQuery, setSearchQuery] = useState('');
|
| 54 |
const [sortBy, setSortBy] = useState('updated'); // updated, docs, facts, name
|
| 55 |
const [showCreateModal, setShowCreateModal] = useState(false);
|
|
@@ -358,10 +365,11 @@ export default function WorkspaceHub({
|
|
| 358 |
const isSelected = currentWorkspace?.id === ws.id;
|
| 359 |
|
| 360 |
return (
|
| 361 |
-
<
|
| 362 |
key={ws.id || idx}
|
| 363 |
-
|
| 364 |
-
|
|
|
|
| 365 |
>
|
| 366 |
{/* Top Gradient Banner with Space Info */}
|
| 367 |
<div className={`p-5 bg-gradient-to-r ${gradient} relative`}>
|
|
@@ -409,7 +417,7 @@ export default function WorkspaceHub({
|
|
| 409 |
</span>
|
| 410 |
</div>
|
| 411 |
</div>
|
| 412 |
-
</
|
| 413 |
);
|
| 414 |
})}
|
| 415 |
</div>
|
|
@@ -420,7 +428,7 @@ export default function WorkspaceHub({
|
|
| 420 |
{/* ===================================================================== */}
|
| 421 |
{/* USER PROFILE MODAL */}
|
| 422 |
{/* ===================================================================== */}
|
| 423 |
-
{showProfileModal && (
|
| 424 |
<div className="fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4">
|
| 425 |
<div className="bg-[#0D1117] border border-[#30363D] rounded-2xl max-w-lg w-full p-6 space-y-6 shadow-2xl text-slate-200">
|
| 426 |
<div className="flex items-center justify-between pb-3 border-b border-[#30363D]">
|
|
@@ -429,7 +437,7 @@ export default function WorkspaceHub({
|
|
| 429 |
<h3 className="text-base font-bold text-white">Developer Profile</h3>
|
| 430 |
</div>
|
| 431 |
<button
|
| 432 |
-
onClick={() => setShowProfileModal(false)}
|
| 433 |
className="text-slate-400 hover:text-white p-1 rounded-lg hover:bg-[#21262D] transition"
|
| 434 |
>
|
| 435 |
<X className="w-5 h-5" />
|
|
@@ -515,7 +523,7 @@ export default function WorkspaceHub({
|
|
| 515 |
</button>
|
| 516 |
)}
|
| 517 |
<button
|
| 518 |
-
onClick={() => setShowProfileModal(false)}
|
| 519 |
className="ml-auto px-4 py-1.5 rounded-lg bg-[#21262D] hover:bg-[#30363D] text-white text-xs font-bold transition"
|
| 520 |
>
|
| 521 |
Close
|
|
@@ -528,7 +536,7 @@ export default function WorkspaceHub({
|
|
| 528 |
{/* ===================================================================== */}
|
| 529 |
{/* SETTINGS MODAL */}
|
| 530 |
{/* ===================================================================== */}
|
| 531 |
-
{showSettingsModal && (
|
| 532 |
<div className="fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4">
|
| 533 |
<div className="bg-[#0D1117] border border-[#30363D] rounded-2xl max-w-lg w-full p-6 space-y-6 shadow-2xl text-slate-200">
|
| 534 |
<div className="flex items-center justify-between pb-3 border-b border-[#30363D]">
|
|
@@ -537,14 +545,55 @@ export default function WorkspaceHub({
|
|
| 537 |
<h3 className="text-base font-bold text-white">Platform Settings</h3>
|
| 538 |
</div>
|
| 539 |
<button
|
| 540 |
-
onClick={() => setShowSettingsModal(false)}
|
| 541 |
className="text-slate-400 hover:text-white p-1 rounded-lg hover:bg-[#21262D] transition"
|
| 542 |
>
|
| 543 |
<X className="w-5 h-5" />
|
| 544 |
</button>
|
| 545 |
</div>
|
| 546 |
|
| 547 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 548 |
{/* Confidence Threshold Slider */}
|
| 549 |
<div className="space-y-2 bg-[#161B22] p-4 rounded-xl border border-[#30363D]">
|
| 550 |
<div className="flex items-center justify-between">
|
|
@@ -613,7 +662,7 @@ export default function WorkspaceHub({
|
|
| 613 |
|
| 614 |
<div className="flex items-center justify-end space-x-2 pt-2 border-t border-[#30363D]">
|
| 615 |
<button
|
| 616 |
-
onClick={() => setShowSettingsModal(false)}
|
| 617 |
className="px-4 py-1.5 rounded-lg bg-[#21262D] hover:bg-[#30363D] text-slate-300 text-xs font-medium transition"
|
| 618 |
>
|
| 619 |
Cancel
|
|
|
|
| 1 |
import React, { useState, useMemo } from 'react';
|
| 2 |
+
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
| 3 |
+
import { useTheme } from '../context/ThemeContext.jsx';
|
| 4 |
import {
|
| 5 |
Layers,
|
| 6 |
Search,
|
|
|
|
| 32 |
LogOut,
|
| 33 |
Info,
|
| 34 |
Server,
|
| 35 |
+
Key,
|
| 36 |
+
Sun,
|
| 37 |
+
Moon
|
| 38 |
} from 'lucide-react';
|
| 39 |
|
| 40 |
const GRADIENTS = [
|
|
|
|
| 54 |
currentUser,
|
| 55 |
onLogout
|
| 56 |
}) {
|
| 57 |
+
const { theme, setTheme } = useTheme();
|
| 58 |
+
const location = useLocation();
|
| 59 |
+
const navigate = useNavigate();
|
| 60 |
const [searchQuery, setSearchQuery] = useState('');
|
| 61 |
const [sortBy, setSortBy] = useState('updated'); // updated, docs, facts, name
|
| 62 |
const [showCreateModal, setShowCreateModal] = useState(false);
|
|
|
|
| 365 |
const isSelected = currentWorkspace?.id === ws.id;
|
| 366 |
|
| 367 |
return (
|
| 368 |
+
<Link
|
| 369 |
key={ws.id || idx}
|
| 370 |
+
to={`/workspaces/${ws.id}/diff`}
|
| 371 |
+
onClick={() => onSelectWorkspace && onSelectWorkspace(ws)}
|
| 372 |
+
className="group relative rounded-2xl overflow-hidden border border-[#30363D] hover:border-slate-500 bg-[#0D1117] transition-all duration-200 cursor-pointer shadow-lg hover:shadow-2xl flex flex-col justify-between block no-underline"
|
| 373 |
>
|
| 374 |
{/* Top Gradient Banner with Space Info */}
|
| 375 |
<div className={`p-5 bg-gradient-to-r ${gradient} relative`}>
|
|
|
|
| 417 |
</span>
|
| 418 |
</div>
|
| 419 |
</div>
|
| 420 |
+
</Link>
|
| 421 |
);
|
| 422 |
})}
|
| 423 |
</div>
|
|
|
|
| 428 |
{/* ===================================================================== */}
|
| 429 |
{/* USER PROFILE MODAL */}
|
| 430 |
{/* ===================================================================== */}
|
| 431 |
+
{(showProfileModal || location.pathname === '/profile') && (
|
| 432 |
<div className="fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4">
|
| 433 |
<div className="bg-[#0D1117] border border-[#30363D] rounded-2xl max-w-lg w-full p-6 space-y-6 shadow-2xl text-slate-200">
|
| 434 |
<div className="flex items-center justify-between pb-3 border-b border-[#30363D]">
|
|
|
|
| 437 |
<h3 className="text-base font-bold text-white">Developer Profile</h3>
|
| 438 |
</div>
|
| 439 |
<button
|
| 440 |
+
onClick={() => { setShowProfileModal(false); if (location.pathname === "/profile") navigate("/"); }}
|
| 441 |
className="text-slate-400 hover:text-white p-1 rounded-lg hover:bg-[#21262D] transition"
|
| 442 |
>
|
| 443 |
<X className="w-5 h-5" />
|
|
|
|
| 523 |
</button>
|
| 524 |
)}
|
| 525 |
<button
|
| 526 |
+
onClick={() => { setShowProfileModal(false); if (location.pathname === "/profile") navigate("/"); }}
|
| 527 |
className="ml-auto px-4 py-1.5 rounded-lg bg-[#21262D] hover:bg-[#30363D] text-white text-xs font-bold transition"
|
| 528 |
>
|
| 529 |
Close
|
|
|
|
| 536 |
{/* ===================================================================== */}
|
| 537 |
{/* SETTINGS MODAL */}
|
| 538 |
{/* ===================================================================== */}
|
| 539 |
+
{(showSettingsModal || location.pathname === '/settings') && (
|
| 540 |
<div className="fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4">
|
| 541 |
<div className="bg-[#0D1117] border border-[#30363D] rounded-2xl max-w-lg w-full p-6 space-y-6 shadow-2xl text-slate-200">
|
| 542 |
<div className="flex items-center justify-between pb-3 border-b border-[#30363D]">
|
|
|
|
| 545 |
<h3 className="text-base font-bold text-white">Platform Settings</h3>
|
| 546 |
</div>
|
| 547 |
<button
|
| 548 |
+
onClick={() => { setShowSettingsModal(false); if (location.pathname === "/settings") navigate("/"); }}
|
| 549 |
className="text-slate-400 hover:text-white p-1 rounded-lg hover:bg-[#21262D] transition"
|
| 550 |
>
|
| 551 |
<X className="w-5 h-5" />
|
| 552 |
</button>
|
| 553 |
</div>
|
| 554 |
|
| 555 |
+
<div className="space-y-4 text-xs">
|
| 556 |
+
{/* Interface Theme Toggle */}
|
| 557 |
+
<div className="space-y-2 bg-[#161B22] p-4 rounded-xl border border-[#30363D]">
|
| 558 |
+
<div className="flex items-center justify-between">
|
| 559 |
+
<span className="font-semibold text-slate-200 flex items-center space-x-1.5">
|
| 560 |
+
<Sun className="w-3.5 h-3.5 text-amber-400" />
|
| 561 |
+
<span>Interface Theme</span>
|
| 562 |
+
</span>
|
| 563 |
+
<span className="text-[10px] font-mono px-2 py-0.5 rounded bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 font-bold uppercase">
|
| 564 |
+
{theme} Mode Active
|
| 565 |
+
</span>
|
| 566 |
+
</div>
|
| 567 |
+
<p className="text-[11px] text-slate-400">
|
| 568 |
+
Select your preferred appearance for semantic diffs, knowledge graphs, and doc staging.
|
| 569 |
+
</p>
|
| 570 |
+
<div className="grid grid-cols-2 gap-2 pt-1">
|
| 571 |
+
<button
|
| 572 |
+
type="button"
|
| 573 |
+
onClick={() => setTheme('dark')}
|
| 574 |
+
className={`px-3 py-2 rounded-lg border text-xs font-semibold flex items-center justify-center space-x-2 transition ${
|
| 575 |
+
theme === 'dark'
|
| 576 |
+
? 'bg-emerald-500/15 border-emerald-500 text-emerald-300 font-bold shadow-sm'
|
| 577 |
+
: 'bg-[#0D1117] border-[#30363D] text-slate-400 hover:text-slate-200 hover:bg-[#21262D]'
|
| 578 |
+
}`}
|
| 579 |
+
>
|
| 580 |
+
<Moon className="w-4 h-4 text-indigo-400" />
|
| 581 |
+
<span>Dark Mode</span>
|
| 582 |
+
</button>
|
| 583 |
+
<button
|
| 584 |
+
type="button"
|
| 585 |
+
onClick={() => setTheme('light')}
|
| 586 |
+
className={`px-3 py-2 rounded-lg border text-xs font-semibold flex items-center justify-center space-x-2 transition ${
|
| 587 |
+
theme === 'light'
|
| 588 |
+
? 'bg-emerald-500/15 border-emerald-500 text-emerald-300 font-bold shadow-sm'
|
| 589 |
+
: 'bg-[#0D1117] border-[#30363D] text-slate-400 hover:text-slate-200 hover:bg-[#21262D]'
|
| 590 |
+
}`}
|
| 591 |
+
>
|
| 592 |
+
<Sun className="w-4 h-4 text-amber-400" />
|
| 593 |
+
<span>Light Mode</span>
|
| 594 |
+
</button>
|
| 595 |
+
</div>
|
| 596 |
+
</div>
|
| 597 |
{/* Confidence Threshold Slider */}
|
| 598 |
<div className="space-y-2 bg-[#161B22] p-4 rounded-xl border border-[#30363D]">
|
| 599 |
<div className="flex items-center justify-between">
|
|
|
|
| 662 |
|
| 663 |
<div className="flex items-center justify-end space-x-2 pt-2 border-t border-[#30363D]">
|
| 664 |
<button
|
| 665 |
+
onClick={() => { setShowSettingsModal(false); if (location.pathname === "/settings") navigate("/"); }}
|
| 666 |
className="px-4 py-1.5 rounded-lg bg-[#21262D] hover:bg-[#30363D] text-slate-300 text-xs font-medium transition"
|
| 667 |
>
|
| 668 |
Cancel
|
studio/src/context/ThemeContext.jsx
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { createContext, useContext, useEffect, useState } from 'react';
|
| 2 |
+
|
| 3 |
+
const ThemeContext = createContext();
|
| 4 |
+
|
| 5 |
+
export function ThemeProvider({ children }) {
|
| 6 |
+
const [theme, setTheme] = useState(() => {
|
| 7 |
+
return localStorage.getItem('diffweave_theme') || 'dark';
|
| 8 |
+
});
|
| 9 |
+
|
| 10 |
+
useEffect(() => {
|
| 11 |
+
const root = document.documentElement;
|
| 12 |
+
if (theme === 'light') {
|
| 13 |
+
root.classList.remove('dark');
|
| 14 |
+
root.classList.add('light');
|
| 15 |
+
} else {
|
| 16 |
+
root.classList.add('dark');
|
| 17 |
+
root.classList.remove('light');
|
| 18 |
+
}
|
| 19 |
+
localStorage.setItem('diffweave_theme', theme);
|
| 20 |
+
}, [theme]);
|
| 21 |
+
|
| 22 |
+
const toggleTheme = () => {
|
| 23 |
+
setTheme((prev) => (prev === 'dark' ? 'light' : 'dark'));
|
| 24 |
+
};
|
| 25 |
+
|
| 26 |
+
return (
|
| 27 |
+
<ThemeContext.Provider value={{ theme, setTheme, toggleTheme }}>
|
| 28 |
+
{children}
|
| 29 |
+
</ThemeContext.Provider>
|
| 30 |
+
);
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
export const useTheme = () => {
|
| 34 |
+
const context = useContext(ThemeContext);
|
| 35 |
+
if (!context) {
|
| 36 |
+
return { theme: 'dark', setTheme: () => {}, toggleTheme: () => {} };
|
| 37 |
+
}
|
| 38 |
+
return context;
|
| 39 |
+
};
|
studio/src/index.css
CHANGED
|
@@ -527,3 +527,149 @@ code, pre, .font-mono {
|
|
| 527 |
color: #10B981;
|
| 528 |
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
|
| 529 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 527 |
color: #10B981;
|
| 528 |
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
|
| 529 |
}
|
| 530 |
+
|
| 531 |
+
/* ========================================================================= */
|
| 532 |
+
/* LIGHT THEME SYSTEM (Triggered when html element has class "light") */
|
| 533 |
+
/* ========================================================================= */
|
| 534 |
+
html.light {
|
| 535 |
+
color-scheme: light;
|
| 536 |
+
}
|
| 537 |
+
|
| 538 |
+
html.light body {
|
| 539 |
+
background-color: #F8FAFC !important;
|
| 540 |
+
color: #0F172A !important;
|
| 541 |
+
}
|
| 542 |
+
|
| 543 |
+
/* Base dark container overrides */
|
| 544 |
+
html.light .bg-\[\#080B11\],
|
| 545 |
+
html.light .bg-\[\#0A0D14\],
|
| 546 |
+
html.light .bg-\[\#0D1117\],
|
| 547 |
+
html.light .bg-\[\#0D121F\],
|
| 548 |
+
html.light .bg-\[\#010409\] {
|
| 549 |
+
background-color: #F8FAFC !important;
|
| 550 |
+
}
|
| 551 |
+
|
| 552 |
+
/* Card and surface containers */
|
| 553 |
+
html.light .bg-\[\#161B22\],
|
| 554 |
+
html.light .bg-\[\#141B2D\],
|
| 555 |
+
html.light .bg-\[\#121828\] {
|
| 556 |
+
background-color: #FFFFFF !important;
|
| 557 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
/* Sub-card & hovered pill backgrounds */
|
| 561 |
+
html.light .bg-\[\#21262D\],
|
| 562 |
+
html.light .bg-\[\#21262D\]\/70,
|
| 563 |
+
html.light .hover\:bg-\[\#21262D\]:hover,
|
| 564 |
+
html.light .hover\:bg-\[\#161B22\]:hover {
|
| 565 |
+
background-color: #F1F5F9 !important;
|
| 566 |
+
}
|
| 567 |
+
|
| 568 |
+
/* Border overrides */
|
| 569 |
+
html.light .border-\[\#30363D\],
|
| 570 |
+
html.light .border-\[\#21262D\],
|
| 571 |
+
html.light .border-slate-800,
|
| 572 |
+
html.light .border-slate-800\/80,
|
| 573 |
+
html.light .border-slate-900 {
|
| 574 |
+
border-color: #E2E8F0 !important;
|
| 575 |
+
}
|
| 576 |
+
|
| 577 |
+
/* Primary and high-contrast text */
|
| 578 |
+
html.light .text-white,
|
| 579 |
+
html.light .text-slate-100,
|
| 580 |
+
html.light .text-slate-200 {
|
| 581 |
+
color: #0F172A !important;
|
| 582 |
+
}
|
| 583 |
+
|
| 584 |
+
/* Secondary and muted text */
|
| 585 |
+
html.light .text-slate-300,
|
| 586 |
+
html.light .text-slate-400 {
|
| 587 |
+
color: #475569 !important;
|
| 588 |
+
}
|
| 589 |
+
|
| 590 |
+
html.light .text-slate-500 {
|
| 591 |
+
color: #64748B !important;
|
| 592 |
+
}
|
| 593 |
+
|
| 594 |
+
/* Overlay & modal backdrop */
|
| 595 |
+
html.light .bg-black\/80,
|
| 596 |
+
html.light .bg-black\/70 {
|
| 597 |
+
background-color: rgba(15, 23, 42, 0.55) !important;
|
| 598 |
+
}
|
| 599 |
+
|
| 600 |
+
html.light .bg-black\/40,
|
| 601 |
+
html.light .bg-black\/30,
|
| 602 |
+
html.light .bg-black\/20 {
|
| 603 |
+
background-color: rgba(0, 0, 0, 0.04) !important;
|
| 604 |
+
}
|
| 605 |
+
|
| 606 |
+
/* Light mode Auth form styling */
|
| 607 |
+
html.light .dw-auth {
|
| 608 |
+
background: #F8FAFC;
|
| 609 |
+
}
|
| 610 |
+
|
| 611 |
+
html.light .dw-auth__card {
|
| 612 |
+
background: #FFFFFF;
|
| 613 |
+
border-color: #E2E8F0;
|
| 614 |
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
|
| 615 |
+
}
|
| 616 |
+
|
| 617 |
+
html.light .dw-input {
|
| 618 |
+
background-color: #FFFFFF;
|
| 619 |
+
border-color: #CBD5E1;
|
| 620 |
+
color: #0F172A;
|
| 621 |
+
}
|
| 622 |
+
|
| 623 |
+
html.light .dw-input:focus {
|
| 624 |
+
border-color: #10B981;
|
| 625 |
+
box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
|
| 626 |
+
}
|
| 627 |
+
|
| 628 |
+
html.light .dw-auth-tabs {
|
| 629 |
+
background: #F1F5F9;
|
| 630 |
+
border-color: #E2E8F0;
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
html.light .dw-auth-tab--active {
|
| 634 |
+
background: #FFFFFF;
|
| 635 |
+
color: #059669;
|
| 636 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
|
| 637 |
+
}
|
| 638 |
+
|
| 639 |
+
/* Extra container overrides */
|
| 640 |
+
html.light .bg-\[\#0C101A\],
|
| 641 |
+
html.light .bg-\[\#090D16\],
|
| 642 |
+
html.light .bg-\[\#0C1518\],
|
| 643 |
+
html.light .bg-\[\#0E1422\],
|
| 644 |
+
html.light .bg-\[\#101524\],
|
| 645 |
+
html.light .bg-\[\#101726\],
|
| 646 |
+
html.light .bg-\[\#13111C\],
|
| 647 |
+
html.light .bg-\[\#141824\] {
|
| 648 |
+
background-color: #FFFFFF !important;
|
| 649 |
+
}
|
| 650 |
+
|
| 651 |
+
/* Extra card & surface containers */
|
| 652 |
+
html.light .bg-\[\#161F32\],
|
| 653 |
+
html.light .bg-\[\#1E2740\] {
|
| 654 |
+
background-color: #FFFFFF !important;
|
| 655 |
+
}
|
| 656 |
+
|
| 657 |
+
/* Light mode form inputs */
|
| 658 |
+
html.light input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
|
| 659 |
+
html.light select,
|
| 660 |
+
html.light textarea {
|
| 661 |
+
background-color: #FFFFFF !important;
|
| 662 |
+
color: #0F172A !important;
|
| 663 |
+
border-color: #CBD5E1 !important;
|
| 664 |
+
}
|
| 665 |
+
|
| 666 |
+
/* Badges & slate pills */
|
| 667 |
+
html.light .bg-slate-800 {
|
| 668 |
+
background-color: #E2E8F0 !important;
|
| 669 |
+
color: #334155 !important;
|
| 670 |
+
}
|
| 671 |
+
|
| 672 |
+
html.light .bg-slate-900 {
|
| 673 |
+
background-color: #F1F5F9 !important;
|
| 674 |
+
color: #1E293B !important;
|
| 675 |
+
}
|
studio/src/main.jsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
-
|
| 2 |
import ReactDOM from 'react-dom/client'
|
| 3 |
-
import { BrowserRouter, Routes, Route
|
| 4 |
import { AuthProvider } from './context/AuthContext.jsx'
|
|
|
|
| 5 |
import ProtectedRoute from './components/ProtectedRoute.jsx'
|
| 6 |
import App from './App.jsx'
|
| 7 |
import Login from './pages/auth/Login.jsx'
|
|
@@ -13,25 +14,27 @@ import './index.css'
|
|
| 13 |
ReactDOM.createRoot(document.getElementById('root')).render(
|
| 14 |
<React.StrictMode>
|
| 15 |
<AuthProvider>
|
| 16 |
-
<
|
| 17 |
-
<
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
| 35 |
</AuthProvider>
|
| 36 |
</React.StrictMode>,
|
| 37 |
-
)
|
|
|
|
| 1 |
+
import React from 'react'
|
| 2 |
import ReactDOM from 'react-dom/client'
|
| 3 |
+
import { BrowserRouter, Routes, Route } from 'react-router-dom'
|
| 4 |
import { AuthProvider } from './context/AuthContext.jsx'
|
| 5 |
+
import { ThemeProvider } from './context/ThemeContext.jsx'
|
| 6 |
import ProtectedRoute from './components/ProtectedRoute.jsx'
|
| 7 |
import App from './App.jsx'
|
| 8 |
import Login from './pages/auth/Login.jsx'
|
|
|
|
| 14 |
ReactDOM.createRoot(document.getElementById('root')).render(
|
| 15 |
<React.StrictMode>
|
| 16 |
<AuthProvider>
|
| 17 |
+
<ThemeProvider>
|
| 18 |
+
<BrowserRouter>
|
| 19 |
+
<Routes>
|
| 20 |
+
{/* Public auth routes */}
|
| 21 |
+
<Route path="/login" element={<Login />} />
|
| 22 |
+
<Route path="/signup" element={<Signup />} />
|
| 23 |
+
<Route path="/forgot-password" element={<ForgotPassword />} />
|
| 24 |
+
<Route path="/reset-password" element={<ResetPassword />} />
|
| 25 |
|
| 26 |
+
{/* Protected application routes */}
|
| 27 |
+
<Route
|
| 28 |
+
path="/*"
|
| 29 |
+
element={
|
| 30 |
+
<ProtectedRoute>
|
| 31 |
+
<App />
|
| 32 |
+
</ProtectedRoute>
|
| 33 |
+
}
|
| 34 |
+
/>
|
| 35 |
+
</Routes>
|
| 36 |
+
</BrowserRouter>
|
| 37 |
+
</ThemeProvider>
|
| 38 |
</AuthProvider>
|
| 39 |
</React.StrictMode>,
|
| 40 |
+
)
|