flowbook 0.2.12 → 0.2.14
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/package.json
CHANGED
|
@@ -8,6 +8,37 @@ interface FlowViewProps {
|
|
|
8
8
|
export function FlowView({ flow }: FlowViewProps) {
|
|
9
9
|
return (
|
|
10
10
|
<div className="p-8 max-w-5xl mx-auto">
|
|
11
|
+
{/* Title */}
|
|
12
|
+
<h1 className="text-2xl font-bold mb-1" style={{ color: 'var(--fb-text-primary)' }}>
|
|
13
|
+
{flow.title}
|
|
14
|
+
</h1>
|
|
15
|
+
|
|
16
|
+
{/* Description */}
|
|
17
|
+
{flow.description && (
|
|
18
|
+
<p className="text-sm mb-4" style={{ color: 'var(--fb-text-secondary)' }}>
|
|
19
|
+
{flow.description}
|
|
20
|
+
</p>
|
|
21
|
+
)}
|
|
22
|
+
|
|
23
|
+
{/* Tags */}
|
|
24
|
+
{flow.tags.length > 0 && (
|
|
25
|
+
<div className="flex flex-wrap gap-2 mb-6">
|
|
26
|
+
{flow.tags.map((tag) => (
|
|
27
|
+
<span
|
|
28
|
+
key={tag}
|
|
29
|
+
className="px-2 py-0.5 rounded-full text-xs font-medium"
|
|
30
|
+
style={{
|
|
31
|
+
background: 'rgba(99, 102, 241, 0.15)',
|
|
32
|
+
color: '#a5b4fc',
|
|
33
|
+
border: '1px solid rgba(99, 102, 241, 0.25)',
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
{tag}
|
|
37
|
+
</span>
|
|
38
|
+
))}
|
|
39
|
+
</div>
|
|
40
|
+
)}
|
|
41
|
+
|
|
11
42
|
{/* Diagrams */}
|
|
12
43
|
<div className="space-y-6">
|
|
13
44
|
{flow.mermaidBlocks.map((block, i) => (
|
|
@@ -15,18 +15,12 @@ export function Sidebar({ flows, selectedId, onSelect }: SidebarProps) {
|
|
|
15
15
|
if (!map.has(cat)) map.set(cat, []);
|
|
16
16
|
map.get(cat)!.push(flow);
|
|
17
17
|
}
|
|
18
|
+
for (const items of map.values()) {
|
|
19
|
+
items.sort((a, b) => a.order - b.order);
|
|
20
|
+
}
|
|
18
21
|
return Array.from(map.entries()).sort(([a], [b]) => a.localeCompare(b));
|
|
19
22
|
}, [flows]);
|
|
20
23
|
|
|
21
|
-
const selectedFlow = flows.find((f) => f.id === selectedId);
|
|
22
|
-
const selectedCategory = selectedFlow?.category ?? null;
|
|
23
|
-
|
|
24
|
-
function handleCategoryClick(items: FlowEntry[]) {
|
|
25
|
-
if (items.length > 0) {
|
|
26
|
-
onSelect(items[0].id);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
24
|
return (
|
|
31
25
|
<aside
|
|
32
26
|
className="w-64 overflow-y-auto shrink-0 border-r"
|
|
@@ -35,42 +29,43 @@ export function Sidebar({ flows, selectedId, onSelect }: SidebarProps) {
|
|
|
35
29
|
borderColor: 'var(--fb-border)',
|
|
36
30
|
}}
|
|
37
31
|
>
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
32
|
+
<nav className="p-5 space-y-4">
|
|
33
|
+
{categories.map(([category, items]) => (
|
|
34
|
+
<div key={category}>
|
|
35
|
+
<h3
|
|
36
|
+
className="text-xs font-bold uppercase tracking-widest mb-2 px-2"
|
|
37
|
+
style={{ color: 'var(--fb-text-muted)' }}
|
|
38
|
+
>
|
|
39
|
+
{category}
|
|
40
|
+
</h3>
|
|
41
|
+
<div className="space-y-0.5">
|
|
42
|
+
{items.map((flow) => {
|
|
43
|
+
const isActive = selectedId === flow.id;
|
|
44
|
+
return (
|
|
45
|
+
<button
|
|
46
|
+
key={flow.id}
|
|
47
|
+
onClick={() => onSelect(flow.id)}
|
|
48
|
+
className={`w-full text-left px-4 py-2 rounded-lg text-sm transition-colors ${
|
|
49
|
+
isActive ? 'font-medium' : 'hover:bg-white/5'
|
|
50
|
+
}`}
|
|
51
|
+
style={{
|
|
52
|
+
color: isActive ? 'var(--fb-accent-green)' : 'var(--fb-text-secondary)',
|
|
53
|
+
background: isActive ? 'rgba(74, 222, 128, 0.08)' : undefined,
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
{flow.title}
|
|
57
|
+
</button>
|
|
58
|
+
);
|
|
59
|
+
})}
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
))}
|
|
63
|
+
{categories.length === 0 && (
|
|
64
|
+
<p className="text-sm px-2 py-4 text-center" style={{ color: 'var(--fb-text-muted)' }}>
|
|
65
|
+
No flows found
|
|
66
|
+
</p>
|
|
67
|
+
)}
|
|
68
|
+
</nav>
|
|
74
69
|
</aside>
|
|
75
70
|
);
|
|
76
71
|
}
|