Skip to content

Commit 3aef3c0

Browse files
committed
feat: enhance scenario card interaction with expand/collapse and delete confirmation
1 parent 2ee127a commit 3aef3c0

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

frontend/src/BDDScenariosSection.tsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,18 @@ function ScenarioCard({
136136
className="rounded-xl border border-border/25 bg-card/50 overflow-hidden"
137137
>
138138
{/* Header row */}
139-
<div className="flex items-center gap-2 px-4 py-3 group/scenario">
139+
<div
140+
className="flex items-center gap-2 px-4 py-3 group/scenario cursor-pointer"
141+
onClick={() => setExpanded((x) => !x)}
142+
>
140143
{/* Expand/collapse button */}
141144
<button
142145
type="button"
143146
className="shrink-0 p-0 text-muted-foreground/70 cursor-pointer"
144-
onClick={() => setExpanded((x) => !x)}
147+
onClick={(e) => {
148+
e.stopPropagation();
149+
setExpanded((x) => !x);
150+
}}
145151
aria-expanded={expanded}
146152
aria-label={expanded ? "Collapse scenario" : "Expand scenario"}
147153
>
@@ -175,6 +181,7 @@ function ScenarioCard({
175181
e.currentTarget.blur();
176182
}
177183
}}
184+
onClick={(e) => e.stopPropagation()}
178185
className="flex-1 bg-transparent text-[13px] font-semibold text-foreground outline-none"
179186
/>
180187
) : (
@@ -185,7 +192,8 @@ function ScenarioCard({
185192
"flex-1 text-left text-[13px] font-semibold text-foreground truncate",
186193
canEdit && "hover:cursor-text",
187194
)}
188-
onClick={() => {
195+
onClick={(e) => {
196+
e.stopPropagation();
189197
if (!canEdit) return;
190198
setExpanded(true);
191199
setEditTitle(true);
@@ -202,9 +210,12 @@ function ScenarioCard({
202210
{canEdit && (
203211
<button
204212
type="button"
205-
onClick={() => deleteMut.mutate()}
213+
onClick={(e) => {
214+
e.stopPropagation();
215+
deleteMut.mutate();
216+
}}
206217
disabled={deleteMut.isPending}
207-
className="opacity-0 group-hover/scenario:opacity-100 ml-1 shrink-0 rounded-md p-1 text-muted-foreground/50 hover:text-destructive hover:bg-destructive/10 transition-all duration-150"
218+
className="ml-1 shrink-0 rounded-md p-1 text-muted-foreground/50 hover:text-destructive hover:bg-destructive/5 transition-all duration-150"
208219
aria-label="Delete scenario"
209220
>
210221
<Trash2 className="size-3.5" />

0 commit comments

Comments
 (0)