@lukstei/dsh-client-kanban 0.0.0-stage → 0.2.2-rc.5.4
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/LICENSE +21 -0
- package/README.md +181 -2
- package/cordis.patch.yml +3 -0
- package/dist/client.js +4089 -0
- package/dist/index.js +461 -0
- package/package.json +135 -3
- package/src/client/InFlightSidebar.tsx +606 -0
- package/src/client/KanbanCard.tsx +195 -0
- package/src/client/KanbanIcon.tsx +25 -0
- package/src/client/KanbanPane.tsx +576 -0
- package/src/client/KanbanPaneStatus.tsx +46 -0
- package/src/client/KanbanSection.tsx +177 -0
- package/src/client/KanbanStatusDot.tsx +14 -0
- package/src/client/KanbanTransitionDropdown.tsx +281 -0
- package/src/client/SessionLinks.tsx +72 -0
- package/src/client/dsh.d.ts +30 -0
- package/src/client/index.tsx +602 -0
- package/src/client/navigation.ts +93 -0
- package/src/client/sidebar-mode.ts +71 -0
- package/src/client/store.ts +811 -0
- package/src/client/styles.ts +1539 -0
- package/src/client/use-kanban.ts +52 -0
- package/src/fold.ts +213 -0
- package/src/index.ts +193 -0
- package/src/search-host.ts +77 -0
- package/src/search.ts +72 -0
- package/src/types.ts +80 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import type { SessionSummary } from "@deepseek-ai/dsh-api-session-controller/client";
|
|
2
|
+
import type { SessionId } from "@deepseek-ai/dsh-session/types";
|
|
3
|
+
import type { KanbanLane } from "../types.ts";
|
|
4
|
+
import { KanbanStatusDot } from "./KanbanStatusDot.tsx";
|
|
5
|
+
import { SessionLinks } from "./SessionLinks.tsx";
|
|
6
|
+
import {
|
|
7
|
+
formatKanbanAlertLabel,
|
|
8
|
+
formatRelativeTime,
|
|
9
|
+
getKanbanSessionTitle,
|
|
10
|
+
getSessionRecency,
|
|
11
|
+
isKanbanTransitionAllowed,
|
|
12
|
+
type KanbanSessionAlert,
|
|
13
|
+
} from "./store.ts";
|
|
14
|
+
|
|
15
|
+
export interface KanbanCardProps {
|
|
16
|
+
readonly session: SessionSummary;
|
|
17
|
+
readonly lane: KanbanLane;
|
|
18
|
+
readonly alert?: KanbanSessionAlert;
|
|
19
|
+
readonly isSelected: boolean;
|
|
20
|
+
readonly onSelect: (id: SessionId) => void;
|
|
21
|
+
readonly onDragStart?: (id: SessionId, lane: KanbanLane) => void;
|
|
22
|
+
readonly onDragEnd?: () => void;
|
|
23
|
+
readonly onTransition?: (
|
|
24
|
+
sessionId: SessionId,
|
|
25
|
+
targetLane: KanbanLane,
|
|
26
|
+
) => void;
|
|
27
|
+
readonly onTogglePin?: (id: SessionId) => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Purpose: Render a draggable Kanban card displaying session status, title/prompt, and runtime badge.
|
|
32
|
+
* Contract:
|
|
33
|
+
* - Inputs: KanbanCardProps containing session data, lane context, selection flag, prompt preview, and callbacks.
|
|
34
|
+
* - Outputs: Rendered JSX element representing the card.
|
|
35
|
+
* - Throws / Errors: Never throws.
|
|
36
|
+
*/
|
|
37
|
+
export function KanbanCard({
|
|
38
|
+
session,
|
|
39
|
+
lane,
|
|
40
|
+
alert,
|
|
41
|
+
isSelected,
|
|
42
|
+
onSelect,
|
|
43
|
+
onDragStart,
|
|
44
|
+
onDragEnd,
|
|
45
|
+
onTransition,
|
|
46
|
+
onTogglePin,
|
|
47
|
+
}: KanbanCardProps) {
|
|
48
|
+
const values = session.projectionValues;
|
|
49
|
+
const record = values === undefined ? undefined : values.kanban;
|
|
50
|
+
const isPinned =
|
|
51
|
+
lane === "done" &&
|
|
52
|
+
record !== undefined &&
|
|
53
|
+
record !== null &&
|
|
54
|
+
record.pinnedAt !== undefined;
|
|
55
|
+
|
|
56
|
+
const alertLabel =
|
|
57
|
+
alert !== undefined ? formatKanbanAlertLabel(alert) : undefined;
|
|
58
|
+
|
|
59
|
+
const handleDragStart = (e: React.DragEvent) => {
|
|
60
|
+
e.dataTransfer.setData("text/plain", session.id);
|
|
61
|
+
e.dataTransfer.effectAllowed = "move";
|
|
62
|
+
if (onDragStart) {
|
|
63
|
+
onDragStart(session.id, lane);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const handleDragEnd = () => {
|
|
68
|
+
if (onDragEnd) {
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
onDragEnd();
|
|
71
|
+
}, 0);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
className={`dsh-kanban-card ${isSelected ? "is-active-session" : ""} ${isPinned ? "is-pinned" : ""} ${alert ? "is-alert" : ""}`}
|
|
78
|
+
draggable
|
|
79
|
+
onDragStart={handleDragStart}
|
|
80
|
+
onDragEnd={handleDragEnd}
|
|
81
|
+
onClick={() => onSelect(session.id)}
|
|
82
|
+
>
|
|
83
|
+
<div className="dsh-kanban-card-header">
|
|
84
|
+
<div className="dsh-kanban-card-title">
|
|
85
|
+
{getKanbanSessionTitle(session)}
|
|
86
|
+
</div>
|
|
87
|
+
{lane === "done" && onTogglePin !== undefined && (
|
|
88
|
+
<button
|
|
89
|
+
type="button"
|
|
90
|
+
className={`dsh-kanban-card-pin-btn ${isPinned ? "is-pinned" : ""}`}
|
|
91
|
+
onClick={(e) => {
|
|
92
|
+
e.stopPropagation();
|
|
93
|
+
onTogglePin(session.id);
|
|
94
|
+
}}
|
|
95
|
+
aria-pressed={isPinned}
|
|
96
|
+
title={isPinned ? "Unpin session" : "Pin session to top"}
|
|
97
|
+
aria-label={isPinned ? "Unpin session" : "Pin session to top"}
|
|
98
|
+
>
|
|
99
|
+
<svg
|
|
100
|
+
width="12"
|
|
101
|
+
height="12"
|
|
102
|
+
viewBox="0 0 16 16"
|
|
103
|
+
fill={isPinned ? "currentColor" : "none"}
|
|
104
|
+
stroke="currentColor"
|
|
105
|
+
strokeWidth="1.5"
|
|
106
|
+
strokeLinecap="round"
|
|
107
|
+
strokeLinejoin="round"
|
|
108
|
+
aria-hidden="true"
|
|
109
|
+
>
|
|
110
|
+
<path d="M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.909-1.414.714-.195-.195.519-1.218.714-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146z" />
|
|
111
|
+
</svg>
|
|
112
|
+
</button>
|
|
113
|
+
)}
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<div className="dsh-kanban-card-footer">
|
|
117
|
+
<div>
|
|
118
|
+
{alert ? (
|
|
119
|
+
<span className="dsh-kanban-badge-alert-pill">
|
|
120
|
+
<KanbanStatusDot state="alert" />
|
|
121
|
+
{alertLabel}
|
|
122
|
+
</span>
|
|
123
|
+
) : session.running || lane === "active" ? (
|
|
124
|
+
<span className="dsh-kanban-badge-running">
|
|
125
|
+
<KanbanStatusDot state="active" />
|
|
126
|
+
Running...
|
|
127
|
+
</span>
|
|
128
|
+
) : (
|
|
129
|
+
<>
|
|
130
|
+
<span>{formatRelativeTime(getSessionRecency(session))}</span>
|
|
131
|
+
{lane === "todo" && !session.blank && (
|
|
132
|
+
<span className="dsh-kanban-badge-hold">On hold</span>
|
|
133
|
+
)}
|
|
134
|
+
</>
|
|
135
|
+
)}
|
|
136
|
+
</div>
|
|
137
|
+
{record !== undefined && record !== null && (
|
|
138
|
+
<SessionLinks links={record.links} />
|
|
139
|
+
)}
|
|
140
|
+
</div>
|
|
141
|
+
{onTransition !== undefined && lane !== "active" && (
|
|
142
|
+
<div className="dsh-kanban-card-mobile-actions">
|
|
143
|
+
{isKanbanTransitionAllowed(lane, "active") && (
|
|
144
|
+
<button
|
|
145
|
+
type="button"
|
|
146
|
+
className="dsh-kanban-btn-mobile-action is-primary"
|
|
147
|
+
onClick={(e) => {
|
|
148
|
+
e.stopPropagation();
|
|
149
|
+
onTransition(session.id, "active");
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
{session.blank ? "Start" : "Resume"}
|
|
153
|
+
</button>
|
|
154
|
+
)}
|
|
155
|
+
{isKanbanTransitionAllowed(lane, "review") && (
|
|
156
|
+
<button
|
|
157
|
+
type="button"
|
|
158
|
+
className="dsh-kanban-btn-mobile-action"
|
|
159
|
+
onClick={(e) => {
|
|
160
|
+
e.stopPropagation();
|
|
161
|
+
onTransition(session.id, "review");
|
|
162
|
+
}}
|
|
163
|
+
>
|
|
164
|
+
Review
|
|
165
|
+
</button>
|
|
166
|
+
)}
|
|
167
|
+
{isKanbanTransitionAllowed(lane, "done") && (
|
|
168
|
+
<button
|
|
169
|
+
type="button"
|
|
170
|
+
className="dsh-kanban-btn-mobile-action is-primary"
|
|
171
|
+
onClick={(e) => {
|
|
172
|
+
e.stopPropagation();
|
|
173
|
+
onTransition(session.id, "done");
|
|
174
|
+
}}
|
|
175
|
+
>
|
|
176
|
+
Done
|
|
177
|
+
</button>
|
|
178
|
+
)}
|
|
179
|
+
{isKanbanTransitionAllowed(lane, "todo") && (
|
|
180
|
+
<button
|
|
181
|
+
type="button"
|
|
182
|
+
className="dsh-kanban-btn-mobile-action"
|
|
183
|
+
onClick={(e) => {
|
|
184
|
+
e.stopPropagation();
|
|
185
|
+
onTransition(session.id, "todo");
|
|
186
|
+
}}
|
|
187
|
+
>
|
|
188
|
+
Hold
|
|
189
|
+
</button>
|
|
190
|
+
)}
|
|
191
|
+
</div>
|
|
192
|
+
)}
|
|
193
|
+
</div>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Navigation and toolbar icon for Kanban. */
|
|
2
|
+
export interface KanbanIconProps {
|
|
3
|
+
size?: number;
|
|
4
|
+
strokeWidth?: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function KanbanIcon({ size = 18, strokeWidth = 1 }: KanbanIconProps) {
|
|
8
|
+
return (
|
|
9
|
+
<svg
|
|
10
|
+
width={size}
|
|
11
|
+
height={size}
|
|
12
|
+
viewBox="0 0 24 24"
|
|
13
|
+
fill="none"
|
|
14
|
+
stroke="currentColor"
|
|
15
|
+
strokeWidth={strokeWidth}
|
|
16
|
+
strokeLinecap="round"
|
|
17
|
+
strokeLinejoin="round"
|
|
18
|
+
aria-hidden="true"
|
|
19
|
+
>
|
|
20
|
+
<rect x="3" y="3" width="18" height="18" rx="2" />
|
|
21
|
+
<line x1="9" y1="3" x2="9" y2="21" />
|
|
22
|
+
<line x1="15" y1="3" x2="15" y2="21" />
|
|
23
|
+
</svg>
|
|
24
|
+
);
|
|
25
|
+
}
|