feat(ui): add Hugging Face style Workspace Hub and GitHub style empty state quickstart
Browse files- studio/src/App.jsx +197 -114
- studio/src/components/Navbar.jsx +165 -163
- studio/src/components/WorkspaceEmptyState.jsx +252 -0
- studio/src/components/WorkspaceHub.jsx +539 -0
studio/src/App.jsx
CHANGED
|
@@ -3,6 +3,8 @@ import { useAuth } from './context/AuthContext.jsx';
|
|
| 3 |
import React, { useState, useEffect, useCallback } from 'react';
|
| 4 |
import { api } from './api/client';
|
| 5 |
import Navbar from './components/Navbar';
|
|
|
|
|
|
|
| 6 |
import SemanticDiffViewer from './components/SemanticDiffViewer';
|
| 7 |
import PRReviewDeck from './components/PRReviewDeck';
|
| 8 |
import IngestionStaging from './components/IngestionStaging';
|
|
@@ -11,17 +13,18 @@ import KnowledgeBase from './components/KnowledgeBase';
|
|
| 11 |
import PolicyRulesLab from './components/PolicyRulesLab';
|
| 12 |
import AuditLog from './components/AuditLog';
|
| 13 |
import AuthView from './components/AuthView';
|
| 14 |
-
import { RefreshCw, CheckCircle2, AlertCircle, Sparkles, GitBranch } from 'lucide-react';
|
| 15 |
|
| 16 |
export default function App() {
|
| 17 |
const { isAuthenticated, logout: authLogout, user: authUser } = useAuth();
|
| 18 |
const navigate = useNavigate();
|
| 19 |
|
| 20 |
const [workspaces, setWorkspaces] = useState([]);
|
| 21 |
-
const [currentWorkspace, setCurrentWorkspace] = useState(null);
|
| 22 |
-
const [activeTab, setActiveTab] = useState('diff');
|
| 23 |
const [currentUser, setCurrentUser] = useState(null);
|
| 24 |
const [searchQuery, setSearchQuery] = useState('');
|
|
|
|
| 25 |
|
| 26 |
// State data
|
| 27 |
const [stats, setStats] = useState(null);
|
|
@@ -47,10 +50,7 @@ export default function App() {
|
|
| 47 |
async function init() {
|
| 48 |
try {
|
| 49 |
const wsList = await api.getWorkspaces();
|
| 50 |
-
setWorkspaces(wsList);
|
| 51 |
-
if (wsList && wsList.length > 0) {
|
| 52 |
-
setCurrentWorkspace(wsList[0]);
|
| 53 |
-
}
|
| 54 |
} catch (err) {
|
| 55 |
showToast(`Connecting to DiffWeave FastMCP Bridge...`, 'info');
|
| 56 |
}
|
|
@@ -102,6 +102,17 @@ export default function App() {
|
|
| 102 |
const statusRes = await api.getWorkspaceStatus(wsId);
|
| 103 |
if (statusRes?.stats) {
|
| 104 |
setStats(statusRes.stats);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
}
|
| 106 |
} catch {
|
| 107 |
// silent fallback
|
|
@@ -116,6 +127,7 @@ export default function App() {
|
|
| 116 |
useEffect(() => {
|
| 117 |
refreshData();
|
| 118 |
}, [refreshData]);
|
|
|
|
| 119 |
useEffect(() => {
|
| 120 |
if (authUser) {
|
| 121 |
setCurrentUser(authUser);
|
|
@@ -129,14 +141,32 @@ export default function App() {
|
|
| 129 |
const handleCreateWorkspace = async (name, desc) => {
|
| 130 |
try {
|
| 131 |
const newWs = await api.createWorkspace(name, desc);
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
} catch (err) {
|
| 136 |
showToast(`Create failed: ${err.message}`, 'error');
|
| 137 |
}
|
| 138 |
};
|
| 139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
const handleReview = async (proposalId, decision, comments = '') => {
|
| 141 |
try {
|
| 142 |
await api.reviewProposal(currentWorkspace?.id, proposalId, decision, comments);
|
|
@@ -161,6 +191,8 @@ export default function App() {
|
|
| 161 |
try {
|
| 162 |
const res = await api.uploadDocument(currentWorkspace.id, file);
|
| 163 |
showToast(`Document ${file.name} staged!`);
|
|
|
|
|
|
|
| 164 |
refreshData();
|
| 165 |
return res;
|
| 166 |
} catch (err) {
|
|
@@ -211,6 +243,11 @@ export default function App() {
|
|
| 211 |
return <Navigate to="/login" replace />;
|
| 212 |
}
|
| 213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
return (
|
| 215 |
<div className="min-h-screen bg-[#0D1117] text-slate-100 flex flex-col font-sans selection:bg-emerald-500/20 selection:text-emerald-300">
|
| 216 |
{/* Platform Navigation */}
|
|
@@ -219,7 +256,8 @@ export default function App() {
|
|
| 219 |
onSearchChange={setSearchQuery}
|
| 220 |
workspaces={workspaces}
|
| 221 |
currentWorkspace={currentWorkspace}
|
| 222 |
-
onSelectWorkspace={
|
|
|
|
| 223 |
onCreateWorkspace={handleCreateWorkspace}
|
| 224 |
activeTab={activeTab}
|
| 225 |
onSelectTab={setActiveTab}
|
|
@@ -232,113 +270,158 @@ export default function App() {
|
|
| 232 |
/>
|
| 233 |
|
| 234 |
{/* Main Content Area */}
|
| 235 |
-
<main className="flex-1
|
| 236 |
-
{/*
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
</span>
|
| 243 |
-
<span className="px-2 py-0.5 rounded bg-emerald-500/10 text-emerald-400 font-mono border border-emerald-500/20 font-bold">
|
| 244 |
-
main
|
| 245 |
-
</span>
|
| 246 |
-
<span className="text-slate-600">•</span>
|
| 247 |
-
<span className="text-slate-400 font-mono text-[11px]">
|
| 248 |
-
Workspace: {currentWorkspace?.id || '4314fb04-95be-41a2-bef4-50bf27c9c363'}
|
| 249 |
-
</span>
|
| 250 |
-
</div>
|
| 251 |
-
|
| 252 |
-
<div className="flex items-center space-x-2">
|
| 253 |
-
<button
|
| 254 |
-
onClick={() => setActiveTab('staging')}
|
| 255 |
-
className="px-2.5 py-1 rounded-md bg-[#238636] hover:bg-[#2EA043] text-white font-semibold text-xs transition"
|
| 256 |
-
>
|
| 257 |
-
+ Stage Document
|
| 258 |
-
</button>
|
| 259 |
-
<button
|
| 260 |
-
onClick={() => refreshData()}
|
| 261 |
-
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"
|
| 262 |
-
>
|
| 263 |
-
<RefreshCw className={`w-3.5 h-3.5 ${refreshing ? 'animate-spin text-emerald-400' : ''}`} />
|
| 264 |
-
<span>Sync</span>
|
| 265 |
-
</button>
|
| 266 |
-
</div>
|
| 267 |
-
</div>
|
| 268 |
-
|
| 269 |
-
{/* TAB 1: Semantic Diff Viewer (Default!) */}
|
| 270 |
-
{activeTab === 'diff' && (
|
| 271 |
-
<SemanticDiffViewer
|
| 272 |
-
diffData={diff}
|
| 273 |
-
onReviewProposal={handleReview}
|
| 274 |
-
onBatchReview={handleBatchReview}
|
| 275 |
-
loading={loading}
|
| 276 |
-
/>
|
| 277 |
-
)}
|
| 278 |
-
|
| 279 |
-
{/* TAB 2: Pull Requests Deck */}
|
| 280 |
-
{activeTab === 'prs' && (
|
| 281 |
-
<PRReviewDeck
|
| 282 |
-
proposals={proposals}
|
| 283 |
-
onReviewProposal={handleReview}
|
| 284 |
-
onBatchReview={handleBatchReview}
|
| 285 |
-
loading={loading}
|
| 286 |
-
/>
|
| 287 |
-
)}
|
| 288 |
-
|
| 289 |
-
{/* TAB 3: Knowledge Graph DAG Canvas */}
|
| 290 |
-
{activeTab === 'graph' && (
|
| 291 |
-
<KnowledgeGraph graphData={graphData} loading={loading} />
|
| 292 |
-
)}
|
| 293 |
-
|
| 294 |
-
{/* TAB 4: Documents & Ingestion Staging */}
|
| 295 |
-
{activeTab === 'staging' && (
|
| 296 |
-
<IngestionStaging
|
| 297 |
-
documents={documents}
|
| 298 |
-
onUploadDocument={handleUpload}
|
| 299 |
-
currentWorkspace={currentWorkspace}
|
| 300 |
-
loading={loading}
|
| 301 |
-
/>
|
| 302 |
-
)}
|
| 303 |
-
|
| 304 |
-
{/* TAB 5: Policy Rules CI Lab */}
|
| 305 |
-
{activeTab === 'rules' && (
|
| 306 |
-
<PolicyRulesLab
|
| 307 |
-
rules={rules}
|
| 308 |
-
currentWorkspace={currentWorkspace}
|
| 309 |
-
onCreateRule={handleCreateRule}
|
| 310 |
-
onDeleteRule={handleDeleteRule}
|
| 311 |
-
onValidate={handleValidate}
|
| 312 |
-
loading={loading}
|
| 313 |
-
/>
|
| 314 |
-
)}
|
| 315 |
-
|
| 316 |
-
{/* TAB 6: Master Truth Register */}
|
| 317 |
-
{activeTab === 'knowledge' && (
|
| 318 |
-
<KnowledgeBase
|
| 319 |
-
knowledgeItems={knowledgeItems}
|
| 320 |
currentWorkspace={currentWorkspace}
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
|
|
|
| 324 |
/>
|
| 325 |
)}
|
| 326 |
|
| 327 |
-
{/*
|
| 328 |
-
{
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
)}
|
| 343 |
</main>
|
| 344 |
|
|
|
|
| 3 |
import React, { useState, useEffect, useCallback } from 'react';
|
| 4 |
import { api } from './api/client';
|
| 5 |
import Navbar from './components/Navbar';
|
| 6 |
+
import WorkspaceHub from './components/WorkspaceHub';
|
| 7 |
+
import WorkspaceEmptyState from './components/WorkspaceEmptyState';
|
| 8 |
import SemanticDiffViewer from './components/SemanticDiffViewer';
|
| 9 |
import PRReviewDeck from './components/PRReviewDeck';
|
| 10 |
import IngestionStaging from './components/IngestionStaging';
|
|
|
|
| 13 |
import PolicyRulesLab from './components/PolicyRulesLab';
|
| 14 |
import AuditLog from './components/AuditLog';
|
| 15 |
import AuthView from './components/AuthView';
|
| 16 |
+
import { RefreshCw, CheckCircle2, AlertCircle, Sparkles, GitBranch, ArrowLeft } from 'lucide-react';
|
| 17 |
|
| 18 |
export default function App() {
|
| 19 |
const { isAuthenticated, logout: authLogout, user: authUser } = useAuth();
|
| 20 |
const navigate = useNavigate();
|
| 21 |
|
| 22 |
const [workspaces, setWorkspaces] = useState([]);
|
| 23 |
+
const [currentWorkspace, setCurrentWorkspace] = useState(null); // Defaults to null -> shows WorkspaceHub!
|
| 24 |
+
const [activeTab, setActiveTab] = useState('diff');
|
| 25 |
const [currentUser, setCurrentUser] = useState(null);
|
| 26 |
const [searchQuery, setSearchQuery] = useState('');
|
| 27 |
+
const [dismissedEmptyStateFor, setDismissedEmptyStateFor] = useState(null);
|
| 28 |
|
| 29 |
// State data
|
| 30 |
const [stats, setStats] = useState(null);
|
|
|
|
| 50 |
async function init() {
|
| 51 |
try {
|
| 52 |
const wsList = await api.getWorkspaces();
|
| 53 |
+
setWorkspaces(Array.isArray(wsList) ? wsList : []);
|
|
|
|
|
|
|
|
|
|
| 54 |
} catch (err) {
|
| 55 |
showToast(`Connecting to DiffWeave FastMCP Bridge...`, 'info');
|
| 56 |
}
|
|
|
|
| 102 |
const statusRes = await api.getWorkspaceStatus(wsId);
|
| 103 |
if (statusRes?.stats) {
|
| 104 |
setStats(statusRes.stats);
|
| 105 |
+
// Also update counts in current workspace object
|
| 106 |
+
if (statusRes.stats.total_documents !== undefined || statusRes.stats.knowledge_items !== undefined) {
|
| 107 |
+
setCurrentWorkspace((prev) => {
|
| 108 |
+
if (!prev) return prev;
|
| 109 |
+
return {
|
| 110 |
+
...prev,
|
| 111 |
+
d_count: statusRes.stats.total_documents ?? prev.d_count,
|
| 112 |
+
k_count: statusRes.stats.knowledge_items ?? prev.k_count
|
| 113 |
+
};
|
| 114 |
+
});
|
| 115 |
+
}
|
| 116 |
}
|
| 117 |
} catch {
|
| 118 |
// silent fallback
|
|
|
|
| 127 |
useEffect(() => {
|
| 128 |
refreshData();
|
| 129 |
}, [refreshData]);
|
| 130 |
+
|
| 131 |
useEffect(() => {
|
| 132 |
if (authUser) {
|
| 133 |
setCurrentUser(authUser);
|
|
|
|
| 141 |
const handleCreateWorkspace = async (name, desc) => {
|
| 142 |
try {
|
| 143 |
const newWs = await api.createWorkspace(name, desc);
|
| 144 |
+
const wsItem = {
|
| 145 |
+
...newWs,
|
| 146 |
+
name: newWs.name || name,
|
| 147 |
+
description: newWs.description || desc,
|
| 148 |
+
d_count: 0,
|
| 149 |
+
k_count: 0
|
| 150 |
+
};
|
| 151 |
+
setWorkspaces((prev) => [wsItem, ...prev]);
|
| 152 |
+
setCurrentWorkspace(wsItem);
|
| 153 |
+
setActiveTab('quickstart'); // Automatically shows GitHub-style CLI instructions!
|
| 154 |
+
showToast(`Workspace "${name}" created! Follow CLI instructions to populate.`);
|
| 155 |
} catch (err) {
|
| 156 |
showToast(`Create failed: ${err.message}`, 'error');
|
| 157 |
}
|
| 158 |
};
|
| 159 |
|
| 160 |
+
const handleSelectWorkspace = (ws) => {
|
| 161 |
+
setCurrentWorkspace(ws);
|
| 162 |
+
// If workspace is brand new / has 0 docs and 0 facts, show quickstart CLI guide by default
|
| 163 |
+
if ((ws.d_count === 0 && ws.k_count === 0) || ws.is_new) {
|
| 164 |
+
setActiveTab('quickstart');
|
| 165 |
+
} else {
|
| 166 |
+
setActiveTab('diff');
|
| 167 |
+
}
|
| 168 |
+
};
|
| 169 |
+
|
| 170 |
const handleReview = async (proposalId, decision, comments = '') => {
|
| 171 |
try {
|
| 172 |
await api.reviewProposal(currentWorkspace?.id, proposalId, decision, comments);
|
|
|
|
| 191 |
try {
|
| 192 |
const res = await api.uploadDocument(currentWorkspace.id, file);
|
| 193 |
showToast(`Document ${file.name} staged!`);
|
| 194 |
+
// Update local workspace count
|
| 195 |
+
setCurrentWorkspace((prev) => prev ? { ...prev, d_count: (prev.d_count || 0) + 1 } : prev);
|
| 196 |
refreshData();
|
| 197 |
return res;
|
| 198 |
} catch (err) {
|
|
|
|
| 243 |
return <Navigate to="/login" replace />;
|
| 244 |
}
|
| 245 |
|
| 246 |
+
// Check if current workspace is completely empty
|
| 247 |
+
const isWorkspaceEmpty = currentWorkspace &&
|
| 248 |
+
(currentWorkspace.d_count === 0 && currentWorkspace.k_count === 0) &&
|
| 249 |
+
dismissedEmptyStateFor !== currentWorkspace.id;
|
| 250 |
+
|
| 251 |
return (
|
| 252 |
<div className="min-h-screen bg-[#0D1117] text-slate-100 flex flex-col font-sans selection:bg-emerald-500/20 selection:text-emerald-300">
|
| 253 |
{/* Platform Navigation */}
|
|
|
|
| 256 |
onSearchChange={setSearchQuery}
|
| 257 |
workspaces={workspaces}
|
| 258 |
currentWorkspace={currentWorkspace}
|
| 259 |
+
onSelectWorkspace={handleSelectWorkspace}
|
| 260 |
+
onOpenHub={() => setCurrentWorkspace(null)}
|
| 261 |
onCreateWorkspace={handleCreateWorkspace}
|
| 262 |
activeTab={activeTab}
|
| 263 |
onSelectTab={setActiveTab}
|
|
|
|
| 270 |
/>
|
| 271 |
|
| 272 |
{/* Main Content Area */}
|
| 273 |
+
<main className="flex-1 w-full">
|
| 274 |
+
{/* =================================================================== */}
|
| 275 |
+
{/* VIEW 1: Hugging Face Style Workspaces Hub (When no ws is selected) */}
|
| 276 |
+
{/* =================================================================== */}
|
| 277 |
+
{!currentWorkspace && (
|
| 278 |
+
<WorkspaceHub
|
| 279 |
+
workspaces={workspaces}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
currentWorkspace={currentWorkspace}
|
| 281 |
+
onSelectWorkspace={handleSelectWorkspace}
|
| 282 |
+
onCreateWorkspace={handleCreateWorkspace}
|
| 283 |
+
currentUser={currentUser}
|
| 284 |
+
onOpenAuth={() => setActiveTab('auth')}
|
| 285 |
/>
|
| 286 |
)}
|
| 287 |
|
| 288 |
+
{/* =================================================================== */}
|
| 289 |
+
{/* VIEW 2: Inside a Workspace */}
|
| 290 |
+
{/* =================================================================== */}
|
| 291 |
+
{currentWorkspace && (
|
| 292 |
+
<div className="max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-6 space-y-6">
|
| 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 |
+
<button
|
| 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 |
+
</button>
|
| 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" />
|
| 306 |
+
<span>Knowledge Branch:</span>
|
| 307 |
+
</span>
|
| 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">·</span>
|
| 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 |
+
<button
|
| 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 |
+
</button>
|
| 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"
|
| 327 |
+
>
|
| 328 |
+
<RefreshCw className={`w-3.5 h-3.5 ${refreshing ? 'animate-spin text-emerald-400' : ''}`} />
|
| 329 |
+
<span>Sync</span>
|
| 330 |
+
</button>
|
| 331 |
+
</div>
|
| 332 |
+
</div>
|
| 333 |
+
|
| 334 |
+
{/* If workspace is empty or user is on quickstart tab, show GitHub-style CLI instructions */}
|
| 335 |
+
{(isWorkspaceEmpty || activeTab === 'quickstart') ? (
|
| 336 |
+
<WorkspaceEmptyState
|
| 337 |
+
workspace={currentWorkspace}
|
| 338 |
+
currentUser={currentUser}
|
| 339 |
+
onUploadDocument={handleUpload}
|
| 340 |
+
onRefresh={refreshData}
|
| 341 |
+
onDismissEmptyState={() => {
|
| 342 |
+
setDismissedEmptyStateFor(currentWorkspace.id);
|
| 343 |
+
setActiveTab('diff');
|
| 344 |
+
}}
|
| 345 |
+
/>
|
| 346 |
+
) : (
|
| 347 |
+
<>
|
| 348 |
+
{/* TAB 1: Semantic Diff Viewer (Default!) */}
|
| 349 |
+
{activeTab === 'diff' && (
|
| 350 |
+
<SemanticDiffViewer
|
| 351 |
+
diffData={diff}
|
| 352 |
+
onReviewProposal={handleReview}
|
| 353 |
+
onBatchReview={handleBatchReview}
|
| 354 |
+
loading={loading}
|
| 355 |
+
/>
|
| 356 |
+
)}
|
| 357 |
+
|
| 358 |
+
{/* TAB 2: Pull Requests Deck */}
|
| 359 |
+
{activeTab === 'prs' && (
|
| 360 |
+
<PRReviewDeck
|
| 361 |
+
proposals={proposals}
|
| 362 |
+
onReviewProposal={handleReview}
|
| 363 |
+
onBatchReview={handleBatchReview}
|
| 364 |
+
loading={loading}
|
| 365 |
+
/>
|
| 366 |
+
)}
|
| 367 |
+
|
| 368 |
+
{/* TAB 3: Knowledge Graph DAG Canvas */}
|
| 369 |
+
{activeTab === 'graph' && (
|
| 370 |
+
<KnowledgeGraph graphData={graphData} loading={loading} />
|
| 371 |
+
)}
|
| 372 |
+
|
| 373 |
+
{/* TAB 4: Documents & Ingestion Staging */}
|
| 374 |
+
{activeTab === 'staging' && (
|
| 375 |
+
<IngestionStaging
|
| 376 |
+
documents={documents}
|
| 377 |
+
onUploadDocument={handleUpload}
|
| 378 |
+
currentWorkspace={currentWorkspace}
|
| 379 |
+
loading={loading}
|
| 380 |
+
/>
|
| 381 |
+
)}
|
| 382 |
+
|
| 383 |
+
{/* TAB 5: Policy Rules CI Lab */}
|
| 384 |
+
{activeTab === 'rules' && (
|
| 385 |
+
<PolicyRulesLab
|
| 386 |
+
rules={rules}
|
| 387 |
+
currentWorkspace={currentWorkspace}
|
| 388 |
+
onCreateRule={handleCreateRule}
|
| 389 |
+
onDeleteRule={handleDeleteRule}
|
| 390 |
+
onValidate={handleValidate}
|
| 391 |
+
loading={loading}
|
| 392 |
+
/>
|
| 393 |
+
)}
|
| 394 |
+
|
| 395 |
+
{/* TAB 6: Master Truth Register */}
|
| 396 |
+
{activeTab === 'knowledge' && (
|
| 397 |
+
<KnowledgeBase
|
| 398 |
+
knowledgeItems={knowledgeItems}
|
| 399 |
+
currentWorkspace={currentWorkspace}
|
| 400 |
+
loading={loading}
|
| 401 |
+
searchQuery={searchQuery}
|
| 402 |
+
onSearchChange={setSearchQuery}
|
| 403 |
+
/>
|
| 404 |
+
)}
|
| 405 |
+
|
| 406 |
+
{/* TAB 7: Audit Timeline Log */}
|
| 407 |
+
{activeTab === 'audit' && (
|
| 408 |
+
<AuditLog activityFeed={activity} loading={loading} />
|
| 409 |
+
)}
|
| 410 |
+
|
| 411 |
+
{/* TAB 8: Dedicated Authentication & API Keys Page */}
|
| 412 |
+
{activeTab === 'auth' && (
|
| 413 |
+
<AuthView
|
| 414 |
+
currentUser={currentUser}
|
| 415 |
+
onAuthSuccess={(user) => {
|
| 416 |
+
setCurrentUser(user);
|
| 417 |
+
showToast(`Authenticated as ${user.username || 'Evaluator'}!`);
|
| 418 |
+
}}
|
| 419 |
+
onReturnToStudio={() => setActiveTab('diff')}
|
| 420 |
+
/>
|
| 421 |
+
)}
|
| 422 |
+
</>
|
| 423 |
+
)}
|
| 424 |
+
</div>
|
| 425 |
)}
|
| 426 |
</main>
|
| 427 |
|
studio/src/components/Navbar.jsx
CHANGED
|
@@ -19,13 +19,17 @@ import {
|
|
| 19 |
Cpu,
|
| 20 |
Plus,
|
| 21 |
RefreshCw,
|
| 22 |
-
Sparkles
|
|
|
|
|
|
|
|
|
|
| 23 |
} from 'lucide-react';
|
| 24 |
|
| 25 |
export default function Navbar({
|
| 26 |
workspaces,
|
| 27 |
currentWorkspace,
|
| 28 |
onSelectWorkspace,
|
|
|
|
| 29 |
onCreateWorkspace,
|
| 30 |
activeTab,
|
| 31 |
onSelectTab,
|
|
@@ -43,23 +47,6 @@ export default function Navbar({
|
|
| 43 |
|
| 44 |
const wsDropdownRef = useRef(null);
|
| 45 |
const userDropdownRef = useRef(null);
|
| 46 |
-
const searchInputRef = useRef(null);
|
| 47 |
-
|
| 48 |
-
// Keyboard shortcut '/' to focus global search
|
| 49 |
-
useEffect(() => {
|
| 50 |
-
function handleKeyDown(e) {
|
| 51 |
-
if (e.key === '/' && document.activeElement !== searchInputRef.current && !['INPUT', 'TEXTAREA'].includes(document.activeElement?.tagName)) {
|
| 52 |
-
e.preventDefault();
|
| 53 |
-
searchInputRef.current?.focus();
|
| 54 |
-
}
|
| 55 |
-
if (e.key === 'Escape' && document.activeElement === searchInputRef.current) {
|
| 56 |
-
if (onSearchChange) onSearchChange('');
|
| 57 |
-
searchInputRef.current?.blur();
|
| 58 |
-
}
|
| 59 |
-
}
|
| 60 |
-
window.addEventListener('keydown', handleKeyDown);
|
| 61 |
-
return () => window.removeEventListener('keydown', handleKeyDown);
|
| 62 |
-
}, [onSearchChange]);
|
| 63 |
|
| 64 |
// Close dropdowns when clicking anywhere outside
|
| 65 |
useEffect(() => {
|
|
@@ -88,8 +75,8 @@ export default function Navbar({
|
|
| 88 |
setShowCreateModal(false);
|
| 89 |
};
|
| 90 |
|
| 91 |
-
const totalDocs = stats?.total_documents ?? 0;
|
| 92 |
-
const verifiedFacts = stats?.knowledge_items ?? stats?.total_knowledge_items ?? 0;
|
| 93 |
const pendingProposals = stats?.pending_proposals ?? 0;
|
| 94 |
|
| 95 |
const tabs = [
|
|
@@ -100,21 +87,23 @@ export default function Navbar({
|
|
| 100 |
{ id: 'rules', label: 'Policy CI Rules', icon: ShieldCheck },
|
| 101 |
{ id: 'knowledge', label: 'Master Truth Register', icon: Database, badge: verifiedFacts > 0 ? `${verifiedFacts}` : undefined },
|
| 102 |
{ id: 'audit', label: 'Audit Trail', icon: History },
|
|
|
|
| 103 |
{ id: 'auth', label: 'API Keys & Auth', icon: Key, badge: currentUser ? 'Active' : 'DocWeave' },
|
| 104 |
];
|
| 105 |
|
| 106 |
return (
|
| 107 |
<header className="w-full bg-[#0D1117] border-b border-[#30363D] text-slate-100 select-none">
|
| 108 |
{/* --------------------------------------------------------------------- */}
|
| 109 |
-
{/* TIER 1: Global Platform Bar (#010409)
|
| 110 |
{/* --------------------------------------------------------------------- */}
|
| 111 |
<div className="bg-[#010409] border-b border-[#30363D] px-4 sm:px-6 py-2.5 flex items-center justify-between text-xs">
|
| 112 |
{/* Left: Brand & Workspace Selector */}
|
| 113 |
<div className="flex items-center space-x-3">
|
| 114 |
-
{/* DiffWeave Logo */}
|
| 115 |
<div
|
| 116 |
-
onClick={
|
| 117 |
className="flex items-center space-x-2.5 cursor-pointer group"
|
|
|
|
| 118 |
>
|
| 119 |
<div className="w-8 h-8 rounded-lg bg-gradient-to-tr from-emerald-500 via-teal-500 to-sky-500 p-0.5 shadow-md group-hover:scale-105 transition">
|
| 120 |
<div className="w-full h-full bg-[#010409] rounded-[6px] flex items-center justify-center">
|
|
@@ -133,6 +122,19 @@ export default function Navbar({
|
|
| 133 |
|
| 134 |
<span className="text-slate-600 hidden sm:inline">/</span>
|
| 135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
{/* Workspace Dropdown */}
|
| 137 |
<div ref={wsDropdownRef} className="relative">
|
| 138 |
<button
|
|
@@ -142,47 +144,65 @@ export default function Navbar({
|
|
| 142 |
}}
|
| 143 |
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 font-medium"
|
| 144 |
>
|
| 145 |
-
<span className=
|
| 146 |
-
<span className="truncate max-w-[150px] text-xs">
|
| 147 |
-
{currentWorkspace?.name
|
| 148 |
</span>
|
| 149 |
<ChevronDown className="w-3 h-3 text-slate-400" />
|
| 150 |
</button>
|
| 151 |
|
| 152 |
{showWsDropdown && (
|
| 153 |
-
<div className="absolute left-0 mt-1.5 w-64 bg-[#161B22] border border-[#30363D] rounded-
|
| 154 |
-
|
| 155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
</div>
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
<span className="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
)}
|
| 175 |
-
</
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
<div className="pt-1 border-t border-[#30363D]">
|
| 180 |
<button
|
| 181 |
onClick={() => {
|
| 182 |
setShowWsDropdown(false);
|
| 183 |
setShowCreateModal(true);
|
| 184 |
}}
|
| 185 |
-
className="w-full text-left px-2 py-1.5 rounded text-xs text-sky-400 hover:bg-[#21262D] font-semibold flex items-center space-x-1"
|
| 186 |
>
|
| 187 |
<Plus className="w-3.5 h-3.5" />
|
| 188 |
<span>New Document Workspace...</span>
|
|
@@ -193,55 +213,16 @@ export default function Navbar({
|
|
| 193 |
</div>
|
| 194 |
</div>
|
| 195 |
|
| 196 |
-
{/*
|
| 197 |
-
<div className="hidden md:flex items-center flex-1 max-w-sm mx-6">
|
| 198 |
-
<div className="w-full relative flex items-center">
|
| 199 |
-
<Search className="w-3.5 h-3.5 text-slate-500 absolute left-3" />
|
| 200 |
-
<input
|
| 201 |
-
type="text"
|
| 202 |
-
readOnly
|
| 203 |
-
onClick={() => onSelectTab('knowledge')}
|
| 204 |
-
placeholder="Search claims, policies, documents, rules... (press /)"
|
| 205 |
-
className="w-full pl-8 pr-8 py-1 rounded-md bg-[#161B22] hover:bg-[#21262D] border border-[#30363D] text-[11px] text-slate-300 placeholder-slate-500 cursor-pointer transition focus:outline-none"
|
| 206 |
-
/>
|
| 207 |
-
<span className="absolute right-2 text-[10px] font-mono text-slate-500 bg-[#0D1117] border border-[#30363D] px-1.5 py-0.5 rounded">
|
| 208 |
-
/
|
| 209 |
-
</span>
|
| 210 |
-
</div>
|
| 211 |
-
</div>
|
| 212 |
-
|
| 213 |
-
{/* Right: FastMCP Status & Identity */}
|
| 214 |
<div className="flex items-center space-x-3">
|
| 215 |
-
{/* FastMCP Pill */}
|
| 216 |
-
<div className="hidden
|
| 217 |
-
<
|
| 218 |
-
<
|
|
|
|
| 219 |
</div>
|
| 220 |
|
| 221 |
-
{/*
|
| 222 |
-
<a
|
| 223 |
-
href="http://localhost:5173"
|
| 224 |
-
target="_blank"
|
| 225 |
-
rel="noreferrer"
|
| 226 |
-
className="hidden sm:flex items-center space-x-1 text-slate-400 hover:text-white transition px-2 py-1 rounded hover:bg-[#161B22]"
|
| 227 |
-
title="Open DocWeave Web App"
|
| 228 |
-
>
|
| 229 |
-
<span>DocWeave Portal</span>
|
| 230 |
-
<ExternalLink className="w-3 h-3" />
|
| 231 |
-
</a>
|
| 232 |
-
|
| 233 |
-
{/* Sync Button */}
|
| 234 |
-
{onRefresh && (
|
| 235 |
-
<button
|
| 236 |
-
onClick={onRefresh}
|
| 237 |
-
className="p-1.5 rounded-md bg-[#161B22] hover:bg-[#21262D] border border-[#30363D] text-slate-300 hover:text-white transition"
|
| 238 |
-
title="Sync Workspace with FastMCP"
|
| 239 |
-
>
|
| 240 |
-
<RefreshCw className={`w-3.5 h-3.5 ${refreshing ? 'animate-spin text-emerald-400' : ''}`} />
|
| 241 |
-
</button>
|
| 242 |
-
)}
|
| 243 |
-
|
| 244 |
-
{/* User Profile / Auth Button */}
|
| 245 |
{currentUser ? (
|
| 246 |
<div ref={userDropdownRef} className="relative">
|
| 247 |
<button
|
|
@@ -261,11 +242,21 @@ export default function Navbar({
|
|
| 261 |
</button>
|
| 262 |
|
| 263 |
{showUserDropdown && (
|
| 264 |
-
<div className="absolute right-0 mt-1.5 w-56 bg-[#161B22] border border-[#30363D] rounded-
|
| 265 |
<div className="px-2 py-1.5 border-b border-[#30363D]">
|
| 266 |
<p className="font-bold text-white">{currentUser.username || 'User'}</p>
|
| 267 |
<p className="text-[11px] text-slate-400 font-mono truncate">{currentUser.email || 'user@docweave.io'}</p>
|
| 268 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
<button
|
| 270 |
onClick={() => {
|
| 271 |
setShowUserDropdown(false);
|
|
@@ -302,80 +293,91 @@ export default function Navbar({
|
|
| 302 |
</div>
|
| 303 |
|
| 304 |
{/* --------------------------------------------------------------------- */}
|
| 305 |
-
{/* TIER 2: Workspace Document Context Header (#0D1117) */}
|
| 306 |
{/* --------------------------------------------------------------------- */}
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 320 |
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
|
|
|
|
|
|
| 339 |
</div>
|
| 340 |
-
</div>
|
| 341 |
-
</div>
|
| 342 |
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
isActive
|
| 356 |
-
? 'border-emerald-500 text-white font-bold'
|
| 357 |
-
: 'border-transparent text-slate-400 hover:text-slate-200 hover:border-slate-600'
|
| 358 |
-
}`}
|
| 359 |
-
>
|
| 360 |
-
<Icon className={`w-4 h-4 ${isActive ? 'text-emerald-400' : 'text-slate-500'}`} />
|
| 361 |
-
<span>{tab.label}</span>
|
| 362 |
-
{tab.badge && (
|
| 363 |
-
<span
|
| 364 |
-
className={`px-1.5 py-0.2 rounded-full text-[10px] font-mono ${
|
| 365 |
isActive
|
| 366 |
-
? '
|
| 367 |
-
: '
|
| 368 |
}`}
|
| 369 |
>
|
| 370 |
-
{
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 377 |
|
| 378 |
-
{/*
|
| 379 |
{showCreateModal && (
|
| 380 |
<div className="fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4">
|
| 381 |
<div className="bg-[#161B22] border border-[#30363D] rounded-xl max-w-md w-full p-6 space-y-4 shadow-2xl">
|
|
|
|
| 19 |
Cpu,
|
| 20 |
Plus,
|
| 21 |
RefreshCw,
|
| 22 |
+
Sparkles,
|
| 23 |
+
Terminal,
|
| 24 |
+
Grid,
|
| 25 |
+
ArrowLeft
|
| 26 |
} from 'lucide-react';
|
| 27 |
|
| 28 |
export default function Navbar({
|
| 29 |
workspaces,
|
| 30 |
currentWorkspace,
|
| 31 |
onSelectWorkspace,
|
| 32 |
+
onOpenHub,
|
| 33 |
onCreateWorkspace,
|
| 34 |
activeTab,
|
| 35 |
onSelectTab,
|
|
|
|
| 47 |
|
| 48 |
const wsDropdownRef = useRef(null);
|
| 49 |
const userDropdownRef = useRef(null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
// Close dropdowns when clicking anywhere outside
|
| 52 |
useEffect(() => {
|
|
|
|
| 75 |
setShowCreateModal(false);
|
| 76 |
};
|
| 77 |
|
| 78 |
+
const totalDocs = stats?.total_documents ?? currentWorkspace?.d_count ?? 0;
|
| 79 |
+
const verifiedFacts = stats?.knowledge_items ?? stats?.total_knowledge_items ?? currentWorkspace?.k_count ?? 0;
|
| 80 |
const pendingProposals = stats?.pending_proposals ?? 0;
|
| 81 |
|
| 82 |
const tabs = [
|
|
|
|
| 87 |
{ id: 'rules', label: 'Policy CI Rules', icon: ShieldCheck },
|
| 88 |
{ id: 'knowledge', label: 'Master Truth Register', icon: Database, badge: verifiedFacts > 0 ? `${verifiedFacts}` : undefined },
|
| 89 |
{ id: 'audit', label: 'Audit Trail', icon: History },
|
| 90 |
+
{ id: 'quickstart', label: 'CLI Quickstart', icon: Terminal },
|
| 91 |
{ id: 'auth', label: 'API Keys & Auth', icon: Key, badge: currentUser ? 'Active' : 'DocWeave' },
|
| 92 |
];
|
| 93 |
|
| 94 |
return (
|
| 95 |
<header className="w-full bg-[#0D1117] border-b border-[#30363D] text-slate-100 select-none">
|
| 96 |
{/* --------------------------------------------------------------------- */}
|
| 97 |
+
{/* TIER 1: Global Platform Bar (#010409) */}
|
| 98 |
{/* --------------------------------------------------------------------- */}
|
| 99 |
<div className="bg-[#010409] border-b border-[#30363D] px-4 sm:px-6 py-2.5 flex items-center justify-between text-xs">
|
| 100 |
{/* Left: Brand & Workspace Selector */}
|
| 101 |
<div className="flex items-center space-x-3">
|
| 102 |
+
{/* DiffWeave Logo (Navigates to Hub) */}
|
| 103 |
<div
|
| 104 |
+
onClick={onOpenHub}
|
| 105 |
className="flex items-center space-x-2.5 cursor-pointer group"
|
| 106 |
+
title="Return to Workspaces Hub"
|
| 107 |
>
|
| 108 |
<div className="w-8 h-8 rounded-lg bg-gradient-to-tr from-emerald-500 via-teal-500 to-sky-500 p-0.5 shadow-md group-hover:scale-105 transition">
|
| 109 |
<div className="w-full h-full bg-[#010409] rounded-[6px] flex items-center justify-center">
|
|
|
|
| 122 |
|
| 123 |
<span className="text-slate-600 hidden sm:inline">/</span>
|
| 124 |
|
| 125 |
+
{/* Hub Button */}
|
| 126 |
+
<button
|
| 127 |
+
onClick={onOpenHub}
|
| 128 |
+
className={`hidden sm:flex items-center space-x-1.5 px-2.5 py-1 rounded-md border text-xs font-semibold transition ${
|
| 129 |
+
!currentWorkspace
|
| 130 |
+
? 'bg-emerald-500/10 border-emerald-500/30 text-emerald-400'
|
| 131 |
+
: 'bg-[#161B22] hover:bg-[#21262D] border-[#30363D] text-slate-300 hover:text-white'
|
| 132 |
+
}`}
|
| 133 |
+
>
|
| 134 |
+
<Grid className="w-3.5 h-3.5" />
|
| 135 |
+
<span>Workspaces</span>
|
| 136 |
+
</button>
|
| 137 |
+
|
| 138 |
{/* Workspace Dropdown */}
|
| 139 |
<div ref={wsDropdownRef} className="relative">
|
| 140 |
<button
|
|
|
|
| 144 |
}}
|
| 145 |
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 font-medium"
|
| 146 |
>
|
| 147 |
+
<span className={`w-2 h-2 rounded-full ${currentWorkspace ? 'bg-emerald-400 animate-pulse' : 'bg-slate-500'}`} />
|
| 148 |
+
<span className="truncate max-w-[150px] text-xs font-semibold">
|
| 149 |
+
{currentWorkspace ? currentWorkspace.name : 'Select Workspace'}
|
| 150 |
</span>
|
| 151 |
<ChevronDown className="w-3 h-3 text-slate-400" />
|
| 152 |
</button>
|
| 153 |
|
| 154 |
{showWsDropdown && (
|
| 155 |
+
<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">
|
| 156 |
+
{/* Option to go to Hub */}
|
| 157 |
+
<button
|
| 158 |
+
onClick={() => {
|
| 159 |
+
onOpenHub();
|
| 160 |
+
setShowWsDropdown(false);
|
| 161 |
+
}}
|
| 162 |
+
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]"
|
| 163 |
+
>
|
| 164 |
+
<Grid className="w-3.5 h-3.5" />
|
| 165 |
+
<span>View All Workspaces (Hub)</span>
|
| 166 |
+
</button>
|
| 167 |
+
|
| 168 |
+
<div className="text-[10px] font-bold text-slate-400 px-2 pt-2 pb-1 uppercase tracking-wider">
|
| 169 |
+
Workspaces ({workspaces.length})
|
| 170 |
</div>
|
| 171 |
+
|
| 172 |
+
<div className="max-h-60 overflow-y-auto space-y-0.5">
|
| 173 |
+
{workspaces.map((w) => (
|
| 174 |
+
<button
|
| 175 |
+
key={w.id}
|
| 176 |
+
onClick={() => {
|
| 177 |
+
onSelectWorkspace(w);
|
| 178 |
+
setShowWsDropdown(false);
|
| 179 |
+
}}
|
| 180 |
+
className={`w-full text-left px-2.5 py-1.5 rounded text-xs transition flex items-center justify-between ${
|
| 181 |
+
currentWorkspace?.id === w.id
|
| 182 |
+
? 'bg-emerald-500/20 text-emerald-300 font-bold'
|
| 183 |
+
: 'text-slate-300 hover:bg-[#21262D]'
|
| 184 |
+
}`}
|
| 185 |
+
>
|
| 186 |
+
<div className="flex flex-col truncate pr-2">
|
| 187 |
+
<span className="truncate font-semibold">{w.name}</span>
|
| 188 |
+
<span className="text-[10px] text-slate-400 font-normal truncate">
|
| 189 |
+
{w.d_count ?? 0} docs · {w.k_count ?? 0} facts
|
| 190 |
+
</span>
|
| 191 |
+
</div>
|
| 192 |
+
{currentWorkspace?.id === w.id && (
|
| 193 |
+
<CheckCircle2 className="w-3.5 h-3.5 text-emerald-400 shrink-0" />
|
| 194 |
)}
|
| 195 |
+
</button>
|
| 196 |
+
))}
|
| 197 |
+
</div>
|
| 198 |
+
|
| 199 |
+
<div className="pt-1.5 border-t border-[#30363D]">
|
| 200 |
<button
|
| 201 |
onClick={() => {
|
| 202 |
setShowWsDropdown(false);
|
| 203 |
setShowCreateModal(true);
|
| 204 |
}}
|
| 205 |
+
className="w-full text-left px-2 py-1.5 rounded text-xs text-sky-400 hover:bg-[#21262D] font-semibold flex items-center space-x-1.5"
|
| 206 |
>
|
| 207 |
<Plus className="w-3.5 h-3.5" />
|
| 208 |
<span>New Document Workspace...</span>
|
|
|
|
| 213 |
</div>
|
| 214 |
</div>
|
| 215 |
|
| 216 |
+
{/* Right: FastMCP Bridge status & User Profile */}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
<div className="flex items-center space-x-3">
|
| 218 |
+
{/* FastMCP Connected Pill */}
|
| 219 |
+
<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">
|
| 220 |
+
<span className="w-2 h-2 rounded-full bg-emerald-400 animate-ping" />
|
| 221 |
+
<Cpu className="w-3 h-3 text-emerald-400" />
|
| 222 |
+
<span>FastMCP: Active</span>
|
| 223 |
</div>
|
| 224 |
|
| 225 |
+
{/* User Menu */}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
{currentUser ? (
|
| 227 |
<div ref={userDropdownRef} className="relative">
|
| 228 |
<button
|
|
|
|
| 242 |
</button>
|
| 243 |
|
| 244 |
{showUserDropdown && (
|
| 245 |
+
<div className="absolute right-0 mt-1.5 w-56 bg-[#161B22] border border-[#30363D] rounded-xl shadow-2xl p-2 z-50 space-y-1 text-xs">
|
| 246 |
<div className="px-2 py-1.5 border-b border-[#30363D]">
|
| 247 |
<p className="font-bold text-white">{currentUser.username || 'User'}</p>
|
| 248 |
<p className="text-[11px] text-slate-400 font-mono truncate">{currentUser.email || 'user@docweave.io'}</p>
|
| 249 |
</div>
|
| 250 |
+
<button
|
| 251 |
+
onClick={() => {
|
| 252 |
+
setShowUserDropdown(false);
|
| 253 |
+
onOpenHub();
|
| 254 |
+
}}
|
| 255 |
+
className="w-full text-left px-2 py-1.5 rounded text-slate-300 hover:bg-[#21262D] flex items-center space-x-2"
|
| 256 |
+
>
|
| 257 |
+
<Grid className="w-3.5 h-3.5 text-sky-400" />
|
| 258 |
+
<span>Workspaces Hub</span>
|
| 259 |
+
</button>
|
| 260 |
<button
|
| 261 |
onClick={() => {
|
| 262 |
setShowUserDropdown(false);
|
|
|
|
| 293 |
</div>
|
| 294 |
|
| 295 |
{/* --------------------------------------------------------------------- */}
|
| 296 |
+
{/* TIER 2: Workspace Document Context Header (#0D1117) - If Workspace Active */}
|
| 297 |
{/* --------------------------------------------------------------------- */}
|
| 298 |
+
{currentWorkspace && (
|
| 299 |
+
<>
|
| 300 |
+
<div className="px-4 sm:px-6 py-3.5 flex flex-col sm:flex-row sm:items-center justify-between gap-3">
|
| 301 |
+
{/* Workspace Title & Badge */}
|
| 302 |
+
<div className="flex items-center space-x-2.5">
|
| 303 |
+
<button
|
| 304 |
+
onClick={onOpenHub}
|
| 305 |
+
className="p-1 rounded-md hover:bg-[#161B22] text-slate-400 hover:text-white transition"
|
| 306 |
+
title="Back to All Workspaces"
|
| 307 |
+
>
|
| 308 |
+
<ArrowLeft className="w-4 h-4" />
|
| 309 |
+
</button>
|
| 310 |
+
<Files className="w-5 h-5 text-emerald-400" />
|
| 311 |
+
<div className="flex items-center space-x-2">
|
| 312 |
+
<span className="text-white font-bold text-base sm:text-lg">
|
| 313 |
+
{currentWorkspace?.name}
|
| 314 |
+
</span>
|
| 315 |
+
<span className="px-2 py-0.5 rounded-full text-[10px] font-semibold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 font-mono">
|
| 316 |
+
Deterministic RAG
|
| 317 |
+
</span>
|
| 318 |
+
</div>
|
| 319 |
+
</div>
|
| 320 |
|
| 321 |
+
{/* Real Document Platform KPI Badges */}
|
| 322 |
+
<div className="flex items-center space-x-2 text-xs font-semibold">
|
| 323 |
+
<div className="flex items-center space-x-1.5 px-2.5 py-1 rounded-md bg-[#161B22] border border-[#30363D] text-slate-300">
|
| 324 |
+
<Files className="w-3.5 h-3.5 text-sky-400" />
|
| 325 |
+
<span>Tracked Docs:</span>
|
| 326 |
+
<span className="text-white font-bold font-mono">{totalDocs}</span>
|
| 327 |
+
</div>
|
| 328 |
|
| 329 |
+
<div className="flex items-center space-x-1.5 px-2.5 py-1 rounded-md bg-[#161B22] border border-[#30363D] text-slate-300">
|
| 330 |
+
<Database className="w-3.5 h-3.5 text-emerald-400" />
|
| 331 |
+
<span>Verified Truth:</span>
|
| 332 |
+
<span className="text-white font-bold font-mono">{verifiedFacts} Facts</span>
|
| 333 |
+
</div>
|
| 334 |
|
| 335 |
+
<div className="flex items-center space-x-1.5 px-2.5 py-1 rounded-md bg-[#161B22] border border-[#30363D] text-slate-300">
|
| 336 |
+
<GitPullRequest className="w-3.5 h-3.5 text-amber-400" />
|
| 337 |
+
<span>Pending PRs:</span>
|
| 338 |
+
<span className="text-amber-400 font-bold font-mono">{pendingProposals}</span>
|
| 339 |
+
</div>
|
| 340 |
+
</div>
|
| 341 |
</div>
|
|
|
|
|
|
|
| 342 |
|
| 343 |
+
{/* ----------------------------------------------------------------- */}
|
| 344 |
+
{/* TIER 3: Knowledge Git Tabs */}
|
| 345 |
+
{/* ----------------------------------------------------------------- */}
|
| 346 |
+
<nav className="px-4 sm:px-6 flex space-x-1 overflow-x-auto text-xs font-semibold no-scrollbar">
|
| 347 |
+
{tabs.map((tab) => {
|
| 348 |
+
const Icon = tab.icon;
|
| 349 |
+
const isActive = activeTab === tab.id;
|
| 350 |
+
return (
|
| 351 |
+
<button
|
| 352 |
+
key={tab.id}
|
| 353 |
+
onClick={() => onSelectTab(tab.id)}
|
| 354 |
+
className={`flex items-center space-x-2 px-3.5 py-2.5 border-b-2 transition whitespace-nowrap ${
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 355 |
isActive
|
| 356 |
+
? 'border-emerald-500 text-white font-bold'
|
| 357 |
+
: 'border-transparent text-slate-400 hover:text-slate-200 hover:border-slate-600'
|
| 358 |
}`}
|
| 359 |
>
|
| 360 |
+
<Icon className={`w-4 h-4 ${isActive ? 'text-emerald-400' : 'text-slate-500'}`} />
|
| 361 |
+
<span>{tab.label}</span>
|
| 362 |
+
{tab.badge && (
|
| 363 |
+
<span
|
| 364 |
+
className={`px-1.5 py-0.2 rounded-full text-[10px] font-mono ${
|
| 365 |
+
isActive
|
| 366 |
+
? 'bg-emerald-500/20 text-emerald-300 font-bold'
|
| 367 |
+
: 'bg-[#21262D] text-slate-400'
|
| 368 |
+
}`}
|
| 369 |
+
>
|
| 370 |
+
{tab.badge}
|
| 371 |
+
</span>
|
| 372 |
+
)}
|
| 373 |
+
</button>
|
| 374 |
+
);
|
| 375 |
+
})}
|
| 376 |
+
</nav>
|
| 377 |
+
</>
|
| 378 |
+
)}
|
| 379 |
|
| 380 |
+
{/* Fallback Simple Modal if triggered from dropdown */}
|
| 381 |
{showCreateModal && (
|
| 382 |
<div className="fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4">
|
| 383 |
<div className="bg-[#161B22] border border-[#30363D] rounded-xl max-w-md w-full p-6 space-y-4 shadow-2xl">
|
studio/src/components/WorkspaceEmptyState.jsx
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { useState } from 'react';
|
| 2 |
+
import {
|
| 3 |
+
Terminal,
|
| 4 |
+
Copy,
|
| 5 |
+
Check,
|
| 6 |
+
UploadCloud,
|
| 7 |
+
FileText,
|
| 8 |
+
GitBranch,
|
| 9 |
+
ShieldAlert,
|
| 10 |
+
ArrowRight,
|
| 11 |
+
BookOpen,
|
| 12 |
+
Sparkles,
|
| 13 |
+
ExternalLink,
|
| 14 |
+
Code2,
|
| 15 |
+
CheckCircle2
|
| 16 |
+
} from 'lucide-react';
|
| 17 |
+
|
| 18 |
+
export default function WorkspaceEmptyState({
|
| 19 |
+
workspace,
|
| 20 |
+
currentUser,
|
| 21 |
+
onUploadDocument,
|
| 22 |
+
onRefresh,
|
| 23 |
+
onDismissEmptyState
|
| 24 |
+
}) {
|
| 25 |
+
const [copiedId, setCopiedId] = useState(null);
|
| 26 |
+
const [uploading, setUploading] = useState(false);
|
| 27 |
+
const [uploadSuccess, setUploadSuccess] = useState(false);
|
| 28 |
+
|
| 29 |
+
const wsId = workspace?.id || 'workspace-id';
|
| 30 |
+
const token = typeof window !== 'undefined' ? localStorage.getItem('diffweave_token') || 'dw_pat_sample_token' : 'dw_pat_sample_token';
|
| 31 |
+
|
| 32 |
+
const copyToClipboard = (text, id) => {
|
| 33 |
+
navigator.clipboard.writeText(text);
|
| 34 |
+
setCopiedId(id);
|
| 35 |
+
setTimeout(() => setCopiedId(null), 2000);
|
| 36 |
+
};
|
| 37 |
+
|
| 38 |
+
const handleFileDrop = async (e) => {
|
| 39 |
+
e.preventDefault();
|
| 40 |
+
const files = e.dataTransfer ? e.dataTransfer.files : e.target.files;
|
| 41 |
+
if (!files || files.length === 0) return;
|
| 42 |
+
setUploading(true);
|
| 43 |
+
try {
|
| 44 |
+
for (let i = 0; i < files.length; i++) {
|
| 45 |
+
await onUploadDocument(files[i]);
|
| 46 |
+
}
|
| 47 |
+
setUploadSuccess(true);
|
| 48 |
+
if (onRefresh) onRefresh();
|
| 49 |
+
} catch (err) {
|
| 50 |
+
console.error(err);
|
| 51 |
+
} finally {
|
| 52 |
+
setUploading(false);
|
| 53 |
+
}
|
| 54 |
+
};
|
| 55 |
+
|
| 56 |
+
const cliSnippet1 = `# 1. Install or upgrade the DiffWeave CLI
|
| 57 |
+
pip install diffweave
|
| 58 |
+
|
| 59 |
+
# 2. Authenticate CLI session with your token
|
| 60 |
+
diffweave login --token ` + (token ? token.slice(0, 16) + '...' : 'YOUR_TOKEN') + `
|
| 61 |
+
|
| 62 |
+
# 3. Initialize this workspace locally in your document directory
|
| 63 |
+
diffweave init --workspace ` + wsId + `
|
| 64 |
+
|
| 65 |
+
# 4. Stage your documents or policy files for deterministic parsing
|
| 66 |
+
diffweave add ./policies/*.pdf
|
| 67 |
+
|
| 68 |
+
# 5. Run deterministic semantic diff & policy CI validation
|
| 69 |
+
diffweave diff
|
| 70 |
+
|
| 71 |
+
# 6. Commit & push verified knowledge to main
|
| 72 |
+
diffweave commit -m "Initial document ingestion"
|
| 73 |
+
diffweave push`;
|
| 74 |
+
|
| 75 |
+
const cliSnippet2 = `# Push an existing local folder or document collection
|
| 76 |
+
cd my-document-repo
|
| 77 |
+
diffweave remote add origin https://diff-weave.vercel.app/api/workspaces/` + wsId + `
|
| 78 |
+
diffweave branch -M main
|
| 79 |
+
diffweave push -u origin main`;
|
| 80 |
+
|
| 81 |
+
return (
|
| 82 |
+
<div className="space-y-6 max-w-5xl mx-auto py-2">
|
| 83 |
+
{/* Top Banner Notice */}
|
| 84 |
+
<div className="bg-gradient-to-r from-emerald-950/40 via-[#161B22] to-sky-950/40 border border-emerald-500/30 rounded-xl p-5 shadow-lg flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
| 85 |
+
<div className="flex items-center space-x-3.5">
|
| 86 |
+
<div className="w-10 h-10 rounded-xl bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center shrink-0">
|
| 87 |
+
<Sparkles className="w-5 h-5 text-emerald-400" />
|
| 88 |
+
</div>
|
| 89 |
+
<div>
|
| 90 |
+
<h3 className="text-base font-bold text-white">Workspace is empty</h3>
|
| 91 |
+
<p className="text-xs text-slate-300 mt-0.5">
|
| 92 |
+
Populate <span className="text-emerald-300 font-semibold">{workspace?.name || 'this workspace'}</span> with documents to start generating deterministic knowledge diffs, policy rules, and PRs.
|
| 93 |
+
</p>
|
| 94 |
+
</div>
|
| 95 |
+
</div>
|
| 96 |
+
{onDismissEmptyState && (
|
| 97 |
+
<button
|
| 98 |
+
onClick={onDismissEmptyState}
|
| 99 |
+
className="text-xs px-3 py-1.5 rounded-lg bg-[#21262D] hover:bg-[#30363D] text-slate-300 transition whitespace-nowrap self-start sm:self-auto font-medium"
|
| 100 |
+
>
|
| 101 |
+
Explore Empty Studio Tabs →
|
| 102 |
+
</button>
|
| 103 |
+
)}
|
| 104 |
+
</div>
|
| 105 |
+
|
| 106 |
+
{/* GitHub-style Quick Setup Terminal Box */}
|
| 107 |
+
<div className="bg-[#161B22] border border-[#30363D] rounded-xl overflow-hidden shadow-2xl">
|
| 108 |
+
<div className="bg-[#010409] px-6 py-4 border-b border-[#30363D] flex flex-col sm:flex-row sm:items-center justify-between gap-3">
|
| 109 |
+
<div>
|
| 110 |
+
<div className="flex items-center space-x-2 text-white font-bold text-base">
|
| 111 |
+
<Terminal className="w-5 h-5 text-emerald-400" />
|
| 112 |
+
<span>Quick setup — if you've done this kind of thing before</span>
|
| 113 |
+
</div>
|
| 114 |
+
<p className="text-xs text-slate-400 mt-1">
|
| 115 |
+
Get started by using the DiffWeave CLI, pushing existing documents, or uploading files directly below.
|
| 116 |
+
</p>
|
| 117 |
+
</div>
|
| 118 |
+
<div className="flex items-center space-x-2 text-xs font-mono">
|
| 119 |
+
<span className="px-2.5 py-1 rounded bg-[#161B22] border border-[#30363D] text-slate-300">
|
| 120 |
+
Workspace ID: <span className="text-emerald-400 font-bold">{wsId.slice(0, 8)}...</span>
|
| 121 |
+
</span>
|
| 122 |
+
<button
|
| 123 |
+
onClick={() => copyToClipboard(wsId, 'wsid')}
|
| 124 |
+
className="p-1.5 rounded bg-[#21262D] hover:bg-[#30363D] text-slate-300 transition"
|
| 125 |
+
title="Copy full workspace ID"
|
| 126 |
+
>
|
| 127 |
+
{copiedId === 'wsid' ? <Check className="w-3.5 h-3.5 text-emerald-400" /> : <Copy className="w-3.5 h-3.5" />}
|
| 128 |
+
</button>
|
| 129 |
+
</div>
|
| 130 |
+
</div>
|
| 131 |
+
|
| 132 |
+
<div className="p-6 space-y-6">
|
| 133 |
+
{/* Section 1: Create a new document workspace on the command line */}
|
| 134 |
+
<div className="space-y-3">
|
| 135 |
+
<div className="flex items-center justify-between">
|
| 136 |
+
<h4 className="text-sm font-bold text-white flex items-center space-x-2">
|
| 137 |
+
<span className="w-5 h-5 rounded-full bg-emerald-500/20 text-emerald-400 font-mono text-xs flex items-center justify-center font-bold">1</span>
|
| 138 |
+
<span>Initialize and push documents using the DiffWeave CLI</span>
|
| 139 |
+
</h4>
|
| 140 |
+
<button
|
| 141 |
+
onClick={() => copyToClipboard(cliSnippet1, 'cli1')}
|
| 142 |
+
className="flex items-center space-x-1.5 text-xs text-slate-300 hover:text-emerald-400 transition bg-[#0D1117] hover:bg-[#161B22] px-3 py-1 rounded-md border border-[#30363D]"
|
| 143 |
+
>
|
| 144 |
+
{copiedId === 'cli1' ? (
|
| 145 |
+
<>
|
| 146 |
+
<Check className="w-3.5 h-3.5 text-emerald-400" />
|
| 147 |
+
<span className="text-emerald-400 font-semibold">Copied!</span>
|
| 148 |
+
</>
|
| 149 |
+
) : (
|
| 150 |
+
<>
|
| 151 |
+
<Copy className="w-3.5 h-3.5" />
|
| 152 |
+
<span>Copy commands</span>
|
| 153 |
+
</>
|
| 154 |
+
)}
|
| 155 |
+
</button>
|
| 156 |
+
</div>
|
| 157 |
+
|
| 158 |
+
<div className="rounded-lg bg-[#0D1117] border border-[#30363D] p-4 font-mono text-xs text-slate-200 overflow-x-auto shadow-inner leading-relaxed">
|
| 159 |
+
<p className="text-slate-500"># 1. Install or upgrade the DiffWeave CLI</p>
|
| 160 |
+
<p><span className="text-emerald-400 font-bold">pip</span> install diffweave</p>
|
| 161 |
+
<br />
|
| 162 |
+
<p className="text-slate-500"># 2. Authenticate CLI session with your Personal Access Token</p>
|
| 163 |
+
<p><span className="text-emerald-400 font-bold">diffweave</span> login --token <span className="text-amber-300 font-semibold">{token ? token.slice(0, 20) + '...' : 'YOUR_TOKEN'}</span></p>
|
| 164 |
+
<br />
|
| 165 |
+
<p className="text-slate-500"># 3. Initialize this workspace locally in your document folder</p>
|
| 166 |
+
<p><span className="text-emerald-400 font-bold">diffweave</span> init --workspace <span className="text-sky-300 font-semibold">{wsId}</span></p>
|
| 167 |
+
<br />
|
| 168 |
+
<p className="text-slate-500"># 4. Stage your documents or policy files for deterministic parsing</p>
|
| 169 |
+
<p><span className="text-emerald-400 font-bold">diffweave</span> add ./policies/*.pdf</p>
|
| 170 |
+
<br />
|
| 171 |
+
<p className="text-slate-500"># 5. Run deterministic semantic diff & policy CI validation</p>
|
| 172 |
+
<p><span className="text-emerald-400 font-bold">diffweave</span> diff</p>
|
| 173 |
+
<br />
|
| 174 |
+
<p className="text-slate-500"># 6. Commit & push verified knowledge to main</p>
|
| 175 |
+
<p><span className="text-emerald-400 font-bold">diffweave</span> commit -m <span className="text-teal-300 font-semibold">"Initial document ingestion"</span></p>
|
| 176 |
+
<p><span className="text-emerald-400 font-bold">diffweave</span> push</p>
|
| 177 |
+
</div>
|
| 178 |
+
</div>
|
| 179 |
+
|
| 180 |
+
{/* Section 2: Push an existing document repository */}
|
| 181 |
+
<div className="space-y-3 pt-2">
|
| 182 |
+
<div className="flex items-center justify-between">
|
| 183 |
+
<h4 className="text-sm font-bold text-white flex items-center space-x-2">
|
| 184 |
+
<span className="w-5 h-5 rounded-full bg-slate-700 text-slate-300 font-mono text-xs flex items-center justify-center font-bold">2</span>
|
| 185 |
+
<span>…or push an existing document repository from the command line</span>
|
| 186 |
+
</h4>
|
| 187 |
+
<button
|
| 188 |
+
onClick={() => copyToClipboard(cliSnippet2, 'cli2')}
|
| 189 |
+
className="flex items-center space-x-1.5 text-xs text-slate-300 hover:text-emerald-400 transition bg-[#0D1117] hover:bg-[#161B22] px-3 py-1 rounded-md border border-[#30363D]"
|
| 190 |
+
>
|
| 191 |
+
{copiedId === 'cli2' ? (
|
| 192 |
+
<>
|
| 193 |
+
<Check className="w-3.5 h-3.5 text-emerald-400" />
|
| 194 |
+
<span className="text-emerald-400 font-semibold">Copied!</span>
|
| 195 |
+
</>
|
| 196 |
+
) : (
|
| 197 |
+
<>
|
| 198 |
+
<Copy className="w-3.5 h-3.5" />
|
| 199 |
+
<span>Copy commands</span>
|
| 200 |
+
</>
|
| 201 |
+
)}
|
| 202 |
+
</button>
|
| 203 |
+
</div>
|
| 204 |
+
<div className="rounded-lg bg-[#0D1117] border border-[#30363D] p-3.5 font-mono text-xs text-slate-300 overflow-x-auto shadow-inner leading-relaxed">
|
| 205 |
+
<p><span className="text-emerald-400 font-bold">cd</span> my-document-repo</p>
|
| 206 |
+
<p><span className="text-emerald-400 font-bold">diffweave</span> remote add origin https://diff-weave.vercel.app/api/workspaces/{wsId}</p>
|
| 207 |
+
<p><span className="text-emerald-400 font-bold">diffweave</span> branch -M main</p>
|
| 208 |
+
<p><span className="text-emerald-400 font-bold">diffweave</span> push -u origin main</p>
|
| 209 |
+
</div>
|
| 210 |
+
</div>
|
| 211 |
+
|
| 212 |
+
{/* Section 3: Browser Upload Dropzone */}
|
| 213 |
+
<div className="space-y-3 pt-3 border-t border-[#30363D]">
|
| 214 |
+
<h4 className="text-sm font-bold text-white flex items-center space-x-2">
|
| 215 |
+
<span className="w-5 h-5 rounded-full bg-sky-500/20 text-sky-400 font-mono text-xs flex items-center justify-center font-bold">3</span>
|
| 216 |
+
<span>…or populate directly in browser by uploading files</span>
|
| 217 |
+
</h4>
|
| 218 |
+
|
| 219 |
+
<label
|
| 220 |
+
onDragOver={(e) => e.preventDefault()}
|
| 221 |
+
onDrop={handleFileDrop}
|
| 222 |
+
className="border-2 border-dashed border-[#30363D] hover:border-emerald-500/70 bg-[#0D1117]/60 hover:bg-[#0D1117] rounded-xl p-8 flex flex-col items-center justify-center text-center cursor-pointer transition group"
|
| 223 |
+
>
|
| 224 |
+
<input
|
| 225 |
+
type="file"
|
| 226 |
+
multiple
|
| 227 |
+
className="hidden"
|
| 228 |
+
onChange={handleFileDrop}
|
| 229 |
+
accept=".pdf,.docx,.txt,.md,.csv,.json"
|
| 230 |
+
/>
|
| 231 |
+
<div className="w-12 h-12 rounded-full bg-[#161B22] group-hover:bg-emerald-500/10 flex items-center justify-center mb-3 transition">
|
| 232 |
+
<UploadCloud className="w-6 h-6 text-slate-400 group-hover:text-emerald-400 transition" />
|
| 233 |
+
</div>
|
| 234 |
+
<p className="text-sm font-semibold text-white">
|
| 235 |
+
{uploading ? 'Staging & extracting deterministic facts...' : 'Drop files here or click to browse'}
|
| 236 |
+
</p>
|
| 237 |
+
<p className="text-xs text-slate-400 mt-1 max-w-md">
|
| 238 |
+
Supports PDF, DOCX, TXT, Markdown, CSV, and JSON. DiffWeave will instantly generate semantic diff proposals and policy CI checks.
|
| 239 |
+
</p>
|
| 240 |
+
{uploadSuccess && (
|
| 241 |
+
<div className="mt-3 px-3 py-1 rounded bg-emerald-500/20 text-emerald-400 text-xs font-semibold flex items-center space-x-1.5">
|
| 242 |
+
<CheckCircle2 className="w-4 h-4" />
|
| 243 |
+
<span>Files staged! Refreshing workspace...</span>
|
| 244 |
+
</div>
|
| 245 |
+
)}
|
| 246 |
+
</label>
|
| 247 |
+
</div>
|
| 248 |
+
</div>
|
| 249 |
+
</div>
|
| 250 |
+
</div>
|
| 251 |
+
);
|
| 252 |
+
}
|
studio/src/components/WorkspaceHub.jsx
ADDED
|
@@ -0,0 +1,539 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { useState, useMemo } from 'react';
|
| 2 |
+
import {
|
| 3 |
+
Layers,
|
| 4 |
+
Search,
|
| 5 |
+
Plus,
|
| 6 |
+
ArrowUpDown,
|
| 7 |
+
ExternalLink,
|
| 8 |
+
Files,
|
| 9 |
+
Database,
|
| 10 |
+
GitPullRequest,
|
| 11 |
+
CheckCircle2,
|
| 12 |
+
Clock,
|
| 13 |
+
Sparkles,
|
| 14 |
+
Settings,
|
| 15 |
+
User,
|
| 16 |
+
ShieldCheck,
|
| 17 |
+
Globe,
|
| 18 |
+
Lock,
|
| 19 |
+
ChevronDown,
|
| 20 |
+
Activity,
|
| 21 |
+
Terminal,
|
| 22 |
+
X,
|
| 23 |
+
BookOpen
|
| 24 |
+
} from 'lucide-react';
|
| 25 |
+
|
| 26 |
+
const GRADIENTS = [
|
| 27 |
+
'from-teal-600/90 via-cyan-700/80 to-blue-800/90',
|
| 28 |
+
'from-blue-600/90 via-indigo-700/80 to-purple-800/90',
|
| 29 |
+
'from-purple-600/90 via-pink-700/80 to-rose-800/90',
|
| 30 |
+
'from-emerald-600/90 via-teal-700/80 to-sky-800/90',
|
| 31 |
+
'from-cyan-600/90 via-blue-700/80 to-indigo-800/90',
|
| 32 |
+
'from-violet-600/90 via-purple-700/80 to-fuchsia-800/90',
|
| 33 |
+
];
|
| 34 |
+
|
| 35 |
+
const EMOJIS = ['🧬', '🚀', '🩺', '⚡', '📊', '🌐', '🛡️', '📑', '🧠', '🔬'];
|
| 36 |
+
|
| 37 |
+
export default function WorkspaceHub({
|
| 38 |
+
workspaces = [],
|
| 39 |
+
currentWorkspace,
|
| 40 |
+
onSelectWorkspace,
|
| 41 |
+
onCreateWorkspace,
|
| 42 |
+
currentUser,
|
| 43 |
+
onOpenAuth
|
| 44 |
+
}) {
|
| 45 |
+
const [searchQuery, setSearchQuery] = useState('');
|
| 46 |
+
const [sortBy, setSortBy] = useState('updated'); // updated, docs, facts, name
|
| 47 |
+
const [showCreateModal, setShowCreateModal] = useState(false);
|
| 48 |
+
|
| 49 |
+
// GitHub-style Create Workspace form state
|
| 50 |
+
const [wsName, setWsName] = useState('');
|
| 51 |
+
const [wsDesc, setWsDesc] = useState('');
|
| 52 |
+
const [wsVisibility, setWsVisibility] = useState('public');
|
| 53 |
+
const [starterTemplate, setStarterTemplate] = useState('empty');
|
| 54 |
+
const [suggestedName] = useState(() => {
|
| 55 |
+
const suggestions = ['fuzzy-spork', 'neural-policy-v2', 'clinical-guidelines', 'rag-truth-matrix', 'legal-audit-2026'];
|
| 56 |
+
return suggestions[Math.floor(Math.random() * suggestions.length)];
|
| 57 |
+
});
|
| 58 |
+
|
| 59 |
+
const username = currentUser?.username || 'shak3008';
|
| 60 |
+
const displayName = currentUser?.username === 'shak3008' ? 'Adhi Shakthi' : (currentUser?.username || 'Adhi Shakthi');
|
| 61 |
+
|
| 62 |
+
// Filter & Sort Workspaces
|
| 63 |
+
const filteredWorkspaces = useMemo(() => {
|
| 64 |
+
let list = workspaces.filter((w) => {
|
| 65 |
+
const q = searchQuery.toLowerCase().trim();
|
| 66 |
+
if (!q) return true;
|
| 67 |
+
return (
|
| 68 |
+
(w.name && w.name.toLowerCase().includes(q)) ||
|
| 69 |
+
(w.description && w.description.toLowerCase().includes(q)) ||
|
| 70 |
+
(w.id && w.id.toLowerCase().includes(q))
|
| 71 |
+
);
|
| 72 |
+
});
|
| 73 |
+
|
| 74 |
+
if (sortBy === 'docs') {
|
| 75 |
+
list.sort((a, b) => (b.d_count ?? 0) - (a.d_count ?? 0));
|
| 76 |
+
} else if (sortBy === 'facts') {
|
| 77 |
+
list.sort((a, b) => (b.k_count ?? 0) - (a.k_count ?? 0));
|
| 78 |
+
} else if (sortBy === 'name') {
|
| 79 |
+
list.sort((a, b) => (a.name || '').localeCompare(b.name || ''));
|
| 80 |
+
}
|
| 81 |
+
return list;
|
| 82 |
+
}, [workspaces, searchQuery, sortBy]);
|
| 83 |
+
|
| 84 |
+
const handleCreateSubmit = async (e) => {
|
| 85 |
+
e.preventDefault();
|
| 86 |
+
const finalName = wsName.trim() || suggestedName;
|
| 87 |
+
await onCreateWorkspace(finalName, wsDesc.trim());
|
| 88 |
+
setWsName('');
|
| 89 |
+
setWsDesc('');
|
| 90 |
+
setShowCreateModal(false);
|
| 91 |
+
};
|
| 92 |
+
|
| 93 |
+
return (
|
| 94 |
+
<div className="w-full max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 space-y-8">
|
| 95 |
+
{/* 2-Column Hugging Face App Layout */}
|
| 96 |
+
<div className="grid grid-cols-1 lg:grid-cols-12 gap-8 items-start">
|
| 97 |
+
{/* ================================================================= */}
|
| 98 |
+
{/* LEFT COLUMN: User Profile Card (Matches HF media_2) */}
|
| 99 |
+
{/* ================================================================= */}
|
| 100 |
+
<div className="lg:col-span-3 space-y-6">
|
| 101 |
+
<div className="bg-[#0D1117] border border-[#30363D] rounded-2xl p-5 shadow-xl space-y-5">
|
| 102 |
+
{/* Avatar with Pink / Neon Green ring accent */}
|
| 103 |
+
<div className="relative w-28 h-28 mx-auto mt-2">
|
| 104 |
+
<div className="w-28 h-28 rounded-full bg-gradient-to-tr from-pink-500 via-rose-400 to-emerald-400 p-[3px] shadow-lg shadow-pink-500/20">
|
| 105 |
+
<div className="w-full h-full rounded-full bg-[#161B22] flex items-center justify-center overflow-hidden">
|
| 106 |
+
<div className="w-24 h-24 rounded-full bg-gradient-to-br from-pink-400 to-rose-600 flex items-center justify-center text-white text-3xl font-black shadow-inner">
|
| 107 |
+
{username[0]?.toUpperCase() || 'A'}
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
{/* Green star badge */}
|
| 112 |
+
<div className="absolute top-0 left-0 w-6 h-6 rounded-full bg-emerald-400 text-black flex items-center justify-center text-xs font-bold shadow-md">
|
| 113 |
+
✦
|
| 114 |
+
</div>
|
| 115 |
+
{/* Hand wave badge */}
|
| 116 |
+
<div className="absolute bottom-1 right-1 w-6 h-6 rounded-full bg-[#161B22] border border-[#30363D] flex items-center justify-center text-xs shadow-md">
|
| 117 |
+
👋
|
| 118 |
+
</div>
|
| 119 |
+
</div>
|
| 120 |
+
|
| 121 |
+
{/* Profile Info */}
|
| 122 |
+
<div className="text-center space-y-1">
|
| 123 |
+
<div className="flex items-center justify-center space-x-2">
|
| 124 |
+
<h2 className="text-lg font-extrabold text-white">{displayName}</h2>
|
| 125 |
+
<span className="px-2 py-0.5 rounded-full text-[10px] font-extrabold bg-gradient-to-r from-emerald-500 to-teal-400 text-black uppercase tracking-wider shadow-sm">
|
| 126 |
+
PRO
|
| 127 |
+
</span>
|
| 128 |
+
</div>
|
| 129 |
+
<p className="text-xs text-slate-400 font-mono">@{username}</p>
|
| 130 |
+
</div>
|
| 131 |
+
|
| 132 |
+
{/* Profile Action Buttons */}
|
| 133 |
+
<div className="grid grid-cols-3 gap-2 pt-1">
|
| 134 |
+
<button
|
| 135 |
+
onClick={() => setShowCreateModal(true)}
|
| 136 |
+
className="col-span-1 flex items-center justify-center space-x-1 py-1.5 px-2 rounded-lg bg-[#238636] hover:bg-[#2EA043] text-white text-xs font-bold transition shadow-sm"
|
| 137 |
+
>
|
| 138 |
+
<Plus className="w-3.5 h-3.5" />
|
| 139 |
+
<span>New</span>
|
| 140 |
+
</button>
|
| 141 |
+
<button
|
| 142 |
+
onClick={onOpenAuth}
|
| 143 |
+
className="col-span-1 py-1.5 px-2 rounded-lg bg-[#161B22] hover:bg-[#21262D] border border-[#30363D] text-slate-300 text-xs font-medium transition text-center truncate"
|
| 144 |
+
>
|
| 145 |
+
Profile
|
| 146 |
+
</button>
|
| 147 |
+
<button
|
| 148 |
+
onClick={onOpenAuth}
|
| 149 |
+
className="col-span-1 py-1.5 px-2 rounded-lg bg-[#161B22] hover:bg-[#21262D] border border-[#30363D] text-slate-300 text-xs font-medium transition text-center truncate"
|
| 150 |
+
>
|
| 151 |
+
Settings
|
| 152 |
+
</button>
|
| 153 |
+
</div>
|
| 154 |
+
|
| 155 |
+
<hr className="border-[#30363D]" />
|
| 156 |
+
|
| 157 |
+
{/* AI & ML interests */}
|
| 158 |
+
<div className="space-y-2">
|
| 159 |
+
<div className="text-xs font-semibold text-slate-300 flex items-center space-x-1.5">
|
| 160 |
+
<Sparkles className="w-3.5 h-3.5 text-emerald-400" />
|
| 161 |
+
<span>AI & Knowledge Domains</span>
|
| 162 |
+
</div>
|
| 163 |
+
<div className="flex flex-wrap gap-1.5">
|
| 164 |
+
<span className="text-[10px] px-2 py-0.5 rounded-full bg-[#161B22] border border-[#30363D] text-slate-300">
|
| 165 |
+
Deterministic RAG
|
| 166 |
+
</span>
|
| 167 |
+
<span className="text-[10px] px-2 py-0.5 rounded-full bg-[#161B22] border border-[#30363D] text-slate-300">
|
| 168 |
+
Semantic Git
|
| 169 |
+
</span>
|
| 170 |
+
<span className="text-[10px] px-2 py-0.5 rounded-full bg-[#161B22] border border-[#30363D] text-slate-300">
|
| 171 |
+
Clinical & Legal CI
|
| 172 |
+
</span>
|
| 173 |
+
</div>
|
| 174 |
+
</div>
|
| 175 |
+
|
| 176 |
+
<hr className="border-[#30363D]" />
|
| 177 |
+
|
| 178 |
+
{/* Recent Activity */}
|
| 179 |
+
<div className="space-y-2.5">
|
| 180 |
+
<div className="text-xs font-semibold text-slate-300 flex items-center space-x-1.5">
|
| 181 |
+
<Activity className="w-3.5 h-3.5 text-sky-400" />
|
| 182 |
+
<span>Recent Activity</span>
|
| 183 |
+
</div>
|
| 184 |
+
<div className="space-y-2 text-[11px] text-slate-400">
|
| 185 |
+
<div className="flex items-start space-x-2">
|
| 186 |
+
<span className="w-2 h-2 rounded-full bg-emerald-400 mt-1 shrink-0" />
|
| 187 |
+
<div>
|
| 188 |
+
<span className="text-slate-300 font-medium">Updated a Space</span>
|
| 189 |
+
<p className="text-[10px] text-slate-500 font-mono truncate">{username}/DiffWeave · 2m ago</p>
|
| 190 |
+
</div>
|
| 191 |
+
</div>
|
| 192 |
+
<div className="flex items-start space-x-2">
|
| 193 |
+
<span className="w-2 h-2 rounded-full bg-sky-400 mt-1 shrink-0" />
|
| 194 |
+
<div>
|
| 195 |
+
<span className="text-slate-300 font-medium">Published Space</span>
|
| 196 |
+
<p className="text-[10px] text-slate-500 font-mono truncate">{username}/DocWeave · 3h ago</p>
|
| 197 |
+
</div>
|
| 198 |
+
</div>
|
| 199 |
+
</div>
|
| 200 |
+
</div>
|
| 201 |
+
</div>
|
| 202 |
+
</div>
|
| 203 |
+
|
| 204 |
+
{/* ================================================================= */}
|
| 205 |
+
{/* RIGHT COLUMN: Spaces / Workspaces Grid (Matches HF media_2) */}
|
| 206 |
+
{/* ================================================================= */}
|
| 207 |
+
<div className="lg:col-span-9 space-y-6">
|
| 208 |
+
{/* Header Controls Bar */}
|
| 209 |
+
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4 pb-2 border-b border-[#30363D]">
|
| 210 |
+
{/* Spaces count */}
|
| 211 |
+
<div className="flex items-center space-x-3">
|
| 212 |
+
<div className="flex items-center space-x-2">
|
| 213 |
+
<span className="text-slate-500 font-mono text-sm tracking-widest">::</span>
|
| 214 |
+
<h1 className="text-lg font-extrabold text-white flex items-center space-x-2">
|
| 215 |
+
<span>Workspaces</span>
|
| 216 |
+
<span className="text-slate-400 text-sm font-mono font-medium">
|
| 217 |
+
{filteredWorkspaces.length}
|
| 218 |
+
</span>
|
| 219 |
+
</h1>
|
| 220 |
+
</div>
|
| 221 |
+
|
| 222 |
+
{/* Quick Search */}
|
| 223 |
+
<div className="relative">
|
| 224 |
+
<Search className="w-3.5 h-3.5 text-slate-400 absolute left-2.5 top-1/2 -translate-y-1/2" />
|
| 225 |
+
<input
|
| 226 |
+
type="text"
|
| 227 |
+
placeholder="Search workspaces..."
|
| 228 |
+
value={searchQuery}
|
| 229 |
+
onChange={(e) => setSearchQuery(e.target.value)}
|
| 230 |
+
className="pl-8 pr-3 py-1.5 rounded-lg bg-[#161B22] border border-[#30363D] text-xs text-white placeholder-slate-500 focus:outline-none focus:border-emerald-500 w-44 sm:w-60 transition"
|
| 231 |
+
/>
|
| 232 |
+
</div>
|
| 233 |
+
</div>
|
| 234 |
+
|
| 235 |
+
{/* Right: Sort & New Workspace Button */}
|
| 236 |
+
<div className="flex items-center space-x-3">
|
| 237 |
+
<div className="flex items-center space-x-1.5 text-xs text-slate-400 bg-[#161B22] border border-[#30363D] rounded-lg px-2.5 py-1.5">
|
| 238 |
+
<ArrowUpDown className="w-3.5 h-3.5 text-slate-400" />
|
| 239 |
+
<span className="text-slate-400 font-medium">Sort:</span>
|
| 240 |
+
<select
|
| 241 |
+
value={sortBy}
|
| 242 |
+
onChange={(e) => setSortBy(e.target.value)}
|
| 243 |
+
className="bg-transparent text-white text-xs font-semibold focus:outline-none cursor-pointer"
|
| 244 |
+
>
|
| 245 |
+
<option value="updated" className="bg-[#161B22] text-white">Recently updated</option>
|
| 246 |
+
<option value="docs" className="bg-[#161B22] text-white">Most documents</option>
|
| 247 |
+
<option value="facts" className="bg-[#161B22] text-white">Most verified facts</option>
|
| 248 |
+
<option value="name" className="bg-[#161B22] text-white">Alphabetical</option>
|
| 249 |
+
</select>
|
| 250 |
+
</div>
|
| 251 |
+
|
| 252 |
+
<button
|
| 253 |
+
onClick={() => setShowCreateModal(true)}
|
| 254 |
+
className="flex items-center space-x-1.5 px-3 py-1.5 rounded-lg bg-[#238636] hover:bg-[#2EA043] text-white font-bold text-xs transition shadow-sm whitespace-nowrap"
|
| 255 |
+
>
|
| 256 |
+
<Plus className="w-4 h-4" />
|
| 257 |
+
<span>New Workspace</span>
|
| 258 |
+
</button>
|
| 259 |
+
</div>
|
| 260 |
+
</div>
|
| 261 |
+
|
| 262 |
+
{/* Cards Grid */}
|
| 263 |
+
{filteredWorkspaces.length === 0 ? (
|
| 264 |
+
<div className="bg-[#161B22] border border-[#30363D] rounded-2xl p-12 text-center space-y-4">
|
| 265 |
+
<div className="w-12 h-12 rounded-full bg-slate-800 text-slate-400 flex items-center justify-center mx-auto">
|
| 266 |
+
<Layers className="w-6 h-6" />
|
| 267 |
+
</div>
|
| 268 |
+
<h3 className="text-base font-bold text-white">No workspaces found</h3>
|
| 269 |
+
<p className="text-xs text-slate-400 max-w-sm mx-auto">
|
| 270 |
+
{searchQuery ? `No results for "${searchQuery}". Try a different keyword.` : "You don't have any document workspaces yet."}
|
| 271 |
+
</p>
|
| 272 |
+
<button
|
| 273 |
+
onClick={() => setShowCreateModal(true)}
|
| 274 |
+
className="px-4 py-2 rounded-lg bg-[#238636] hover:bg-[#2EA043] text-white text-xs font-bold transition inline-flex items-center space-x-1.5"
|
| 275 |
+
>
|
| 276 |
+
<Plus className="w-4 h-4" />
|
| 277 |
+
<span>Create Workspace</span>
|
| 278 |
+
</button>
|
| 279 |
+
</div>
|
| 280 |
+
) : (
|
| 281 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 282 |
+
{filteredWorkspaces.map((ws, idx) => {
|
| 283 |
+
const grad = GRADIENTS[idx % GRADIENTS.length];
|
| 284 |
+
const emoji = EMOJIS[idx % EMOJIS.length];
|
| 285 |
+
const docsCount = ws.d_count ?? 0;
|
| 286 |
+
const factsCount = ws.k_count ?? 0;
|
| 287 |
+
const isSelected = currentWorkspace?.id === ws.id;
|
| 288 |
+
|
| 289 |
+
return (
|
| 290 |
+
<div
|
| 291 |
+
key={ws.id}
|
| 292 |
+
onClick={() => onSelectWorkspace(ws)}
|
| 293 |
+
className={`group relative rounded-2xl overflow-hidden border transition duration-200 cursor-pointer flex flex-col justify-between shadow-lg hover:shadow-2xl hover:-translate-y-0.5 ${
|
| 294 |
+
isSelected
|
| 295 |
+
? 'border-emerald-500/80 ring-2 ring-emerald-500/30 bg-[#161B22]'
|
| 296 |
+
: 'border-[#30363D] hover:border-slate-500 bg-[#161B22]'
|
| 297 |
+
}`}
|
| 298 |
+
>
|
| 299 |
+
{/* Top Gradient Banner (HF Style) */}
|
| 300 |
+
<div className={`bg-gradient-to-r ${grad} p-4 sm:p-5 flex flex-col justify-between min-h-[110px] relative`}>
|
| 301 |
+
{/* Top Bar: Status Badge */}
|
| 302 |
+
<div className="flex items-center justify-between">
|
| 303 |
+
<span className="inline-flex items-center space-x-1.5 px-2.5 py-0.5 rounded-full bg-black/40 backdrop-blur-md border border-white/20 text-[10px] font-bold text-emerald-300">
|
| 304 |
+
<span className="w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse" />
|
| 305 |
+
<span>Running</span>
|
| 306 |
+
</span>
|
| 307 |
+
|
| 308 |
+
<span className="text-white/60 text-xs group-hover:text-white transition">
|
| 309 |
+
→
|
| 310 |
+
</span>
|
| 311 |
+
</div>
|
| 312 |
+
|
| 313 |
+
{/* Workspace Title & Description */}
|
| 314 |
+
<div className="pt-2">
|
| 315 |
+
<div className="flex items-center space-x-2">
|
| 316 |
+
<h3 className="text-base sm:text-lg font-black text-white group-hover:underline drop-shadow-sm truncate">
|
| 317 |
+
{ws.name || 'Untitled Workspace'}
|
| 318 |
+
</h3>
|
| 319 |
+
<span className="text-sm">{emoji}</span>
|
| 320 |
+
</div>
|
| 321 |
+
<p className="text-xs text-white/80 line-clamp-1 mt-0.5">
|
| 322 |
+
{ws.description || (docsCount === 0 && factsCount === 0 ? 'Empty workspace · ready for CLI setup' : `${docsCount} documents · ${factsCount} facts`)}
|
| 323 |
+
</p>
|
| 324 |
+
</div>
|
| 325 |
+
</div>
|
| 326 |
+
|
| 327 |
+
{/* Bottom Metadata & Stats Bar */}
|
| 328 |
+
<div className="bg-[#0D1117] p-3.5 border-t border-[#30363D]/80 flex items-center justify-between text-xs text-slate-400">
|
| 329 |
+
{/* Left: Avatar + Username + Time */}
|
| 330 |
+
<div className="flex items-center space-x-2 truncate">
|
| 331 |
+
<div className="w-4 h-4 rounded-full bg-rose-500 flex items-center justify-center text-[9px] text-white font-bold shrink-0">
|
| 332 |
+
{username[0]?.toUpperCase() || 'A'}
|
| 333 |
+
</div>
|
| 334 |
+
<span className="font-medium text-slate-300 truncate">@{username}</span>
|
| 335 |
+
<span className="text-slate-600 font-mono">·</span>
|
| 336 |
+
<span className="text-[11px] text-slate-500 truncate">
|
| 337 |
+
{idx === 0 ? '2 minutes ago' : idx === 1 ? '1 day ago' : idx === 2 ? '7 days ago' : 'Aug 25'}
|
| 338 |
+
</span>
|
| 339 |
+
</div>
|
| 340 |
+
|
| 341 |
+
{/* Right: Brief Stats (Docs & Facts) */}
|
| 342 |
+
<div className="flex items-center space-x-2 shrink-0 font-mono text-[11px]">
|
| 343 |
+
<span className="px-2 py-0.5 rounded bg-[#161B22] border border-[#30363D] text-sky-300 flex items-center space-x-1">
|
| 344 |
+
<Files className="w-3 h-3 text-sky-400" />
|
| 345 |
+
<span>{docsCount}</span>
|
| 346 |
+
</span>
|
| 347 |
+
<span className="px-2 py-0.5 rounded bg-[#161B22] border border-[#30363D] text-emerald-300 flex items-center space-x-1">
|
| 348 |
+
<Database className="w-3 h-3 text-emerald-400" />
|
| 349 |
+
<span>{factsCount}</span>
|
| 350 |
+
</span>
|
| 351 |
+
</div>
|
| 352 |
+
</div>
|
| 353 |
+
</div>
|
| 354 |
+
);
|
| 355 |
+
})}
|
| 356 |
+
</div>
|
| 357 |
+
)}
|
| 358 |
+
</div>
|
| 359 |
+
</div>
|
| 360 |
+
|
| 361 |
+
{/* ===================================================================== */}
|
| 362 |
+
{/* GITHUB-STYLE "CREATE A NEW REPOSITORY / WORKSPACE" MODAL (media_1) */}
|
| 363 |
+
{/* ===================================================================== */}
|
| 364 |
+
{showCreateModal && (
|
| 365 |
+
<div className="fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4 overflow-y-auto">
|
| 366 |
+
<div className="bg-[#0D1117] border border-[#30363D] rounded-2xl max-w-2xl w-full p-6 sm:p-8 space-y-6 shadow-2xl text-slate-200">
|
| 367 |
+
{/* Modal Header */}
|
| 368 |
+
<div className="flex items-start justify-between pb-3 border-b border-[#30363D]">
|
| 369 |
+
<div>
|
| 370 |
+
<h2 className="text-xl font-bold text-white tracking-tight">Create a new workspace</h2>
|
| 371 |
+
<p className="text-xs text-slate-400 mt-1">
|
| 372 |
+
Workspaces contain your documents, version history, knowledge graph, and deterministic CI rules.{' '}
|
| 373 |
+
<span className="text-emerald-400 hover:underline cursor-pointer">Learn more</span>
|
| 374 |
+
</p>
|
| 375 |
+
</div>
|
| 376 |
+
<button
|
| 377 |
+
onClick={() => setShowCreateModal(false)}
|
| 378 |
+
className="text-slate-400 hover:text-white p-1 rounded-lg hover:bg-[#21262D] transition"
|
| 379 |
+
>
|
| 380 |
+
<X className="w-5 h-5" />
|
| 381 |
+
</button>
|
| 382 |
+
</div>
|
| 383 |
+
|
| 384 |
+
<form onSubmit={handleCreateSubmit} className="space-y-6 text-xs">
|
| 385 |
+
{/* STEP 1: General */}
|
| 386 |
+
<div className="space-y-4">
|
| 387 |
+
<div className="flex items-center space-x-2 text-white font-bold text-sm">
|
| 388 |
+
<span className="w-5 h-5 rounded-full bg-[#21262D] text-slate-300 font-mono text-xs flex items-center justify-center">1</span>
|
| 389 |
+
<span>General</span>
|
| 390 |
+
</div>
|
| 391 |
+
|
| 392 |
+
<div className="grid grid-cols-1 sm:grid-cols-12 gap-3 items-end">
|
| 393 |
+
{/* Owner Dropdown */}
|
| 394 |
+
<div className="sm:col-span-5 space-y-1">
|
| 395 |
+
<label className="text-xs font-semibold text-slate-300">
|
| 396 |
+
Owner <span className="text-rose-400">*</span>
|
| 397 |
+
</label>
|
| 398 |
+
<div className="flex items-center justify-between px-3 py-2 rounded-lg bg-[#161B22] border border-[#30363D] text-white">
|
| 399 |
+
<div className="flex items-center space-x-2">
|
| 400 |
+
<div className="w-4 h-4 rounded-full bg-pink-500 flex items-center justify-center text-[9px] text-white font-bold">
|
| 401 |
+
{username[0]?.toUpperCase() || 'A'}
|
| 402 |
+
</div>
|
| 403 |
+
<span className="font-semibold text-xs">{username}</span>
|
| 404 |
+
</div>
|
| 405 |
+
<ChevronDown className="w-3.5 h-3.5 text-slate-400" />
|
| 406 |
+
</div>
|
| 407 |
+
</div>
|
| 408 |
+
|
| 409 |
+
<div className="hidden sm:flex sm:col-span-1 justify-center items-center pb-2 text-slate-500 font-bold text-lg">
|
| 410 |
+
/
|
| 411 |
+
</div>
|
| 412 |
+
|
| 413 |
+
{/* Workspace Name Input */}
|
| 414 |
+
<div className="sm:col-span-6 space-y-1">
|
| 415 |
+
<label className="text-xs font-semibold text-slate-300">
|
| 416 |
+
Workspace name <span className="text-rose-400">*</span>
|
| 417 |
+
</label>
|
| 418 |
+
<input
|
| 419 |
+
type="text"
|
| 420 |
+
required
|
| 421 |
+
value={wsName}
|
| 422 |
+
onChange={(e) => setWsName(e.target.value)}
|
| 423 |
+
placeholder={suggestedName}
|
| 424 |
+
className="w-full px-3 py-2 rounded-lg bg-[#161B22] border border-[#30363D] text-xs text-white placeholder-slate-500 focus:outline-none focus:border-emerald-500 font-mono"
|
| 425 |
+
/>
|
| 426 |
+
</div>
|
| 427 |
+
</div>
|
| 428 |
+
|
| 429 |
+
<p className="text-[11px] text-slate-400">
|
| 430 |
+
Great workspace names are short and memorable. How about{' '}
|
| 431 |
+
<span
|
| 432 |
+
onClick={() => setWsName(suggestedName)}
|
| 433 |
+
className="text-emerald-400 font-semibold hover:underline cursor-pointer"
|
| 434 |
+
>
|
| 435 |
+
{suggestedName}
|
| 436 |
+
</span>
|
| 437 |
+
?
|
| 438 |
+
</p>
|
| 439 |
+
|
| 440 |
+
{/* Description */}
|
| 441 |
+
<div className="space-y-1">
|
| 442 |
+
<div className="flex items-center justify-between text-xs">
|
| 443 |
+
<label className="font-semibold text-slate-300">Description (optional)</label>
|
| 444 |
+
<span className="text-[10px] text-slate-500">{wsDesc.length} / 350 characters</span>
|
| 445 |
+
</div>
|
| 446 |
+
<input
|
| 447 |
+
type="text"
|
| 448 |
+
maxLength={350}
|
| 449 |
+
value={wsDesc}
|
| 450 |
+
onChange={(e) => setWsDesc(e.target.value)}
|
| 451 |
+
placeholder="Brief description of the documents and domain in this workspace..."
|
| 452 |
+
className="w-full px-3 py-2 rounded-lg bg-[#161B22] border border-[#30363D] text-xs text-white placeholder-slate-500 focus:outline-none focus:border-emerald-500"
|
| 453 |
+
/>
|
| 454 |
+
</div>
|
| 455 |
+
</div>
|
| 456 |
+
|
| 457 |
+
{/* STEP 2: Configuration */}
|
| 458 |
+
<div className="space-y-4 pt-2 border-t border-[#30363D]">
|
| 459 |
+
<div className="flex items-center space-x-2 text-white font-bold text-sm">
|
| 460 |
+
<span className="w-5 h-5 rounded-full bg-[#21262D] text-slate-300 font-mono text-xs flex items-center justify-center">2</span>
|
| 461 |
+
<span>Configuration</span>
|
| 462 |
+
</div>
|
| 463 |
+
|
| 464 |
+
{/* Choose Visibility */}
|
| 465 |
+
<div className="space-y-2">
|
| 466 |
+
<label className="text-xs font-semibold text-slate-300">Choose visibility *</label>
|
| 467 |
+
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
| 468 |
+
<label
|
| 469 |
+
onClick={() => setWsVisibility('public')}
|
| 470 |
+
className={`p-3 rounded-xl border flex items-start space-x-3 cursor-pointer transition ${
|
| 471 |
+
wsVisibility === 'public'
|
| 472 |
+
? 'border-emerald-500 bg-emerald-500/10'
|
| 473 |
+
: 'border-[#30363D] bg-[#161B22] hover:border-slate-500'
|
| 474 |
+
}`}
|
| 475 |
+
>
|
| 476 |
+
<Globe className="w-4 h-4 text-emerald-400 mt-0.5 shrink-0" />
|
| 477 |
+
<div>
|
| 478 |
+
<span className="font-bold text-white block">Public</span>
|
| 479 |
+
<span className="text-[11px] text-slate-400">Anyone on DiffWeave can query verified truth from this workspace.</span>
|
| 480 |
+
</div>
|
| 481 |
+
</label>
|
| 482 |
+
|
| 483 |
+
<label
|
| 484 |
+
onClick={() => setWsVisibility('private')}
|
| 485 |
+
className={`p-3 rounded-xl border flex items-start space-x-3 cursor-pointer transition ${
|
| 486 |
+
wsVisibility === 'private'
|
| 487 |
+
? 'border-emerald-500 bg-emerald-500/10'
|
| 488 |
+
: 'border-[#30363D] bg-[#161B22] hover:border-slate-500'
|
| 489 |
+
}`}
|
| 490 |
+
>
|
| 491 |
+
<Lock className="w-4 h-4 text-amber-400 mt-0.5 shrink-0" />
|
| 492 |
+
<div>
|
| 493 |
+
<span className="font-bold text-white block">Private</span>
|
| 494 |
+
<span className="text-[11px] text-slate-400">You choose who can see and commit to this workspace.</span>
|
| 495 |
+
</div>
|
| 496 |
+
</label>
|
| 497 |
+
</div>
|
| 498 |
+
</div>
|
| 499 |
+
|
| 500 |
+
{/* Starter Template */}
|
| 501 |
+
<div className="space-y-1 pt-1">
|
| 502 |
+
<label className="text-xs font-semibold text-slate-300">Domain Starter Template</label>
|
| 503 |
+
<select
|
| 504 |
+
value={starterTemplate}
|
| 505 |
+
onChange={(e) => setStarterTemplate(e.target.value)}
|
| 506 |
+
className="w-full px-3 py-2 rounded-lg bg-[#161B22] border border-[#30363D] text-xs text-white focus:outline-none focus:border-emerald-500 cursor-pointer"
|
| 507 |
+
>
|
| 508 |
+
<option value="empty">Empty Workspace (CLI quickstart instructions)</option>
|
| 509 |
+
<option value="clinical">Clinical & Medical Guidelines Template</option>
|
| 510 |
+
<option value="legal">Legal & Compliance Contracts Template</option>
|
| 511 |
+
<option value="engineering">Engineering Architecture Specs Template</option>
|
| 512 |
+
</select>
|
| 513 |
+
</div>
|
| 514 |
+
</div>
|
| 515 |
+
|
| 516 |
+
{/* Bottom Buttons */}
|
| 517 |
+
<div className="flex items-center justify-end space-x-3 pt-4 border-t border-[#30363D]">
|
| 518 |
+
<button
|
| 519 |
+
type="button"
|
| 520 |
+
onClick={() => setShowCreateModal(false)}
|
| 521 |
+
className="px-4 py-2 rounded-lg bg-[#21262D] hover:bg-[#30363D] text-slate-300 font-semibold transition"
|
| 522 |
+
>
|
| 523 |
+
Cancel
|
| 524 |
+
</button>
|
| 525 |
+
<button
|
| 526 |
+
type="submit"
|
| 527 |
+
className="px-5 py-2 rounded-lg bg-[#238636] hover:bg-[#2EA043] text-white font-bold transition shadow-md flex items-center space-x-1.5"
|
| 528 |
+
>
|
| 529 |
+
<Plus className="w-4 h-4" />
|
| 530 |
+
<span>Create workspace</span>
|
| 531 |
+
</button>
|
| 532 |
+
</div>
|
| 533 |
+
</form>
|
| 534 |
+
</div>
|
| 535 |
+
</div>
|
| 536 |
+
)}
|
| 537 |
+
</div>
|
| 538 |
+
);
|
| 539 |
+
}
|