flowbook 0.2.13 → 0.2.15

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbook",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "flowbook": "dist/cli.js"
@@ -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
- <div className="p-5">
39
- <h2
40
- className="text-xs font-bold uppercase tracking-widest mb-5"
41
- style={{ color: 'var(--fb-text-primary)' }}
42
- >
43
- Categories
44
- </h2>
45
- <nav className="space-y-1">
46
- {categories.map(([category, items]) => {
47
- const isActive = selectedCategory === category;
48
-
49
- return (
50
- <button
51
- key={category}
52
- onClick={() => handleCategoryClick(items)}
53
- className={`w-full text-left px-4 py-2.5 rounded-lg text-sm transition-colors ${
54
- isActive
55
- ? "font-medium"
56
- : "hover:bg-white/5"
57
- }`}
58
- style={{
59
- color: isActive ? 'var(--fb-accent-green)' : 'var(--fb-text-secondary)',
60
- background: isActive ? 'rgba(74, 222, 128, 0.08)' : undefined,
61
- }}
62
- >
63
- {category}
64
- </button>
65
- );
66
- })}
67
- {categories.length === 0 && (
68
- <p className="text-sm px-2 py-4 text-center" style={{ color: 'var(--fb-text-muted)' }}>
69
- No flows found
70
- </p>
71
- )}
72
- </nav>
73
- </div>
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
  }