mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
refactor(ui): extract PageHeader component, tone down Badge and StatusBadge
- Extract shared PageHeader with icon/title/subtitle/actions props, replacing duplicated header markup across all 16 pages - Shrink Badge to text-xs with tighter padding for subtler appearance - Change StatusBadge normal states (merged/copied/linked) to default grey variant — only anomalies (warning/danger) use color - TargetsPage: move delete button to top-right, restore dashed separator between path and mode row
This commit is contained in:
@@ -17,7 +17,7 @@ const variants: Record<string, string> = {
|
||||
export default function Badge({ children, variant = 'default' }: BadgeProps) {
|
||||
return (
|
||||
<span
|
||||
className={`inline-flex items-center px-2.5 py-1 border text-sm ${variants[variant]}`}
|
||||
className={`inline-flex items-center px-2 py-0.5 border text-xs font-medium ${variants[variant]}`}
|
||||
style={{
|
||||
borderRadius: radius.sm,
|
||||
}}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
interface PageHeaderProps {
|
||||
title: string;
|
||||
subtitle?: React.ReactNode;
|
||||
icon: React.ReactNode;
|
||||
actions?: React.ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export default function PageHeader({ title, subtitle, icon, actions, className = '' }: PageHeaderProps) {
|
||||
const heading = (
|
||||
<div>
|
||||
<h2 className="text-2xl md:text-3xl font-bold text-pencil flex items-center gap-2">
|
||||
{icon}
|
||||
{title}
|
||||
</h2>
|
||||
{subtitle && <p className="text-pencil-light mt-1">{subtitle}</p>}
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`mb-6 ${actions ? 'flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4' : ''} ${className}`.trim()}
|
||||
>
|
||||
{heading}
|
||||
{actions && <div className="flex items-center gap-2">{actions}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
import Badge from './Badge';
|
||||
|
||||
const statusVariant: Record<string, 'success' | 'warning' | 'danger' | 'info' | 'default'> = {
|
||||
merged: 'success',
|
||||
copied: 'success',
|
||||
linked: 'success',
|
||||
merged: 'default',
|
||||
copied: 'default',
|
||||
linked: 'default',
|
||||
'not exist': 'warning',
|
||||
'has files': 'info',
|
||||
conflict: 'danger',
|
||||
|
||||
+24
-31
@@ -18,6 +18,7 @@ import { api } from '../api/client';
|
||||
import type { AuditAllResponse, AuditResult, AuditFinding } from '../api/client';
|
||||
import Card from '../components/Card';
|
||||
import Button from '../components/Button';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
import Badge from '../components/Badge';
|
||||
import { Select } from '../components/Input';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
@@ -121,38 +122,30 @@ export default function AuditPage() {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{/* Header */}
|
||||
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4">
|
||||
<div>
|
||||
<h2
|
||||
className="text-3xl font-bold text-pencil flex items-center gap-2"
|
||||
>
|
||||
<ShieldCheck size={28} strokeWidth={2.5} />
|
||||
Security Audit
|
||||
</h2>
|
||||
<p
|
||||
className="text-pencil-light mt-1"
|
||||
>
|
||||
Scan installed skills for malicious patterns and security threats
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<Link to="/audit/rules">
|
||||
<Button variant="secondary" size="sm">
|
||||
<FileEdit size={16} strokeWidth={2.5} />
|
||||
Custom Rules
|
||||
<PageHeader
|
||||
icon={<ShieldCheck size={24} strokeWidth={2.5} />}
|
||||
title="Security Audit"
|
||||
subtitle="Scan installed skills for malicious patterns and security threats"
|
||||
actions={
|
||||
<>
|
||||
<Link to="/audit/rules">
|
||||
<Button variant="secondary" size="sm">
|
||||
<FileEdit size={16} strokeWidth={2.5} />
|
||||
Custom Rules
|
||||
</Button>
|
||||
</Link>
|
||||
<Button
|
||||
variant="primary"
|
||||
size="sm"
|
||||
onClick={runAudit}
|
||||
disabled={loading}
|
||||
>
|
||||
<ShieldCheck size={16} strokeWidth={2.5} />
|
||||
{loading ? 'Scanning...' : 'Run Audit'}
|
||||
</Button>
|
||||
</Link>
|
||||
<Button
|
||||
variant="primary"
|
||||
size="sm"
|
||||
onClick={runAudit}
|
||||
disabled={loading}
|
||||
>
|
||||
<ShieldCheck size={16} strokeWidth={2.5} />
|
||||
{loading ? 'Scanning...' : 'Run Audit'}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
{/* Loading / Progress */}
|
||||
{loading && (
|
||||
|
||||
@@ -23,6 +23,7 @@ import { EditorView } from '@codemirror/view';
|
||||
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
|
||||
import Card from '../components/Card';
|
||||
import Button from '../components/Button';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
import Badge from '../components/Badge';
|
||||
import ConfirmDialog from '../components/ConfirmDialog';
|
||||
import { Input } from '../components/Input';
|
||||
@@ -290,70 +291,67 @@ export default function AuditRulesPage() {
|
||||
return (
|
||||
<div className="animate-fade-in">
|
||||
{/* ─── Header ─── */}
|
||||
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-6">
|
||||
<div>
|
||||
<div className="flex items-center gap-2 mb-1">
|
||||
<Link
|
||||
to="/audit"
|
||||
className="text-pencil-light hover:text-pencil transition-colors"
|
||||
aria-label="Back to Security Audit"
|
||||
>
|
||||
<ArrowLeft size={20} strokeWidth={2.5} />
|
||||
</Link>
|
||||
<h2
|
||||
className="text-3xl font-bold text-pencil flex items-center gap-2"
|
||||
>
|
||||
<ShieldCheck size={28} strokeWidth={2.5} />
|
||||
Audit Rules
|
||||
</h2>
|
||||
</div>
|
||||
<p className="text-pencil-light">
|
||||
{isProjectMode
|
||||
? 'Browse and manage project-level audit rules'
|
||||
: 'Browse and manage global audit rules'}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<Button
|
||||
onClick={() => setViewMode(viewMode === 'structured' ? 'yaml' : 'structured')}
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
>
|
||||
{viewMode === 'structured' ? (
|
||||
<><FileEdit size={16} strokeWidth={2.5} /> Edit YAML</>
|
||||
) : (
|
||||
<><List size={16} strokeWidth={2.5} /> Rule Browser</>
|
||||
)}
|
||||
</Button>
|
||||
{viewMode === 'structured' && stats.custom > 0 && (
|
||||
<div className="flex items-center gap-2 mb-1">
|
||||
<Link
|
||||
to="/audit"
|
||||
className="text-pencil-light hover:text-pencil transition-colors"
|
||||
aria-label="Back to Security Audit"
|
||||
>
|
||||
<ArrowLeft size={20} strokeWidth={2.5} />
|
||||
</Link>
|
||||
</div>
|
||||
<PageHeader
|
||||
icon={<ShieldCheck size={24} strokeWidth={2.5} />}
|
||||
title="Audit Rules"
|
||||
subtitle={
|
||||
isProjectMode
|
||||
? 'Browse and manage project-level audit rules'
|
||||
: 'Browse and manage global audit rules'
|
||||
}
|
||||
className="mb-6"
|
||||
actions={
|
||||
<>
|
||||
<Button
|
||||
onClick={() => setShowResetConfirm(true)}
|
||||
disabled={resetMutation.isPending}
|
||||
variant="danger"
|
||||
onClick={() => setViewMode(viewMode === 'structured' ? 'yaml' : 'structured')}
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
>
|
||||
<RotateCcw size={16} strokeWidth={2.5} />
|
||||
{resetMutation.isPending ? 'Resetting...' : 'Reset All'}
|
||||
</Button>
|
||||
)}
|
||||
{viewMode === 'yaml' && rawQuery.data?.exists && (
|
||||
<>
|
||||
{dirty && (
|
||||
<span
|
||||
className="text-sm text-warning px-2 py-1 bg-warning-light border border-warning"
|
||||
style={{ borderRadius: radius.sm }}
|
||||
>
|
||||
unsaved changes
|
||||
</span>
|
||||
{viewMode === 'structured' ? (
|
||||
<><FileEdit size={16} strokeWidth={2.5} /> Edit YAML</>
|
||||
) : (
|
||||
<><List size={16} strokeWidth={2.5} /> Rule Browser</>
|
||||
)}
|
||||
<Button onClick={handleSave} disabled={saving || !dirty} variant="primary" size="sm">
|
||||
<Save size={16} strokeWidth={2.5} />
|
||||
{saving ? 'Saving...' : 'Save'}
|
||||
</Button>
|
||||
{viewMode === 'structured' && stats.custom > 0 && (
|
||||
<Button
|
||||
onClick={() => setShowResetConfirm(true)}
|
||||
disabled={resetMutation.isPending}
|
||||
variant="danger"
|
||||
size="sm"
|
||||
>
|
||||
<RotateCcw size={16} strokeWidth={2.5} />
|
||||
{resetMutation.isPending ? 'Resetting...' : 'Reset All'}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{viewMode === 'yaml' && rawQuery.data?.exists && (
|
||||
<>
|
||||
{dirty && (
|
||||
<span
|
||||
className="text-sm text-warning px-2 py-1 bg-warning-light border border-warning"
|
||||
style={{ borderRadius: radius.sm }}
|
||||
>
|
||||
unsaved changes
|
||||
</span>
|
||||
)}
|
||||
<Button onClick={handleSave} disabled={saving || !dirty} variant="primary" size="sm">
|
||||
<Save size={16} strokeWidth={2.5} />
|
||||
{saving ? 'Saving...' : 'Save'}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
{/* ─── Structured View ─── */}
|
||||
{viewMode === 'structured' && compiled.data && (
|
||||
|
||||
@@ -17,6 +17,7 @@ import { queryKeys, staleTimes } from '../lib/queryKeys';
|
||||
import { formatSize } from '../lib/format';
|
||||
import Card from '../components/Card';
|
||||
import Button from '../components/Button';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
import Badge from '../components/Badge';
|
||||
import ConfirmDialog from '../components/ConfirmDialog';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
@@ -170,18 +171,11 @@ export default function BackupPage() {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{/* Header */}
|
||||
<div>
|
||||
<h2
|
||||
className="text-3xl font-bold text-pencil"
|
||||
>
|
||||
Backup & Restore
|
||||
</h2>
|
||||
<p
|
||||
className="text-pencil-light mt-1"
|
||||
>
|
||||
Create snapshots of your targets and restore them when needed
|
||||
</p>
|
||||
</div>
|
||||
<PageHeader
|
||||
icon={<Archive size={24} strokeWidth={2.5} />}
|
||||
title="Backup & Restore"
|
||||
subtitle="Create snapshots of your targets and restore them when needed"
|
||||
/>
|
||||
|
||||
{/* Action Card */}
|
||||
<Card>
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
XCircle,
|
||||
} from 'lucide-react';
|
||||
import Card from '../components/Card';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
import Badge from '../components/Badge';
|
||||
import Button from '../components/Button';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
@@ -122,17 +123,7 @@ export default function CollectPage() {
|
||||
|
||||
return (
|
||||
<div className="animate-fade-in">
|
||||
{/* Page header */}
|
||||
<div className="mb-8">
|
||||
<h2
|
||||
className="text-3xl md:text-4xl font-bold text-pencil mb-2"
|
||||
>
|
||||
Collect
|
||||
</h2>
|
||||
<p className="text-pencil-light text-base">
|
||||
Pull local skills from targets back to source
|
||||
</p>
|
||||
</div>
|
||||
<PageHeader icon={<ArrowDownToLine size={24} strokeWidth={2.5} />} title="Collect" subtitle="Pull local skills from targets back to source" />
|
||||
|
||||
{/* Visual Pipeline (reverse direction) */}
|
||||
<div className="hidden md:flex items-center justify-center gap-4 mb-8">
|
||||
|
||||
+26
-30
@@ -1,11 +1,12 @@
|
||||
import { useState, useEffect, useMemo } from 'react';
|
||||
import { Save, FileCode } from 'lucide-react';
|
||||
import { Save, FileCode, Settings } from 'lucide-react';
|
||||
import CodeMirror from '@uiw/react-codemirror';
|
||||
import { yaml } from '@codemirror/lang-yaml';
|
||||
import { EditorView } from '@codemirror/view';
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import Card from '../components/Card';
|
||||
import Button from '../components/Button';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
import { PageSkeleton } from '../components/Skeleton';
|
||||
import { useToast } from '../components/Toast';
|
||||
import { api } from '../api/client';
|
||||
@@ -71,36 +72,31 @@ export default function ConfigPage() {
|
||||
return (
|
||||
<div className="animate-fade-in">
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<div>
|
||||
<h2
|
||||
className="text-3xl md:text-4xl font-bold text-pencil mb-1"
|
||||
>
|
||||
Config
|
||||
</h2>
|
||||
<p className="text-pencil-light">
|
||||
{isProjectMode ? 'Edit your project configuration' : 'Edit your skillshare configuration'}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
{dirty && (
|
||||
<span
|
||||
className="text-sm text-warning px-2 py-1 bg-warning-light rounded-full border border-warning"
|
||||
<PageHeader
|
||||
icon={<Settings size={24} strokeWidth={2.5} />}
|
||||
title="Config"
|
||||
subtitle={isProjectMode ? 'Edit your project configuration' : 'Edit your skillshare configuration'}
|
||||
actions={
|
||||
<>
|
||||
{dirty && (
|
||||
<span
|
||||
className="text-sm text-warning px-2 py-1 bg-warning-light rounded-full border border-warning"
|
||||
>
|
||||
unsaved changes
|
||||
</span>
|
||||
)}
|
||||
<Button
|
||||
onClick={handleSave}
|
||||
disabled={saving || !dirty}
|
||||
variant="primary"
|
||||
size="sm"
|
||||
>
|
||||
unsaved changes
|
||||
</span>
|
||||
)}
|
||||
<Button
|
||||
onClick={handleSave}
|
||||
disabled={saving || !dirty}
|
||||
variant="primary"
|
||||
size="sm"
|
||||
>
|
||||
<Save size={16} strokeWidth={2.5} />
|
||||
{saving ? 'Saving...' : 'Save'}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<Save size={16} strokeWidth={2.5} />
|
||||
{saving ? 'Saving...' : 'Save'}
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
<Card>
|
||||
<div className="flex items-center gap-2 mb-3">
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
ShieldCheck,
|
||||
ShieldAlert,
|
||||
FolderPlus,
|
||||
LayoutDashboard,
|
||||
} from 'lucide-react';
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { queryKeys, staleTimes } from '../lib/queryKeys';
|
||||
@@ -27,6 +28,7 @@ import IconButton from '../components/IconButton';
|
||||
import Skeleton from '../components/Skeleton';
|
||||
import { PageSkeleton } from '../components/Skeleton';
|
||||
import StatusBadge from '../components/StatusBadge';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
import ConfirmDialog from '../components/ConfirmDialog';
|
||||
import { useToast } from '../components/Toast';
|
||||
import { api } from '../api/client';
|
||||
@@ -147,17 +149,7 @@ export default function DashboardPage() {
|
||||
|
||||
return (
|
||||
<div className="animate-fade-in">
|
||||
{/* Page header */}
|
||||
<div className="mb-8">
|
||||
<h2
|
||||
className="text-3xl md:text-4xl font-bold text-pencil mb-2"
|
||||
>
|
||||
Dashboard
|
||||
</h2>
|
||||
<p className="text-pencil-light text-base">
|
||||
Your skill management overview at a glance
|
||||
</p>
|
||||
</div>
|
||||
<PageHeader icon={<LayoutDashboard size={24} strokeWidth={2.5} />} title="Dashboard" subtitle="Your skill management overview at a glance" />
|
||||
|
||||
{/* Stats grid */}
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-5 mb-8">
|
||||
|
||||
+12
-18
@@ -13,6 +13,7 @@ import DialogShell from '../components/DialogShell';
|
||||
import { Input, Select } from '../components/Input';
|
||||
import Badge from '../components/Badge';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
import ConfirmDialog from '../components/ConfirmDialog';
|
||||
import { PageSkeleton } from '../components/Skeleton';
|
||||
import { radius } from '../design';
|
||||
@@ -322,14 +323,14 @@ export default function ExtrasPage() {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{/* Header */}
|
||||
<div>
|
||||
<div className="flex items-center justify-between">
|
||||
<h2
|
||||
className="text-3xl font-bold text-pencil"
|
||||
>
|
||||
Extras
|
||||
</h2>
|
||||
<div className="flex gap-2">
|
||||
<PageHeader
|
||||
icon={<FolderPlus size={24} strokeWidth={2.5} />}
|
||||
title="Extras"
|
||||
subtitle={isProjectMode
|
||||
? 'Sync arbitrary directories to project targets'
|
||||
: 'Sync arbitrary directories to AI tool targets'}
|
||||
actions={
|
||||
<>
|
||||
{extras.length > 0 && (
|
||||
<Button variant="secondary" size="sm" onClick={handleSyncAll}>
|
||||
<RefreshCw size={14} strokeWidth={2.5} /> Sync All
|
||||
@@ -338,16 +339,9 @@ export default function ExtrasPage() {
|
||||
<Button variant="primary" size="sm" onClick={() => setShowAdd(true)}>
|
||||
<Plus size={14} strokeWidth={2.5} /> Add Extra
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<p
|
||||
className="text-pencil-light mt-1"
|
||||
>
|
||||
{isProjectMode
|
||||
? 'Sync arbitrary directories to project targets'
|
||||
: 'Sync arbitrary directories to AI tool targets'}
|
||||
</p>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
{/* Loading */}
|
||||
{isPending && <PageSkeleton />}
|
||||
|
||||
@@ -23,6 +23,7 @@ import Card from '../components/Card';
|
||||
import Button from '../components/Button';
|
||||
import { Input, Checkbox } from '../components/Input';
|
||||
import Badge from '../components/Badge';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
import { PageSkeleton } from '../components/Skeleton';
|
||||
import { useToast } from '../components/Toast';
|
||||
|
||||
@@ -145,18 +146,11 @@ export default function GitSyncPage() {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{/* Header */}
|
||||
<div>
|
||||
<h2
|
||||
className="text-3xl font-bold text-pencil"
|
||||
>
|
||||
Git Sync
|
||||
</h2>
|
||||
<p
|
||||
className="text-pencil-light mt-1"
|
||||
>
|
||||
Push and pull your skills source directory via git
|
||||
</p>
|
||||
</div>
|
||||
<PageHeader
|
||||
icon={<GitBranch size={24} strokeWidth={2.5} />}
|
||||
title="Git Sync"
|
||||
subtitle="Push and pull your skills source directory via git"
|
||||
/>
|
||||
|
||||
{/* Repo Status Card */}
|
||||
<Card>
|
||||
@@ -276,15 +270,14 @@ export default function GitSyncPage() {
|
||||
/>
|
||||
<Button
|
||||
variant="primary"
|
||||
size="lg"
|
||||
size="sm"
|
||||
onClick={handlePush}
|
||||
disabled={pushing || (!status?.isDirty && !pushDryRun)}
|
||||
className="w-full md:w-auto"
|
||||
>
|
||||
{pushing ? (
|
||||
<><RefreshCw size={18} strokeWidth={2.5} className="animate-spin" /> Pushing...</>
|
||||
<><RefreshCw size={16} strokeWidth={2.5} className="animate-spin" /> Pushing...</>
|
||||
) : (
|
||||
<><ArrowUpCircle size={18} strokeWidth={2.5} /> Push</>
|
||||
<><ArrowUpCircle size={16} strokeWidth={2.5} /> Push</>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
@@ -327,15 +320,14 @@ export default function GitSyncPage() {
|
||||
/>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="lg"
|
||||
size="sm"
|
||||
onClick={handlePull}
|
||||
disabled={pulling || (!!status?.isDirty && !pullDryRun)}
|
||||
className="w-full md:w-auto"
|
||||
>
|
||||
{pulling ? (
|
||||
<><RefreshCw size={18} strokeWidth={2.5} className="animate-spin" /> Pulling...</>
|
||||
<><RefreshCw size={16} strokeWidth={2.5} className="animate-spin" /> Pulling...</>
|
||||
) : (
|
||||
<><ArrowDownCircle size={18} strokeWidth={2.5} /> Pull</>
|
||||
<><ArrowDownCircle size={16} strokeWidth={2.5} /> Pull</>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
import { Download } from 'lucide-react';
|
||||
import InstallForm from '../components/InstallForm';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
|
||||
export default function InstallPage() {
|
||||
return (
|
||||
<div className="animate-fade-in">
|
||||
<div className="mb-6">
|
||||
<h2
|
||||
className="text-3xl md:text-4xl font-bold text-pencil mb-2"
|
||||
>
|
||||
Install Skill
|
||||
</h2>
|
||||
<p className="text-pencil-light">
|
||||
Install a skill from a GitHub URL, owner/repo, or local path
|
||||
</p>
|
||||
</div>
|
||||
<PageHeader icon={<Download size={24} strokeWidth={2.5} />} title="Install Skill" subtitle="Install a skill from a GitHub URL, owner/repo, or local path" />
|
||||
|
||||
<InstallForm collapsible={false} defaultOpen />
|
||||
</div>
|
||||
|
||||
+19
-24
@@ -6,6 +6,7 @@ import type { LogEntry, LogStatsResponse } from '../api/client';
|
||||
import { queryKeys, staleTimes } from '../lib/queryKeys';
|
||||
import Card from '../components/Card';
|
||||
import Button from '../components/Button';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
import Badge from '../components/Badge';
|
||||
import ConfirmDialog from '../components/ConfirmDialog';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
@@ -661,31 +662,25 @@ export default function LogPage() {
|
||||
return (
|
||||
<div className="space-y-6 animate-fade-in">
|
||||
{/* ─── Header ─── */}
|
||||
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4">
|
||||
<div>
|
||||
<h2
|
||||
className="text-3xl font-bold text-pencil flex items-center gap-2"
|
||||
>
|
||||
<ScrollText size={28} strokeWidth={2.5} />
|
||||
Operations & Audit Log
|
||||
</h2>
|
||||
<p className="text-pencil-light mt-1">
|
||||
Persistent record of CLI and UI operations, including audit findings by skill
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Button onClick={handleRefresh} variant="secondary" size="sm" disabled={loading}>
|
||||
<RefreshCw size={16} className={loading ? 'animate-spin' : ''} />
|
||||
Refresh
|
||||
</Button>
|
||||
{hasEntries && (
|
||||
<Button onClick={() => setConfirmOpen(true)} variant="danger" size="sm" disabled={clearing}>
|
||||
<Trash2 size={16} />
|
||||
Clear
|
||||
<PageHeader
|
||||
icon={<ScrollText size={24} strokeWidth={2.5} />}
|
||||
title="Operations & Audit Log"
|
||||
subtitle="Persistent record of CLI and UI operations, including audit findings by skill"
|
||||
actions={
|
||||
<>
|
||||
<Button onClick={handleRefresh} variant="secondary" size="sm" disabled={loading}>
|
||||
<RefreshCw size={16} className={loading ? 'animate-spin' : ''} />
|
||||
Refresh
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{hasEntries && (
|
||||
<Button onClick={() => setConfirmOpen(true)} variant="danger" size="sm" disabled={clearing}>
|
||||
<Trash2 size={16} />
|
||||
Clear
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
{/* ─── Tabs ─── */}
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useState, useCallback, useEffect, useRef, useMemo } from 'react';
|
||||
import { Search, Star, Download, Globe, Database, Settings } from 'lucide-react';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import Card from '../components/Card';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
import Badge from '../components/Badge';
|
||||
import Button from '../components/Button';
|
||||
import { Input, Select } from '../components/Input';
|
||||
@@ -317,17 +318,7 @@ export default function SearchPage() {
|
||||
|
||||
return (
|
||||
<div className="animate-fade-in">
|
||||
{/* Header */}
|
||||
<div className="mb-6">
|
||||
<h2
|
||||
className="text-3xl md:text-4xl font-bold text-pencil mb-2"
|
||||
>
|
||||
Search Skills
|
||||
</h2>
|
||||
<p className="text-pencil-light">
|
||||
Discover and install skills
|
||||
</p>
|
||||
</div>
|
||||
<PageHeader icon={<Search size={24} strokeWidth={2.5} />} title="Search Skills" subtitle="Discover and install skills" />
|
||||
|
||||
{/* Mode tabs */}
|
||||
<div className="flex gap-2 mb-4">
|
||||
|
||||
@@ -24,6 +24,7 @@ import { PageSkeleton } from '../components/Skeleton';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
import Card from '../components/Card';
|
||||
import Button from '../components/Button';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
import SegmentedControl from '../components/SegmentedControl';
|
||||
import Pagination from '../components/Pagination';
|
||||
import { api, type Skill } from '../api/client';
|
||||
@@ -332,18 +333,11 @@ export default function SkillsPage() {
|
||||
return (
|
||||
<div className="animate-fade-in">
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<div>
|
||||
<h2
|
||||
className="text-3xl md:text-4xl font-bold text-pencil mb-1"
|
||||
>
|
||||
Skills
|
||||
</h2>
|
||||
<p className="text-pencil-light">
|
||||
{skills.length} skill{skills.length !== 1 ? 's' : ''} installed
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<PageHeader
|
||||
icon={<Puzzle size={24} strokeWidth={2.5} />}
|
||||
title="Skills"
|
||||
subtitle={`${skills.length} skill${skills.length !== 1 ? 's' : ''} installed`}
|
||||
/>
|
||||
|
||||
{/* Search + Sort row */}
|
||||
<div className="flex flex-col sm:flex-row gap-3 mb-4">
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
import { Virtuoso } from 'react-virtuoso';
|
||||
import Card from '../components/Card';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
import Badge from '../components/Badge';
|
||||
import Button from '../components/Button';
|
||||
import { useToast } from '../components/Toast';
|
||||
@@ -125,17 +126,7 @@ export default function SyncPage() {
|
||||
|
||||
return (
|
||||
<div className="animate-fade-in">
|
||||
{/* Page header */}
|
||||
<div className="mb-8">
|
||||
<h2
|
||||
className="text-3xl md:text-4xl font-bold text-pencil mb-2"
|
||||
>
|
||||
Sync
|
||||
</h2>
|
||||
<p className="text-pencil-light text-base">
|
||||
Push your skills from source to all configured targets
|
||||
</p>
|
||||
</div>
|
||||
<PageHeader icon={<RefreshCw size={24} strokeWidth={2.5} />} title="Sync" subtitle="Push your skills from source to all configured targets" />
|
||||
|
||||
{/* Visual Pipeline */}
|
||||
<div className="hidden md:flex items-center justify-center gap-4 mb-8">
|
||||
|
||||
@@ -11,6 +11,7 @@ import FilterTagInput from '../components/FilterTagInput';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
import ConfirmDialog from '../components/ConfirmDialog';
|
||||
import { PageSkeleton } from '../components/Skeleton';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
import { useToast } from '../components/Toast';
|
||||
import { api } from '../api/client';
|
||||
import type { AvailableTarget } from '../api/client';
|
||||
@@ -109,35 +110,30 @@ export default function TargetsPage() {
|
||||
return (
|
||||
<div className="animate-fade-in">
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<div>
|
||||
<h2
|
||||
className="text-3xl md:text-4xl font-bold text-pencil mb-1"
|
||||
<PageHeader
|
||||
icon={<Target size={24} strokeWidth={2.5} />}
|
||||
title="Targets"
|
||||
subtitle={`${targets.length} target${targets.length !== 1 ? 's' : ''} configured`}
|
||||
actions={
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (adding) {
|
||||
setAdding(false);
|
||||
setNewTarget({ name: '', path: '' });
|
||||
setSearchQuery('');
|
||||
setCustomMode(false);
|
||||
} else {
|
||||
setAdding(true);
|
||||
}
|
||||
}}
|
||||
variant={adding ? 'secondary' : 'primary'}
|
||||
size="sm"
|
||||
>
|
||||
Targets
|
||||
</h2>
|
||||
<p className="text-pencil-light">
|
||||
{targets.length} target{targets.length !== 1 ? 's' : ''} configured
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (adding) {
|
||||
setAdding(false);
|
||||
setNewTarget({ name: '', path: '' });
|
||||
setSearchQuery('');
|
||||
setCustomMode(false);
|
||||
} else {
|
||||
setAdding(true);
|
||||
}
|
||||
}}
|
||||
variant={adding ? 'secondary' : 'primary'}
|
||||
size="sm"
|
||||
>
|
||||
{adding ? null : <Plus size={16} strokeWidth={2.5} />}
|
||||
{adding ? 'Cancel' : 'Add Target'}
|
||||
</Button>
|
||||
</div>
|
||||
{adding ? null : <Plus size={16} strokeWidth={2.5} />}
|
||||
{adding ? 'Cancel' : 'Add Target'}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
||||
{/* Add target form */}
|
||||
{adding && (
|
||||
@@ -335,7 +331,7 @@ export default function TargetsPage() {
|
||||
className={`!overflow-visible ${i % 2 === 0 ? 'rotate-[-0.2deg]' : 'rotate-[0.2deg]'}`}
|
||||
style={{ position: 'relative', zIndex: targets.length - i }}
|
||||
>
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<div className="flex items-start justify-between gap-4">
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex items-center gap-2 mb-1 flex-wrap">
|
||||
<Target size={16} strokeWidth={2.5} className="text-success shrink-0" />
|
||||
@@ -351,7 +347,7 @@ export default function TargetsPage() {
|
||||
>
|
||||
{shortenHome(target.path)}
|
||||
</p>
|
||||
<div className="mt-3 flex items-center gap-2">
|
||||
<div className="mt-3 pt-3 border-t border-dashed border-muted-dark/30 flex items-center gap-2">
|
||||
<Select
|
||||
value={target.mode || 'merge'}
|
||||
onChange={async (mode) => {
|
||||
|
||||
@@ -12,6 +12,7 @@ import { queryKeys, staleTimes } from '../lib/queryKeys';
|
||||
import { useAppContext } from '../context/AppContext';
|
||||
import { formatSize } from '../lib/format';
|
||||
import Card from '../components/Card';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
import Button from '../components/Button';
|
||||
import Badge from '../components/Badge';
|
||||
import ConfirmDialog from '../components/ConfirmDialog';
|
||||
@@ -112,21 +113,7 @@ export default function TrashPage() {
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{/* Header */}
|
||||
<div>
|
||||
<h2
|
||||
className="text-3xl font-bold text-pencil"
|
||||
>
|
||||
Trash
|
||||
</h2>
|
||||
<p
|
||||
className="text-pencil-light mt-1"
|
||||
>
|
||||
{isProjectMode
|
||||
? 'Recently deleted project skills are kept for 7 days before automatic cleanup'
|
||||
: 'Recently deleted skills are kept for 7 days before automatic cleanup'}
|
||||
</p>
|
||||
</div>
|
||||
<PageHeader icon={<Trash2 size={24} strokeWidth={2.5} />} title="Trash" subtitle={isProjectMode ? 'Recently deleted project skills are kept for 7 days before automatic cleanup' : 'Recently deleted skills are kept for 7 days before automatic cleanup'} />
|
||||
|
||||
{/* Summary Card */}
|
||||
<Card>
|
||||
|
||||
+32
-37
@@ -6,6 +6,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
import Card from '../components/Card';
|
||||
import Button from '../components/Button';
|
||||
import PageHeader from '../components/PageHeader';
|
||||
import { Checkbox } from '../components/Input';
|
||||
import Badge from '../components/Badge';
|
||||
import { queryKeys } from '../lib/queryKeys';
|
||||
@@ -228,35 +229,32 @@ export default function UpdatePage() {
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="flex items-center justify-between flex-wrap gap-3">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold text-pencil">
|
||||
Updates
|
||||
</h1>
|
||||
<p className="text-pencil-light text-sm mt-1">
|
||||
Check and apply updates for tracked repositories and installed skills.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
{phase === 'idle' && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={runCheck}
|
||||
disabled={checking}
|
||||
>
|
||||
<RefreshCw size={16} className={checking ? 'animate-spin' : ''} />
|
||||
Check Now
|
||||
</Button>
|
||||
)}
|
||||
{phase === 'idle' && hasUpdates && totalSelected > 0 && (
|
||||
<Button variant="primary" size="sm" onClick={handleUpdate}>
|
||||
<ArrowUpCircle size={16} />
|
||||
Update Selected ({totalSelected})
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<PageHeader
|
||||
icon={<ArrowUpCircle size={24} strokeWidth={2.5} />}
|
||||
title="Updates"
|
||||
subtitle="Check and apply updates for tracked repositories and installed skills."
|
||||
actions={
|
||||
<>
|
||||
{phase === 'idle' && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={runCheck}
|
||||
disabled={checking}
|
||||
>
|
||||
<RefreshCw size={16} className={checking ? 'animate-spin' : ''} />
|
||||
Check Now
|
||||
</Button>
|
||||
)}
|
||||
{phase === 'idle' && hasUpdates && totalSelected > 0 && (
|
||||
<Button variant="primary" size="sm" onClick={handleUpdate}>
|
||||
<ArrowUpCircle size={16} />
|
||||
Update Selected ({totalSelected})
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
{/* Update results panel */}
|
||||
{phase !== 'idle' && (
|
||||
@@ -475,14 +473,11 @@ function StatusBadge({ status }: { status: ItemUpdateStatus['status'] }) {
|
||||
|
||||
function UpdatePageHeader() {
|
||||
return (
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold text-pencil">
|
||||
Updates
|
||||
</h1>
|
||||
<p className="text-pencil-light text-sm mt-1">
|
||||
Check and apply updates for tracked repositories and installed skills.
|
||||
</p>
|
||||
</div>
|
||||
<PageHeader
|
||||
icon={<ArrowUpCircle size={24} strokeWidth={2.5} />}
|
||||
title="Updates"
|
||||
subtitle="Check and apply updates for tracked repositories and installed skills."
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user