claude-plan-viewer 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.html +2 -2
- package/index.ts +220 -43
- package/package.json +13 -3
- package/src/client/App.tsx +173 -0
- package/src/client/components/DetailOverlay.tsx +88 -0
- package/src/client/components/DetailPanel.tsx +84 -0
- package/src/client/components/Header.tsx +55 -0
- package/src/client/components/HelpModal.tsx +58 -0
- package/src/client/components/Markdown.tsx +16 -0
- package/src/client/components/PlanRow.tsx +53 -0
- package/src/client/components/PlansTable.tsx +94 -0
- package/src/client/components/ProjectFilter.tsx +180 -0
- package/src/client/components/SearchInput.tsx +42 -0
- package/src/client/components/index.ts +10 -0
- package/src/client/hooks/index.ts +3 -0
- package/src/client/hooks/useDebounce.ts +17 -0
- package/src/client/hooks/useFilters.ts +78 -0
- package/src/client/hooks/useKeyboard.ts +114 -0
- package/src/client/hooks/usePlans.ts +169 -0
- package/src/client/hooks/useProjects.ts +21 -0
- package/src/client/index.tsx +11 -0
- package/src/client/types.ts +19 -0
- package/src/client/utils/api.ts +38 -0
- package/src/client/utils/formatters.ts +40 -0
- package/src/client/utils/index.ts +15 -0
- package/src/client/utils/markdown.ts +123 -0
- package/src/client/utils/strings.ts +18 -0
- package/styles.css +304 -120
- package/frontend.ts +0 -843
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { useEffect, useCallback } from "react";
|
|
2
|
+
import type { Plan } from "../types.ts";
|
|
3
|
+
import { formatFullDate, formatSize } from "../utils/formatters.ts";
|
|
4
|
+
import { Markdown } from "./Markdown.tsx";
|
|
5
|
+
|
|
6
|
+
interface DetailOverlayProps {
|
|
7
|
+
plan: Plan;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
onOpenEditor: () => void;
|
|
10
|
+
onCopySession: (sessionId: string) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function DetailOverlay({
|
|
14
|
+
plan,
|
|
15
|
+
onClose,
|
|
16
|
+
onOpenEditor,
|
|
17
|
+
onCopySession,
|
|
18
|
+
}: DetailOverlayProps) {
|
|
19
|
+
const handleKeyDown = useCallback(
|
|
20
|
+
(e: KeyboardEvent) => {
|
|
21
|
+
if (e.key === "Escape" || e.key === "f") {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
onClose();
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
[onClose]
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
31
|
+
document.body.style.overflow = "hidden";
|
|
32
|
+
|
|
33
|
+
return () => {
|
|
34
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
35
|
+
document.body.style.overflow = "";
|
|
36
|
+
};
|
|
37
|
+
}, [handleKeyDown]);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
className="detail-overlay is-open"
|
|
42
|
+
id="detail-overlay"
|
|
43
|
+
aria-hidden="false"
|
|
44
|
+
onClick={onClose}
|
|
45
|
+
>
|
|
46
|
+
<div className="detail-overlay-panel" onClick={(e) => e.stopPropagation()}>
|
|
47
|
+
<div className="detail-overlay-bar">
|
|
48
|
+
<div className="detail-meta detail-overlay-meta">
|
|
49
|
+
{plan.project && <span className="project-tag">{plan.project}</span>}
|
|
50
|
+
<span>{plan.filename}</span>
|
|
51
|
+
<span>{formatFullDate(plan.modified)}</span>
|
|
52
|
+
<span>{formatSize(plan.size)}</span>
|
|
53
|
+
<span>{plan.lineCount} lines</span>
|
|
54
|
+
{plan.sessionId && (
|
|
55
|
+
<button
|
|
56
|
+
className="session-tag"
|
|
57
|
+
onClick={() => onCopySession(plan.sessionId!)}
|
|
58
|
+
title={`Click to copy: claude --resume ${plan.sessionId}`}
|
|
59
|
+
>
|
|
60
|
+
{plan.sessionId.split("-")[0]}
|
|
61
|
+
</button>
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
64
|
+
<button
|
|
65
|
+
className="action-btn"
|
|
66
|
+
onClick={onOpenEditor}
|
|
67
|
+
title="Open in editor (Enter)"
|
|
68
|
+
>
|
|
69
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="icon">
|
|
70
|
+
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
|
|
71
|
+
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
|
|
72
|
+
</svg>
|
|
73
|
+
</button>
|
|
74
|
+
<button
|
|
75
|
+
className="modal-close"
|
|
76
|
+
onClick={onClose}
|
|
77
|
+
title="Close fullscreen (Esc or F)"
|
|
78
|
+
>
|
|
79
|
+
×
|
|
80
|
+
</button>
|
|
81
|
+
</div>
|
|
82
|
+
<div className="detail-overlay-content">
|
|
83
|
+
<Markdown content={plan.content || ""} />
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Plan } from "../types.ts";
|
|
2
|
+
import { formatFullDate, formatDateISO, formatSize } from "../utils/formatters.ts";
|
|
3
|
+
import { Markdown } from "./Markdown.tsx";
|
|
4
|
+
|
|
5
|
+
interface DetailPanelProps {
|
|
6
|
+
plan: Plan | null;
|
|
7
|
+
onOpenEditor: () => void;
|
|
8
|
+
onToggleOverlay: () => void;
|
|
9
|
+
onCopySession: (sessionId: string) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function DetailPanel({
|
|
13
|
+
plan,
|
|
14
|
+
onOpenEditor,
|
|
15
|
+
onToggleOverlay,
|
|
16
|
+
onCopySession,
|
|
17
|
+
}: DetailPanelProps) {
|
|
18
|
+
if (!plan) {
|
|
19
|
+
return (
|
|
20
|
+
<div id="detail-panel" className="detail-panel">
|
|
21
|
+
<div className="detail-empty">
|
|
22
|
+
<p>Select a plan to view details</p>
|
|
23
|
+
<p className="hint">Use ↑↓ arrows to navigate, Enter to open in editor</p>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div id="detail-panel" className="detail-panel">
|
|
31
|
+
<div className="detail-header">
|
|
32
|
+
<div className="detail-header-top">
|
|
33
|
+
<h2 className="detail-title">{plan.title}</h2>
|
|
34
|
+
<div className="detail-actions">
|
|
35
|
+
<button
|
|
36
|
+
className="action-btn"
|
|
37
|
+
onClick={onOpenEditor}
|
|
38
|
+
title="Open in editor (Enter)"
|
|
39
|
+
>
|
|
40
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="icon">
|
|
41
|
+
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
|
|
42
|
+
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
|
|
43
|
+
</svg>
|
|
44
|
+
</button>
|
|
45
|
+
<button
|
|
46
|
+
className="action-btn"
|
|
47
|
+
onClick={onToggleOverlay}
|
|
48
|
+
title="Fullscreen (F)"
|
|
49
|
+
>
|
|
50
|
+
⛶
|
|
51
|
+
</button>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<div className="detail-meta">
|
|
56
|
+
<span title={plan.modified}>
|
|
57
|
+
Modified: {formatFullDate(plan.modified)}
|
|
58
|
+
</span>
|
|
59
|
+
<span>Created: {formatDateISO(plan.created)}</span>
|
|
60
|
+
|
|
61
|
+
<span>{plan.wordCount} words</span>
|
|
62
|
+
{plan.project && <span className="project-badge">{plan.project}</span>}
|
|
63
|
+
{plan.sessionId && (
|
|
64
|
+
<button
|
|
65
|
+
className="session-tag"
|
|
66
|
+
onClick={() => onCopySession(plan.sessionId!)}
|
|
67
|
+
title={`Click to copy: claude --resume ${plan.sessionId}`}
|
|
68
|
+
>
|
|
69
|
+
{plan.sessionId.split("-")[0]}
|
|
70
|
+
</button>
|
|
71
|
+
)}
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<div className="detail-content">
|
|
76
|
+
{plan.content ? (
|
|
77
|
+
<Markdown content={plan.content} />
|
|
78
|
+
) : (
|
|
79
|
+
<div className="loading">Loading content...</div>
|
|
80
|
+
)}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { SearchInput } from "./SearchInput.tsx";
|
|
2
|
+
import { ProjectFilter } from "./ProjectFilter.tsx";
|
|
3
|
+
|
|
4
|
+
interface HeaderProps {
|
|
5
|
+
searchQuery: string;
|
|
6
|
+
onSearchChange: (query: string) => void;
|
|
7
|
+
projects: string[];
|
|
8
|
+
selectedProjects: Set<string>;
|
|
9
|
+
onToggleProject: (project: string) => void;
|
|
10
|
+
onClearProjects: () => void;
|
|
11
|
+
onRefresh: () => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function Header({
|
|
15
|
+
searchQuery,
|
|
16
|
+
onSearchChange,
|
|
17
|
+
projects,
|
|
18
|
+
selectedProjects,
|
|
19
|
+
onToggleProject,
|
|
20
|
+
onClearProjects,
|
|
21
|
+
onRefresh,
|
|
22
|
+
}: HeaderProps) {
|
|
23
|
+
return (
|
|
24
|
+
<div className="header">
|
|
25
|
+
<div className="header-row">
|
|
26
|
+
<h1>
|
|
27
|
+
<svg className="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
|
28
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
|
|
29
|
+
</svg>
|
|
30
|
+
Claude Plan Viewer
|
|
31
|
+
</h1>
|
|
32
|
+
<div className="header-spacer" />
|
|
33
|
+
<SearchInput value={searchQuery} onChange={onSearchChange} />
|
|
34
|
+
{projects.length > 0 && (
|
|
35
|
+
<ProjectFilter
|
|
36
|
+
projects={projects}
|
|
37
|
+
selectedProjects={selectedProjects}
|
|
38
|
+
onToggle={onToggleProject}
|
|
39
|
+
onClear={onClearProjects}
|
|
40
|
+
/>
|
|
41
|
+
)}
|
|
42
|
+
<button
|
|
43
|
+
className="action-btn"
|
|
44
|
+
id="refresh-btn"
|
|
45
|
+
onClick={onRefresh}
|
|
46
|
+
title="Refresh plans"
|
|
47
|
+
>
|
|
48
|
+
<svg className="icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
49
|
+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
|
50
|
+
</svg>
|
|
51
|
+
</button>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useEffect, useCallback } from "react";
|
|
2
|
+
|
|
3
|
+
interface HelpModalProps {
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const SHORTCUTS = [
|
|
8
|
+
{ keys: "↑ / ↓", description: "Navigate plans" },
|
|
9
|
+
{ keys: "Enter", description: "Open in editor" },
|
|
10
|
+
{ keys: "F", description: "Toggle fullscreen" },
|
|
11
|
+
{ keys: "⌘K", description: "Focus search" },
|
|
12
|
+
{ keys: "Esc", description: "Clear search / Close" },
|
|
13
|
+
{ keys: "?", description: "Toggle help" },
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export function HelpModal({ onClose }: HelpModalProps) {
|
|
17
|
+
const handleKeyDown = useCallback(
|
|
18
|
+
(e: KeyboardEvent) => {
|
|
19
|
+
if (e.key === "Escape" || e.key === "?") {
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
onClose();
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
[onClose]
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
29
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
30
|
+
}, [handleKeyDown]);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div className="modal-overlay" onClick={onClose}>
|
|
34
|
+
<div className="modal-content help-modal" onClick={(e) => e.stopPropagation()}>
|
|
35
|
+
<div className="modal-header">
|
|
36
|
+
<h3>Keyboard Shortcuts</h3>
|
|
37
|
+
<button className="btn btn-secondary" onClick={onClose}>
|
|
38
|
+
✕
|
|
39
|
+
</button>
|
|
40
|
+
</div>
|
|
41
|
+
<div className="modal-body">
|
|
42
|
+
<table className="shortcuts-table">
|
|
43
|
+
<tbody>
|
|
44
|
+
{SHORTCUTS.map((shortcut) => (
|
|
45
|
+
<tr key={shortcut.keys}>
|
|
46
|
+
<td className="shortcut-keys">
|
|
47
|
+
<kbd>{shortcut.keys}</kbd>
|
|
48
|
+
</td>
|
|
49
|
+
<td className="shortcut-desc">{shortcut.description}</td>
|
|
50
|
+
</tr>
|
|
51
|
+
))}
|
|
52
|
+
</tbody>
|
|
53
|
+
</table>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { renderMarkdown } from "../utils/markdown.ts";
|
|
2
|
+
|
|
3
|
+
interface MarkdownProps {
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function Markdown({ content }: MarkdownProps) {
|
|
8
|
+
const html = renderMarkdown(content);
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<div
|
|
12
|
+
className="markdown"
|
|
13
|
+
dangerouslySetInnerHTML={{ __html: html }}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Plan } from "../types.ts";
|
|
2
|
+
import { formatDate, formatSize } from "../utils/formatters.ts";
|
|
3
|
+
import { highlightText } from "../utils/strings.ts";
|
|
4
|
+
|
|
5
|
+
interface PlanRowProps {
|
|
6
|
+
plan: Plan;
|
|
7
|
+
selected: boolean;
|
|
8
|
+
searchQuery: string;
|
|
9
|
+
onSelect: (plan: Plan) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function PlanRow({ plan, selected, searchQuery, onSelect }: PlanRowProps) {
|
|
13
|
+
return (
|
|
14
|
+
<tr
|
|
15
|
+
className={selected ? "selected" : ""}
|
|
16
|
+
data-filename={plan.filename}
|
|
17
|
+
onMouseDown={() => onSelect(plan)}
|
|
18
|
+
>
|
|
19
|
+
<td className="title-cell">
|
|
20
|
+
<button
|
|
21
|
+
className="title-btn"
|
|
22
|
+
data-filename={plan.filename}
|
|
23
|
+
title={plan.title}
|
|
24
|
+
dangerouslySetInnerHTML={{
|
|
25
|
+
__html: searchQuery ? highlightText(plan.title, searchQuery) : plan.title,
|
|
26
|
+
}}
|
|
27
|
+
/>
|
|
28
|
+
</td>
|
|
29
|
+
<td className="filename-cell">
|
|
30
|
+
<span
|
|
31
|
+
dangerouslySetInnerHTML={{
|
|
32
|
+
__html: searchQuery ? highlightText(plan.filename, searchQuery) : plan.filename,
|
|
33
|
+
}}
|
|
34
|
+
/>
|
|
35
|
+
</td>
|
|
36
|
+
<td className="project-cell">
|
|
37
|
+
{plan.project ? (
|
|
38
|
+
<span
|
|
39
|
+
dangerouslySetInnerHTML={{
|
|
40
|
+
__html: searchQuery ? highlightText(plan.project, searchQuery) : plan.project,
|
|
41
|
+
}}
|
|
42
|
+
/>
|
|
43
|
+
) : (
|
|
44
|
+
"—"
|
|
45
|
+
)}
|
|
46
|
+
</td>
|
|
47
|
+
<td className="num-cell">{formatSize(plan.size)}</td>
|
|
48
|
+
<td className="num-cell">{plan.lineCount}</td>
|
|
49
|
+
<td className="meta-cell">{formatDate(plan.modified)}</td>
|
|
50
|
+
<td className="meta-cell">{formatDate(plan.created)}</td>
|
|
51
|
+
</tr>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { Plan, SortKey, SortDir } from "../types.ts";
|
|
2
|
+
import { PlanRow } from "./PlanRow.tsx";
|
|
3
|
+
|
|
4
|
+
interface PlansTableProps {
|
|
5
|
+
plans: Plan[];
|
|
6
|
+
selectedPlan: Plan | null;
|
|
7
|
+
searchQuery: string;
|
|
8
|
+
sortKey: SortKey;
|
|
9
|
+
sortDir: SortDir;
|
|
10
|
+
onSelectPlan: (plan: Plan) => void;
|
|
11
|
+
onSort: (key: SortKey) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function PlansTable({
|
|
15
|
+
plans,
|
|
16
|
+
selectedPlan,
|
|
17
|
+
searchQuery,
|
|
18
|
+
sortKey,
|
|
19
|
+
sortDir,
|
|
20
|
+
onSelectPlan,
|
|
21
|
+
onSort,
|
|
22
|
+
}: PlansTableProps) {
|
|
23
|
+
const getSortClass = (key: SortKey) => {
|
|
24
|
+
if (sortKey === key) {
|
|
25
|
+
return `sorted ${sortDir}`;
|
|
26
|
+
}
|
|
27
|
+
return "";
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div className="table-container">
|
|
32
|
+
<table>
|
|
33
|
+
<thead>
|
|
34
|
+
<tr>
|
|
35
|
+
<th
|
|
36
|
+
data-sort="title"
|
|
37
|
+
className={getSortClass("title")}
|
|
38
|
+
onClick={() => onSort("title")}
|
|
39
|
+
>
|
|
40
|
+
Title <span className="sort-icon">▲</span>
|
|
41
|
+
</th>
|
|
42
|
+
<th className="no-sort">Filename</th>
|
|
43
|
+
<th
|
|
44
|
+
data-sort="project"
|
|
45
|
+
className={getSortClass("project")}
|
|
46
|
+
onClick={() => onSort("project")}
|
|
47
|
+
>
|
|
48
|
+
Project <span className="sort-icon">▲</span>
|
|
49
|
+
</th>
|
|
50
|
+
<th
|
|
51
|
+
data-sort="size"
|
|
52
|
+
className={`num-col ${getSortClass("size")}`}
|
|
53
|
+
onClick={() => onSort("size")}
|
|
54
|
+
>
|
|
55
|
+
Size <span className="sort-icon">▲</span>
|
|
56
|
+
</th>
|
|
57
|
+
<th
|
|
58
|
+
data-sort="lines"
|
|
59
|
+
className={`num-col ${getSortClass("lines")}`}
|
|
60
|
+
onClick={() => onSort("lines")}
|
|
61
|
+
>
|
|
62
|
+
Lines <span className="sort-icon">▲</span>
|
|
63
|
+
</th>
|
|
64
|
+
<th
|
|
65
|
+
data-sort="modified"
|
|
66
|
+
className={getSortClass("modified")}
|
|
67
|
+
onClick={() => onSort("modified")}
|
|
68
|
+
>
|
|
69
|
+
Modified <span className="sort-icon">▲</span>
|
|
70
|
+
</th>
|
|
71
|
+
<th
|
|
72
|
+
data-sort="created"
|
|
73
|
+
className={getSortClass("created")}
|
|
74
|
+
onClick={() => onSort("created")}
|
|
75
|
+
>
|
|
76
|
+
Created <span className="sort-icon">▲</span>
|
|
77
|
+
</th>
|
|
78
|
+
</tr>
|
|
79
|
+
</thead>
|
|
80
|
+
<tbody id="plans-table">
|
|
81
|
+
{plans.map((plan) => (
|
|
82
|
+
<PlanRow
|
|
83
|
+
key={plan.filename}
|
|
84
|
+
plan={plan}
|
|
85
|
+
selected={selectedPlan?.filename === plan.filename}
|
|
86
|
+
searchQuery={searchQuery}
|
|
87
|
+
onSelect={onSelectPlan}
|
|
88
|
+
/>
|
|
89
|
+
))}
|
|
90
|
+
</tbody>
|
|
91
|
+
</table>
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import Select, { type MultiValue } from "react-select";
|
|
2
|
+
|
|
3
|
+
interface ProjectFilterProps {
|
|
4
|
+
projects: string[];
|
|
5
|
+
selectedProjects: Set<string>;
|
|
6
|
+
onToggle: (project: string) => void;
|
|
7
|
+
onClear: () => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function ProjectFilter({
|
|
11
|
+
projects,
|
|
12
|
+
selectedProjects,
|
|
13
|
+
onToggle,
|
|
14
|
+
onClear,
|
|
15
|
+
}: ProjectFilterProps) {
|
|
16
|
+
const options = projects.map((p) => ({ value: p, label: p }));
|
|
17
|
+
|
|
18
|
+
const selectedOptions = projects
|
|
19
|
+
.filter((p) => selectedProjects.has(p))
|
|
20
|
+
.map((p) => ({ value: p, label: p }));
|
|
21
|
+
|
|
22
|
+
const handleChange = (
|
|
23
|
+
newValue: MultiValue<{ value: string; label: string }> | null
|
|
24
|
+
) => {
|
|
25
|
+
const selectedSet = new Set(
|
|
26
|
+
(newValue ?? []).map((option) => option.value)
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
projects.forEach((project) => {
|
|
30
|
+
const isSelected = selectedSet.has(project);
|
|
31
|
+
const wasSelected = selectedProjects.has(project);
|
|
32
|
+
if (isSelected !== wasSelected) {
|
|
33
|
+
onToggle(project);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const customStyles = {
|
|
39
|
+
control: (
|
|
40
|
+
base: object,
|
|
41
|
+
state: { isFocused: boolean }
|
|
42
|
+
) => ({
|
|
43
|
+
...base,
|
|
44
|
+
background: "var(--bg-tertiary)",
|
|
45
|
+
border: "1px solid var(--border)",
|
|
46
|
+
borderRadius: "var(--radius-md)",
|
|
47
|
+
minHeight: "28px",
|
|
48
|
+
fontSize: "11px",
|
|
49
|
+
color: "var(--text-secondary)",
|
|
50
|
+
boxShadow: "none",
|
|
51
|
+
cursor: "pointer",
|
|
52
|
+
transition: "border-color 0.15s, box-shadow 0.15s",
|
|
53
|
+
"&:hover": {
|
|
54
|
+
borderColor: "var(--border-light)",
|
|
55
|
+
},
|
|
56
|
+
...(state.isFocused
|
|
57
|
+
? {
|
|
58
|
+
borderColor: "var(--accent)",
|
|
59
|
+
boxShadow: "var(--focus-ring)",
|
|
60
|
+
}
|
|
61
|
+
: {}),
|
|
62
|
+
}),
|
|
63
|
+
placeholder: (base: object) => ({
|
|
64
|
+
...base,
|
|
65
|
+
color: "var(--text-muted)",
|
|
66
|
+
display: "flex",
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
gap: "4px",
|
|
69
|
+
}),
|
|
70
|
+
dropdownIndicator: (base: object) => ({
|
|
71
|
+
...base,
|
|
72
|
+
color: "var(--text-muted)",
|
|
73
|
+
padding: "4px 6px",
|
|
74
|
+
"&:hover": {
|
|
75
|
+
color: "var(--text-secondary)",
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
clearIndicator: (base: object) => ({
|
|
79
|
+
...base,
|
|
80
|
+
color: "var(--text-muted)",
|
|
81
|
+
padding: "4px",
|
|
82
|
+
"&:hover": {
|
|
83
|
+
color: "var(--text-primary)",
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
menu: (base: object) => ({
|
|
87
|
+
...base,
|
|
88
|
+
background: "var(--bg-secondary)",
|
|
89
|
+
border: "1px solid var(--border)",
|
|
90
|
+
borderRadius: "var(--radius-lg)",
|
|
91
|
+
boxShadow: "0 8px 24px rgba(0, 0, 0, 0.4)",
|
|
92
|
+
marginTop: "4px",
|
|
93
|
+
overflow: "hidden",
|
|
94
|
+
zIndex: 60,
|
|
95
|
+
}),
|
|
96
|
+
menuList: (base: object) => ({
|
|
97
|
+
...base,
|
|
98
|
+
padding: "4px",
|
|
99
|
+
maxHeight: "280px",
|
|
100
|
+
}),
|
|
101
|
+
option: (
|
|
102
|
+
base: object,
|
|
103
|
+
state: { isSelected: boolean; isFocused: boolean }
|
|
104
|
+
) => ({
|
|
105
|
+
...base,
|
|
106
|
+
background: state.isSelected
|
|
107
|
+
? "var(--accent-dim)"
|
|
108
|
+
: state.isFocused
|
|
109
|
+
? "var(--bg-hover)"
|
|
110
|
+
: "transparent",
|
|
111
|
+
color: "var(--text-primary)",
|
|
112
|
+
fontSize: "12px",
|
|
113
|
+
cursor: "pointer",
|
|
114
|
+
borderRadius: "var(--radius-sm)",
|
|
115
|
+
padding: "6px 8px",
|
|
116
|
+
margin: "0 2px",
|
|
117
|
+
"&:active": {
|
|
118
|
+
background: "var(--bg-hover)",
|
|
119
|
+
},
|
|
120
|
+
}),
|
|
121
|
+
multiValue: (base: object) => ({
|
|
122
|
+
...base,
|
|
123
|
+
background: "var(--bg-tertiary)",
|
|
124
|
+
border: "1px solid var(--border)",
|
|
125
|
+
borderRadius: "var(--radius-sm)",
|
|
126
|
+
}),
|
|
127
|
+
multiValueLabel: (base: object) => ({
|
|
128
|
+
...base,
|
|
129
|
+
color: "var(--text-primary)",
|
|
130
|
+
fontSize: "10px",
|
|
131
|
+
fontFamily: "ui-monospace, SFMono-Regular, monospace",
|
|
132
|
+
padding: "2px 4px",
|
|
133
|
+
}),
|
|
134
|
+
multiValueRemove: (base: object) => ({
|
|
135
|
+
...base,
|
|
136
|
+
color: "var(--text-muted)",
|
|
137
|
+
padding: "0 2px",
|
|
138
|
+
"&:hover": {
|
|
139
|
+
background: "transparent",
|
|
140
|
+
color: "var(--text-primary)",
|
|
141
|
+
},
|
|
142
|
+
}),
|
|
143
|
+
noOptionsMessage: (base: object) => ({
|
|
144
|
+
...base,
|
|
145
|
+
color: "var(--text-muted)",
|
|
146
|
+
fontSize: "12px",
|
|
147
|
+
}),
|
|
148
|
+
indicatorSeparator: (base: object) => ({
|
|
149
|
+
...base,
|
|
150
|
+
backgroundColor: "var(--border)",
|
|
151
|
+
}),
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const selectedCount = selectedProjects.size;
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<div className="project-select-wrapper">
|
|
158
|
+
<Select
|
|
159
|
+
isMulti
|
|
160
|
+
options={options}
|
|
161
|
+
value={selectedOptions}
|
|
162
|
+
onChange={handleChange}
|
|
163
|
+
styles={customStyles}
|
|
164
|
+
placeholder={
|
|
165
|
+
<span>
|
|
166
|
+
Projects
|
|
167
|
+
{selectedCount > 0 && (
|
|
168
|
+
<span className="project-badge">{selectedCount}</span>
|
|
169
|
+
)}
|
|
170
|
+
</span>
|
|
171
|
+
}
|
|
172
|
+
noOptionsMessage={() => "No projects"}
|
|
173
|
+
isClearable={true}
|
|
174
|
+
closeMenuOnSelect={false}
|
|
175
|
+
hideSelectedOptions={false}
|
|
176
|
+
controlShouldRenderValue={false}
|
|
177
|
+
/>
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
interface SearchInputProps {
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (value: string) => void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function SearchInput({ value, onChange }: SearchInputProps) {
|
|
9
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const handleKeyDown = (e: KeyboardEvent) => {
|
|
13
|
+
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
|
|
14
|
+
e.preventDefault();
|
|
15
|
+
inputRef.current?.focus();
|
|
16
|
+
inputRef.current?.select();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
21
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
22
|
+
}, []);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className="search-wrapper">
|
|
26
|
+
<svg className="search-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
27
|
+
<circle cx="11" cy="11" r="8" />
|
|
28
|
+
<path d="m21 21-4.35-4.35" />
|
|
29
|
+
</svg>
|
|
30
|
+
<input
|
|
31
|
+
ref={inputRef}
|
|
32
|
+
type="text"
|
|
33
|
+
id="search"
|
|
34
|
+
className="search-input"
|
|
35
|
+
placeholder="Search plans..."
|
|
36
|
+
value={value}
|
|
37
|
+
onChange={(e) => onChange(e.target.value)}
|
|
38
|
+
/>
|
|
39
|
+
<span className="search-kbd">⌘K</span>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { Markdown } from "./Markdown.tsx";
|
|
2
|
+
export { PlanRow } from "./PlanRow.tsx";
|
|
3
|
+
export { PlansTable } from "./PlansTable.tsx";
|
|
4
|
+
export { DetailPanel } from "./DetailPanel.tsx";
|
|
5
|
+
export { DetailOverlay } from "./DetailOverlay.tsx";
|
|
6
|
+
export { SearchInput } from "./SearchInput.tsx";
|
|
7
|
+
export { SortDropdown } from "./SortDropdown.tsx";
|
|
8
|
+
export { ProjectFilter } from "./ProjectFilter.tsx";
|
|
9
|
+
export { HelpModal } from "./HelpModal.tsx";
|
|
10
|
+
export { Header } from "./Header.tsx";
|