flowbook 0.2.13 → 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
|
@@ -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
|
}
|