Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Add command palette and persistent logs drawer

Juan Denis196f019bcac3
diff --git a/frontend/src/components/CommandPalette.jsx b/frontend/src/components/CommandPalette.jsx
new file mode 100644
index 00000000..2d1f3916
--- /dev/null
+++ b/frontend/src/components/CommandPalette.jsx
@@ -0,0 +1,222 @@
+import React, { useState, useEffect, useRef, useCallback, useMemo } from 'react';
+import { useNavigate } from 'react-router-dom';
+import api from '../services/api';
+
+const STATIC_PAGES = [
+ { label: 'Services', path: '/services', category: 'Pages', keywords: 'apps containers' },
+ { label: 'Docker', path: '/docker', category: 'Pages', keywords: 'containers images' },
+ { label: 'Databases', path: '/databases', category: 'Pages', keywords: 'mysql postgres sql' },
+ { label: 'Domains', path: '/domains', category: 'Pages', keywords: 'dns nginx' },
+ { label: 'SSL Certificates', path: '/ssl', category: 'Pages', keywords: 'https tls' },
+ { label: 'Templates', path: '/templates', category: 'Pages', keywords: 'deploy one-click' },
+ { label: 'Workflow Builder', path: '/workflow', category: 'Pages', keywords: 'automation pipeline' },
+ { label: 'WordPress', path: '/wordpress', category: 'Pages', keywords: 'wp sites' },
+ { label: 'WordPress Projects', path: '/wordpress/projects', category: 'Pages', keywords: 'wp environments' },
+ { label: 'Git', path: '/git', category: 'Pages', keywords: 'repos deploy' },
+ { label: 'Files', path: '/files', category: 'Pages', keywords: 'file manager explorer' },
+ { label: 'FTP Server', path: '/ftp', category: 'Pages', keywords: 'sftp upload' },
+ { label: 'Monitoring', path: '/monitoring', category: 'Pages', keywords: 'metrics uptime' },
+ { label: 'Backups', path: '/backups', category: 'Pages', keywords: 'snapshots restore' },
+ { label: 'Cron Jobs', path: '/cron', category: 'Pages', keywords: 'schedule tasks' },
+ { label: 'Security', path: '/security', category: 'Pages', keywords: 'firewall fail2ban' },
+ { label: 'Email', path: '/email', category: 'Pages', keywords: 'smtp postfix' },
+ { label: 'Terminal', path: '/terminal', category: 'Pages', keywords: 'shell ssh console' },
+ { label: 'Servers', path: '/servers', category: 'Pages', keywords: 'fleet agents' },
+ { label: 'Fleet Monitor', path: '/fleet-monitor', category: 'Pages', keywords: 'agents status' },
+ { label: 'DNS Zones', path: '/dns', category: 'Pages', keywords: 'records nameserver' },
+ { label: 'Status Pages', path: '/status-pages', category: 'Pages', keywords: 'uptime incidents' },
+ { label: 'Cloud Provision', path: '/cloud', category: 'Pages', keywords: 'vps deploy' },
+ { label: 'Marketplace', path: '/marketplace', category: 'Pages', keywords: 'extensions plugins' },
+ { label: 'Downloads', path: '/downloads', category: 'Pages', keywords: 'agent installer' },
+ { label: 'Settings', path: '/settings', category: 'Settings', keywords: 'profile preferences' },
+ { label: 'Settings: Users', path: '/settings/users', category: 'Settings', keywords: 'accounts team' },
+ { label: 'Settings: API Keys', path: '/settings/api', category: 'Settings', keywords: 'tokens access' },
+ { label: 'Settings: SSO', path: '/settings/sso', category: 'Settings', keywords: 'oauth saml login' },
+ { label: 'Settings: Appearance', path: '/settings/appearance', category: 'Settings', keywords: 'theme dark light' },
+ { label: 'Settings: Notifications', path: '/settings/notifications', category: 'Settings', keywords: 'alerts email slack' },
+ { label: 'Settings: System', path: '/settings/system', category: 'Settings', keywords: 'server config' },
+];
+
+function fuzzyMatch(text, query) {
+ const lower = text.toLowerCase();
+ const q = query.toLowerCase();
+ const idx = lower.indexOf(q);
+ if (idx === -1) return -1;
+ return idx === 0 ? 2 : 1;
+}
+
+function scoreItem(item, query) {
+ const labelScore = fuzzyMatch(item.label, query);
+ if (labelScore > 0) return labelScore + 1;
+ const kwScore = fuzzyMatch(item.keywords || '', query);
+ if (kwScore > 0) return kwScore;
+ const pathScore = fuzzyMatch(item.path, query);
+ if (pathScore > 0) return pathScore;
+ return -1;
+}
+
+const CommandPalette = ({ open, onClose }) => {
+ const [query, setQuery] = useState('');
+ const [dynamicItems, setDynamicItems] = useState([]);
+ const [selectedIndex, setSelectedIndex] = useState(0);
+ const inputRef = useRef(null);
+ const listRef = useRef(null);
+ const navigate = useNavigate();
+
+ // Fetch dynamic items (services/containers + servers) when opened
+ useEffect(() => {
+ if (!open) return;
+ setQuery('');
+ setSelectedIndex(0);
+
+ let cancelled = false;
+ async function fetchDynamic() {
+ const items = [];
+ try {
+ const containers = await api.getContainers();
+ if (!cancelled && Array.isArray(containers)) {
+ containers.forEach(c => {
+ items.push({
+ label: c.name || c.Names?.[0]?.replace(/^\//, ''),
+ path: `/docker`,
+ category: 'Containers',
+ keywords: `${c.Image || ''} ${c.State || ''}`,
+ });
+ });
+ }
+ } catch {}
+ try {
+ const serverData = await api.getServers();
+ const servers = serverData?.servers || serverData || [];
+ if (!cancelled && Array.isArray(servers)) {
+ servers.forEach(s => {
+ items.push({
+ label: s.name || s.hostname,
+ path: `/servers/${s.id}`,
+ category: 'Servers',
+ keywords: `${s.hostname || ''} ${s.ip_address || ''}`,
+ });
+ });
+ }
+ } catch {}
+ if (!cancelled) setDynamicItems(items);
+ }
+ fetchDynamic();
+ return () => { cancelled = true; };
+ }, [open]);
+
+ // Focus input when opened
+ useEffect(() => {
+ if (open && inputRef.current) {
+ requestAnimationFrame(() => inputRef.current?.focus());
+ }
+ }, [open]);
+
+ const allItems = useMemo(() => [...STATIC_PAGES, ...dynamicItems], [dynamicItems]);
+
+ const results = useMemo(() => {
+ if (!query.trim()) return allItems.slice(0, 20);
+ return allItems
+ .map(item => ({ ...item, score: scoreItem(item, query.trim()) }))
+ .filter(item => item.score > 0)
+ .sort((a, b) => b.score - a.score)
+ .slice(0, 20);
+ }, [query, allItems]);
+
+ // Reset selected index when results change
+ useEffect(() => {
+ setSelectedIndex(0);
+ }, [results]);
+
+ const handleSelect = useCallback((item) => {
+ navigate(item.path);
+ onClose();
+ }, [navigate, onClose]);
+
+ const handleKeyDown = useCallback((e) => {
+ if (e.key === 'ArrowDown') {
+ e.preventDefault();
+ setSelectedIndex(prev => Math.min(prev + 1, results.length - 1));
+ } else if (e.key === 'ArrowUp') {
+ e.preventDefault();
+ setSelectedIndex(prev => Math.max(prev - 1, 0));
+ } else if (e.key === 'Enter' && results[selectedIndex]) {
+ e.preventDefault();
+ handleSelect(results[selectedIndex]);
+ } else if (e.key === 'Escape') {
+ e.preventDefault();
+ onClose();
+ }
+ }, [results, selectedIndex, handleSelect, onClose]);
+
+ // Scroll selected item into view
+ useEffect(() => {
+ if (!listRef.current) return;
+ const selected = listRef.current.children[selectedIndex];
+ if (selected) selected.scrollIntoView({ block: 'nearest' });
+ }, [selectedIndex]);
+
+ if (!open) return null;
+
+ // Group results by category
+ const grouped = {};
+ results.forEach(item => {
+ if (!grouped[item.category]) grouped[item.category] = [];
+ grouped[item.category].push(item);
+ });
+
+ let flatIndex = -1;
+
+ return (
+ <div className="command-palette-overlay" onClick={onClose}>
+ <div className="command-palette" onClick={e => e.stopPropagation()} role="dialog" aria-modal="true" aria-label="Command palette">
+ <div className="command-palette__input-wrapper">
+ <svg viewBox="0 0 24 24" width="18" height="18" stroke="currentColor" fill="none" strokeWidth="2">
+ <circle cx="11" cy="11" r="8"/>
+ <line x1="21" y1="21" x2="16.65" y2="16.65"/>
+ </svg>
+ <input
+ ref={inputRef}
+ type="text"
+ value={query}
+ onChange={e => setQuery(e.target.value)}
+ onKeyDown={handleKeyDown}
+ placeholder="Search pages, services, servers..."
+ className="command-palette__input"
+ autoComplete="off"
+ spellCheck="false"
+ />
+ <kbd className="command-palette__kbd">ESC</kbd>
+ </div>
+ <div className="command-palette__results" ref={listRef}>
+ {results.length === 0 ? (
+ <div className="command-palette__empty">No results found</div>
+ ) : (
+ Object.entries(grouped).map(([category, items]) => (
+ <div key={category} className="command-palette__group">
+ <div className="command-palette__group-label">{category}</div>
+ {items.map(item => {
+ flatIndex++;
+ const idx = flatIndex;
+ return (
+ <button
+ key={`${item.category}-${item.path}-${item.label}`}
+ className={`command-palette__item ${idx === selectedIndex ? 'command-palette__item--active' : ''}`}
+ onClick={() => handleSelect(item)}
+ onMouseEnter={() => setSelectedIndex(idx)}
+ >
+ <span className="command-palette__item-label">{item.label}</span>
+ <span className="command-palette__item-path">{item.path}</span>
+ </button>
+ );
+ })}
+ </div>
+ ))
+ )}
+ </div>
+ </div>
+ </div>
+ );
+};
+
+export default CommandPalette;
diff --git a/frontend/src/components/EnvironmentVariables.jsx b/frontend/src/components/EnvironmentVariables.jsx
index b90cd566..86a2c4d9 100644
--- a/frontend/src/components/EnvironmentVariables.jsx
+++ b/frontend/src/components/EnvironmentVariables.jsx
@@ -17,6 +17,7 @@ const EnvironmentVariables = ({ appId }) => {
// UI state
const [showValues, setShowValues] = useState({});
+ const [allVisible, setAllVisible] = useState(false);
const [editingId, setEditingId] = useState(null);
const [editValue, setEditValue] = useState('');
const [showImportModal, setShowImportModal] = useState(false);
@@ -107,7 +108,24 @@ const EnvironmentVariables = ({ appId }) => {
}
function toggleShowValue(id) {
- setShowValues(prev => ({ ...prev, [id]: !prev[id] }));
+ setShowValues(prev => {
+ const next = { ...prev, [id]: !prev[id] };
+ const allShown = envVars.every(ev => next[ev.id]);
+ setAllVisible(allShown);
+ return next;
+ });
+ }
+
+ function toggleShowAll() {
+ if (allVisible) {
+ setShowValues({});
+ setAllVisible(false);
+ } else {
+ const all = {};
+ envVars.forEach(ev => { all[ev.id] = true; });
+ setShowValues(all);
+ setAllVisible(true);
+ }
}
function startEditing(envVar) {
@@ -215,6 +233,22 @@ const EnvironmentVariables = ({ appId }) => {
<div className="section-header">
<h3>Environment Variables</h3>
<div className="header-actions">
+ {envVars.length > 0 && (
+ <button className="btn btn-secondary btn-sm" onClick={toggleShowAll} title={allVisible ? 'Hide all values' : 'Show all values'}>
+ {allVisible ? (
+ <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
+ <path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/>
+ <line x1="1" y1="1" x2="23" y2="23"/>
+ </svg>
+ ) : (
+ <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
+ <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
+ <circle cx="12" cy="12" r="3"/>
+ </svg>
+ )}
+ {allVisible ? 'Hide All' : 'Show All'}
+ </button>
+ )}
<button className="btn btn-secondary btn-sm" onClick={() => setShowImportModal(true)}>
<svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12"/>
diff --git a/frontend/src/components/LogsDrawer.jsx b/frontend/src/components/LogsDrawer.jsx
new file mode 100644
index 00000000..f07faec5
--- /dev/null
+++ b/frontend/src/components/LogsDrawer.jsx
@@ -0,0 +1,175 @@
+import React, { useState, useEffect, useRef, useCallback } from 'react';
+import { useLogsDrawer } from '../contexts/LogsDrawerContext';
+import socketService from '../services/socket';
+import api from '../services/api';
+
+const MAX_LINES = 1000;
+const MIN_HEIGHT = 120;
+const DEFAULT_HEIGHT = 300;
+
+const LogsDrawer = () => {
+ const { drawerState, service, closeDrawer, collapseDrawer, expandDrawer } = useLogsDrawer();
+ const [lines, setLines] = useState([]);
+ const [autoScroll, setAutoScroll] = useState(true);
+ const [height, setHeight] = useState(DEFAULT_HEIGHT);
+ const logRef = useRef(null);
+ const dragging = useRef(false);
+ const startY = useRef(0);
+ const startHeight = useRef(0);
+
+ // Load initial logs and subscribe to real-time updates
+ useEffect(() => {
+ if (!service || drawerState === 'closed') return;
+
+ setLines([]);
+ let cancelled = false;
+
+ // Load initial log batch
+ async function loadInitial() {
+ try {
+ let data;
+ if (service.appType === 'docker' && service.containerId) {
+ data = await api.getDockerAppLogs(service.containerId, 200);
+ } else if (service.logPath) {
+ data = await api.getLogs(service.logPath, 200);
+ }
+ if (!cancelled && data?.logs) {
+ const initial = data.logs.split('\n').filter(Boolean);
+ setLines(initial.slice(-MAX_LINES));
+ }
+ } catch {}
+ }
+ loadInitial();
+
+ // Subscribe to real-time log_line events
+ socketService.connect();
+ if (service.logPath) {
+ socketService.subscribeLogs(service.logPath);
+ }
+
+ const unsubscribe = socketService.on('log_line', (data) => {
+ if (cancelled) return;
+ const line = typeof data === 'string' ? data : data?.line || data?.message || JSON.stringify(data);
+ setLines(prev => {
+ const next = [...prev, line];
+ return next.length > MAX_LINES ? next.slice(-MAX_LINES) : next;
+ });
+ });
+
+ return () => {
+ cancelled = true;
+ socketService.unsubscribeLogs();
+ unsubscribe();
+ };
+ }, [service, drawerState]);
+
+ // Auto-scroll
+ useEffect(() => {
+ if (autoScroll && logRef.current && drawerState === 'expanded') {
+ logRef.current.scrollTop = logRef.current.scrollHeight;
+ }
+ }, [lines, autoScroll, drawerState]);
+
+ // Resize drag handlers
+ const handleDragStart = useCallback((e) => {
+ e.preventDefault();
+ dragging.current = true;
+ startY.current = e.clientY;
+ startHeight.current = height;
+ document.addEventListener('mousemove', handleDragMove);
+ document.addEventListener('mouseup', handleDragEnd);
+ }, [height]);
+
+ const handleDragMove = useCallback((e) => {
+ if (!dragging.current) return;
+ const diff = startY.current - e.clientY;
+ const newHeight = Math.max(MIN_HEIGHT, Math.min(window.innerHeight * 0.7, startHeight.current + diff));
+ setHeight(newHeight);
+ }, []);
+
+ const handleDragEnd = useCallback(() => {
+ dragging.current = false;
+ document.removeEventListener('mousemove', handleDragMove);
+ document.removeEventListener('mouseup', handleDragEnd);
+ }, [handleDragMove]);
+
+ function getLineClass(line) {
+ const lower = line.toLowerCase();
+ if (lower.includes('error') || lower.includes('critical') || lower.includes('fatal')) return 'logs-drawer__line--error';
+ if (lower.includes('warn')) return 'logs-drawer__line--warn';
+ return '';
+ }
+
+ if (drawerState === 'closed' || !service) return null;
+
+ const lastLine = lines.length > 0 ? lines[lines.length - 1] : 'Waiting for logs...';
+
+ if (drawerState === 'collapsed') {
+ return (
+ <div className="logs-drawer logs-drawer--collapsed" onClick={expandDrawer}>
+ <div className="logs-drawer__collapsed-bar">
+ <span className="logs-drawer__service-name">{service.name}</span>
+ <span className="logs-drawer__last-line">{lastLine}</span>
+ <div className="logs-drawer__collapsed-actions">
+ <button className="btn-icon" onClick={(e) => { e.stopPropagation(); closeDrawer(); }} title="Close">
+ <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
+ <line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
+ </svg>
+ </button>
+ </div>
+ </div>
+ </div>
+ );
+ }
+
+ return (
+ <div className="logs-drawer logs-drawer--expanded" style={{ height }}>
+ {/* Resize handle */}
+ <div className="logs-drawer__resize-handle" onMouseDown={handleDragStart} />
+
+ {/* Header */}
+ <div className="logs-drawer__header">
+ <div className="logs-drawer__header-left">
+ <span className="logs-drawer__live-dot" />
+ <span className="logs-drawer__service-name">{service.name}</span>
+ <span className="logs-drawer__line-count">{lines.length} lines</span>
+ </div>
+ <div className="logs-drawer__header-right">
+ <label className="logs-drawer__toggle">
+ <input type="checkbox" checked={autoScroll} onChange={(e) => setAutoScroll(e.target.checked)} />
+ <span>Auto-scroll</span>
+ </label>
+ <button className="btn-icon" onClick={() => setLines([])} title="Clear">
+ <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
+ <polyline points="3 6 5 6 21 6"/>
+ <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
+ </svg>
+ </button>
+ <button className="btn-icon" onClick={collapseDrawer} title="Collapse">
+ <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
+ <polyline points="6 9 12 15 18 9"/>
+ </svg>
+ </button>
+ <button className="btn-icon" onClick={closeDrawer} title="Close">
+ <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
+ <line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
+ </svg>
+ </button>
+ </div>
+ </div>
+
+ {/* Log content */}
+ <div className="logs-drawer__content" ref={logRef}>
+ {lines.length === 0 ? (
+ <div className="logs-drawer__empty">Waiting for logs...</div>
+ ) : (
+ lines.map((line, i) => (
+ <div key={i} className={`logs-drawer__line ${getLineClass(line)}`}>{line}</div>
+ ))
+ )}
+ </div>
+ </div>
+ );
+};
+
+export default LogsDrawer;
diff --git a/frontend/src/components/service-detail/LogsTab.jsx b/frontend/src/components/service-detail/LogsTab.jsx
index f7c75655..cc16b007 100644
--- a/frontend/src/components/service-detail/LogsTab.jsx
+++ b/frontend/src/components/service-detail/LogsTab.jsx
@@ -1,9 +1,11 @@
import React, { useState, useEffect, useRef, useMemo } from 'react';
import api from '../../services/api';
+import { useLogsDrawer } from '../../contexts/LogsDrawerContext';
const LOG_LEVELS = ['all', 'error', 'warn', 'info', 'debug'];
const LogsTab = ({ app }) => {
+ const { openDrawer } = useLogsDrawer();
const [rawLogs, setRawLogs] = useState('');
const [loading, setLoading] = useState(true);
const [autoRefresh, setAutoRefresh] = useState(false);
@@ -171,6 +173,22 @@ const LogsTab = ({ app }) => {
<path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>
</svg>
</button>
+ <div className="logs-toolbar__divider" />
+ <button
+ className="btn btn-ghost btn-sm"
+ onClick={() => openDrawer({
+ name: app.name,
+ containerId: app.id,
+ logPath: app.log_path,
+ appType: app.app_type,
+ })}
+ title="Pin to drawer"
+ >
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
+ <line x1="12" y1="17" x2="12" y2="22"/>
+ <path d="M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"/>
+ </svg>
+ </button>
</div>
</div>
diff --git a/frontend/src/contexts/LogsDrawerContext.jsx b/frontend/src/contexts/LogsDrawerContext.jsx
new file mode 100644
index 00000000..848df4ed
--- /dev/null
+++ b/frontend/src/contexts/LogsDrawerContext.jsx
@@ -0,0 +1,46 @@
+import React, { createContext, useContext, useState, useCallback } from 'react';
+
+const LogsDrawerContext = createContext(null);
+
+export function LogsDrawerProvider({ children }) {
+ const [drawerState, setDrawerState] = useState('closed'); // 'closed' | 'collapsed' | 'expanded'
+ const [service, setService] = useState(null); // { name, containerId, logPath, appType }
+
+ const openDrawer = useCallback((serviceInfo) => {
+ setService(serviceInfo);
+ setDrawerState('expanded');
+ }, []);
+
+ const closeDrawer = useCallback(() => {
+ setDrawerState('closed');
+ setService(null);
+ }, []);
+
+ const toggleDrawer = useCallback(() => {
+ setDrawerState(prev => {
+ if (prev === 'closed') return 'expanded';
+ if (prev === 'expanded') return 'collapsed';
+ return 'expanded';
+ });
+ }, []);
+
+ const collapseDrawer = useCallback(() => {
+ setDrawerState('collapsed');
+ }, []);
+
+ const expandDrawer = useCallback(() => {
+ setDrawerState('expanded');
+ }, []);
+
+ return (
+ <LogsDrawerContext.Provider value={{ drawerState, service, openDrawer, closeDrawer, toggleDrawer, collapseDrawer, expandDrawer }}>
+ {children}
+ </LogsDrawerContext.Provider>
+ );
+}
+
+export function useLogsDrawer() {
+ const ctx = useContext(LogsDrawerContext);
+ if (!ctx) throw new Error('useLogsDrawer must be used within LogsDrawerProvider');
+ return ctx;
+}
diff --git a/frontend/src/layouts/DashboardLayout.jsx b/frontend/src/layouts/DashboardLayout.jsx
index dc36b4f0..ab00f66a 100644
--- a/frontend/src/layouts/DashboardLayout.jsx
+++ b/frontend/src/layouts/DashboardLayout.jsx
@@ -1,15 +1,36 @@
-import React from 'react';
+import React, { useState, useEffect, useCallback } from 'react';
import { Outlet } from 'react-router-dom';
import Sidebar from '../components/Sidebar';
+import CommandPalette from '../components/CommandPalette';
+import LogsDrawer from '../components/LogsDrawer';
+import { LogsDrawerProvider } from '../contexts/LogsDrawerContext';
const DashboardLayout = () => {
+ const [paletteOpen, setPaletteOpen] = useState(false);
+
+ const handleKeyDown = useCallback((e) => {
+ if ((e.metaKey || e.ctrlKey) && e.key === 'k') {
+ e.preventDefault();
+ setPaletteOpen(prev => !prev);
+ }
+ }, []);
+
+ useEffect(() => {
+ document.addEventListener('keydown', handleKeyDown);
+ return () => document.removeEventListener('keydown', handleKeyDown);
+ }, [handleKeyDown]);
+
return (
- <div className="dashboard-layout">
- <Sidebar />
- <main className="main-content">
- <Outlet />
- </main>
- </div>
+ <LogsDrawerProvider>
+ <div className="dashboard-layout">
+ <Sidebar />
+ <main className="main-content">
+ <Outlet />
+ </main>
+ <CommandPalette open={paletteOpen} onClose={() => setPaletteOpen(false)} />
+ <LogsDrawer />
+ </div>
+ </LogsDrawerProvider>
);
};
diff --git a/frontend/src/styles/components/_command-palette.scss b/frontend/src/styles/components/_command-palette.scss
new file mode 100644
index 00000000..37c226da
--- /dev/null
+++ b/frontend/src/styles/components/_command-palette.scss
@@ -0,0 +1,139 @@
+// ============================================
+// COMMAND PALETTE (Ctrl+K)
+// ============================================
+
+.command-palette-overlay {
+ position: fixed;
+ inset: 0;
+ background: rgba(0, 0, 0, 0.6);
+ backdrop-filter: blur(4px);
+ z-index: $z-modal;
+ display: flex;
+ justify-content: center;
+ padding-top: 15vh;
+}
+
+.command-palette {
+ width: 560px;
+ max-height: 460px;
+ background: $bg-card;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-xl;
+ box-shadow: $shadow-lg;
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+ animation: palette-enter 0.15s ease-out;
+
+ @keyframes palette-enter {
+ from {
+ opacity: 0;
+ transform: scale(0.96) translateY(-8px);
+ }
+ to {
+ opacity: 1;
+ transform: scale(1) translateY(0);
+ }
+ }
+
+ &__input-wrapper {
+ display: flex;
+ align-items: center;
+ gap: $space-3;
+ padding: $space-4 $space-5;
+ border-bottom: 1px solid $border-subtle;
+ color: $text-tertiary;
+
+ svg {
+ flex-shrink: 0;
+ }
+ }
+
+ &__input {
+ flex: 1;
+ background: none;
+ border: none;
+ outline: none;
+ font-size: $font-size-md;
+ color: $text-primary;
+ font-family: $font-main;
+
+ &::placeholder {
+ color: $text-tertiary;
+ }
+ }
+
+ &__kbd {
+ font-size: $font-size-xs;
+ font-family: $font-main;
+ padding: 2px 6px;
+ background: $bg-hover;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-sm;
+ color: $text-tertiary;
+ flex-shrink: 0;
+ }
+
+ &__results {
+ flex: 1;
+ overflow-y: auto;
+ padding: $space-2 0;
+ }
+
+ &__empty {
+ padding: $space-8 $space-5;
+ text-align: center;
+ color: $text-tertiary;
+ font-size: $font-size-sm;
+ }
+
+ &__group {
+ &:not(:first-child) {
+ margin-top: $space-2;
+ }
+ }
+
+ &__group-label {
+ padding: $space-2 $space-5;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-semibold;
+ color: $text-tertiary;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+
+ &__item {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ width: 100%;
+ padding: $space-2 $space-5;
+ background: none;
+ border: none;
+ cursor: pointer;
+ font-size: $font-size-base;
+ color: $text-secondary;
+ text-align: left;
+ transition: background $transition-fast, color $transition-fast;
+
+ &:hover,
+ &--active {
+ background: $bg-hover;
+ color: $text-primary;
+ }
+
+ &--active {
+ background: $bg-hover;
+ }
+ }
+
+ &__item-label {
+ font-weight: $font-weight-medium;
+ }
+
+ &__item-path {
+ font-size: $font-size-xs;
+ color: $text-tertiary;
+ font-family: $font-mono;
+ }
+}
diff --git a/frontend/src/styles/components/_logs-drawer.scss b/frontend/src/styles/components/_logs-drawer.scss
new file mode 100644
index 00000000..d1d2d39f
--- /dev/null
+++ b/frontend/src/styles/components/_logs-drawer.scss
@@ -0,0 +1,156 @@
+// ============================================
+// PERSISTENT LOGS DRAWER
+// ============================================
+
+.logs-drawer {
+ position: fixed;
+ bottom: 0;
+ left: $sidebar-width;
+ right: 0;
+ z-index: $z-fixed;
+ background: $bg-card;
+ border-top: 1px solid $border-subtle;
+ display: flex;
+ flex-direction: column;
+
+ &--collapsed {
+ height: 36px;
+ cursor: pointer;
+ transition: background $transition-fast;
+
+ &:hover {
+ background: $bg-hover;
+ }
+ }
+
+ &--expanded {
+ box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
+ }
+
+ // Resize drag handle
+ &__resize-handle {
+ height: 4px;
+ cursor: ns-resize;
+ background: transparent;
+ transition: background $transition-fast;
+ flex-shrink: 0;
+
+ &:hover,
+ &:active {
+ background: $accent-primary;
+ }
+ }
+
+ // Collapsed bar
+ &__collapsed-bar {
+ display: flex;
+ align-items: center;
+ gap: $space-3;
+ padding: 0 $space-4;
+ height: 36px;
+ overflow: hidden;
+ }
+
+ &__collapsed-actions {
+ margin-left: auto;
+ flex-shrink: 0;
+ }
+
+ // Header (expanded)
+ &__header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: $space-2 $space-4;
+ border-bottom: 1px solid $border-subtle;
+ flex-shrink: 0;
+ }
+
+ &__header-left,
+ &__header-right {
+ display: flex;
+ align-items: center;
+ gap: $space-3;
+ }
+
+ &__live-dot {
+ width: 8px;
+ height: 8px;
+ border-radius: $radius-full;
+ background: $success;
+ animation: live-pulse 2s infinite;
+ flex-shrink: 0;
+
+ @keyframes live-pulse {
+ 0%, 100% { opacity: 1; }
+ 50% { opacity: 0.4; }
+ }
+ }
+
+ &__service-name {
+ font-weight: $font-weight-semibold;
+ font-size: $font-size-sm;
+ color: $text-primary;
+ white-space: nowrap;
+ }
+
+ &__line-count {
+ font-size: $font-size-xs;
+ color: $text-tertiary;
+ }
+
+ &__last-line {
+ flex: 1;
+ font-family: $font-mono;
+ font-size: $font-size-xs;
+ color: $text-tertiary;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ &__toggle {
+ display: flex;
+ align-items: center;
+ gap: $space-1;
+ font-size: $font-size-xs;
+ color: $text-tertiary;
+ cursor: pointer;
+ user-select: none;
+
+ input {
+ accent-color: $accent-primary-raw;
+ }
+ }
+
+ // Log content area
+ &__content {
+ flex: 1;
+ overflow-y: auto;
+ padding: $space-2 $space-4;
+ font-family: $font-mono;
+ font-size: $font-size-xs;
+ line-height: 1.6;
+ background: $bg-body;
+ }
+
+ &__empty {
+ color: $text-tertiary;
+ padding: $space-4;
+ text-align: center;
+ }
+
+ &__line {
+ color: $text-secondary;
+ white-space: pre-wrap;
+ word-break: break-all;
+
+ &--error {
+ color: $danger;
+ }
+
+ &--warn {
+ color: $warning;
+ }
+ }
+}
diff --git a/frontend/src/styles/main.scss b/frontend/src/styles/main.scss
index 8d2fd394..bce72483 100644
--- a/frontend/src/styles/main.scss
+++ b/frontend/src/styles/main.scss
@@ -57,6 +57,8 @@
@import 'components/_status-badge';
@import 'components/_server-selector';
@import 'components/_contribution-graph';
+@import 'components/_command-palette';
+@import 'components/_logs-drawer';
// --------------------------------------------
// 5. PAGE-SPECIFIC STYLES