@dilipod/ui 0.4.20 → 0.4.21
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/dist/components/scenarios-manager.d.ts.map +1 -1
- package/dist/index.js +24 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/scenarios-manager.tsx +58 -71
package/package.json
CHANGED
|
@@ -99,43 +99,38 @@ function ScenarioCard({
|
|
|
99
99
|
const Icon = config.icon
|
|
100
100
|
|
|
101
101
|
return (
|
|
102
|
-
<div className="group relative
|
|
103
|
-
<div className="flex items-start
|
|
104
|
-
<div className=
|
|
105
|
-
<
|
|
106
|
-
<Icon size={18} weight="fill" className={config.color} />
|
|
107
|
-
</div>
|
|
108
|
-
<div className="flex-1 min-w-0">
|
|
109
|
-
<div className="flex items-center gap-2 mb-1.5">
|
|
110
|
-
<Badge variant="outline" size="sm" className="font-medium">{config.label}</Badge>
|
|
111
|
-
</div>
|
|
112
|
-
<p className="text-sm text-[var(--black)]">
|
|
113
|
-
<span className="font-medium">When:</span> {scenario.situation}
|
|
114
|
-
</p>
|
|
115
|
-
<p className="text-sm text-muted-foreground mt-1">
|
|
116
|
-
<span className="text-[var(--black)] font-medium">Action:</span> {scenario.action}
|
|
117
|
-
</p>
|
|
118
|
-
</div>
|
|
102
|
+
<div className="group relative flex items-start justify-between gap-3 py-3 border-b border-border/50 last:border-b-0">
|
|
103
|
+
<div className="flex items-start gap-3 flex-1 min-w-0">
|
|
104
|
+
<div className={cn('w-8 h-8 rounded-full flex items-center justify-center shrink-0', config.bgColor)}>
|
|
105
|
+
<Icon size={16} weight="fill" className={config.color} />
|
|
119
106
|
</div>
|
|
120
|
-
<div className="flex
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
>
|
|
127
|
-
<PencilSimple size={16} />
|
|
128
|
-
</Button>
|
|
129
|
-
<Button
|
|
130
|
-
variant="ghost"
|
|
131
|
-
size="icon"
|
|
132
|
-
className="h-8 w-8 text-muted-foreground hover:text-red-600 hover:bg-red-50"
|
|
133
|
-
onClick={onDelete}
|
|
134
|
-
>
|
|
135
|
-
<Trash size={16} />
|
|
136
|
-
</Button>
|
|
107
|
+
<div className="flex-1 min-w-0 pt-0.5">
|
|
108
|
+
<p className="text-sm text-[var(--black)]">
|
|
109
|
+
<span className="font-medium">When:</span> {scenario.situation}
|
|
110
|
+
</p>
|
|
111
|
+
<p className="text-sm text-muted-foreground mt-0.5">
|
|
112
|
+
<span className="text-[var(--black)] font-medium">Action:</span> {scenario.action}
|
|
113
|
+
</p>
|
|
137
114
|
</div>
|
|
138
115
|
</div>
|
|
116
|
+
<div className="flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity">
|
|
117
|
+
<Button
|
|
118
|
+
variant="ghost"
|
|
119
|
+
size="icon"
|
|
120
|
+
className="h-7 w-7 text-muted-foreground hover:text-[var(--black)]"
|
|
121
|
+
onClick={onEdit}
|
|
122
|
+
>
|
|
123
|
+
<PencilSimple size={14} />
|
|
124
|
+
</Button>
|
|
125
|
+
<Button
|
|
126
|
+
variant="ghost"
|
|
127
|
+
size="icon"
|
|
128
|
+
className="h-7 w-7 text-muted-foreground hover:text-red-600 hover:bg-red-50"
|
|
129
|
+
onClick={onDelete}
|
|
130
|
+
>
|
|
131
|
+
<Trash size={14} />
|
|
132
|
+
</Button>
|
|
133
|
+
</div>
|
|
139
134
|
</div>
|
|
140
135
|
)
|
|
141
136
|
}
|
|
@@ -348,11 +343,11 @@ export function ScenariosManager({
|
|
|
348
343
|
<button
|
|
349
344
|
type="button"
|
|
350
345
|
onClick={() => setIsExpanded(!isExpanded)}
|
|
351
|
-
className="w-full flex items-center justify-between
|
|
346
|
+
className="w-full flex items-center justify-between border border-border/50 px-4 py-3 rounded-lg hover:bg-muted/30 transition-colors"
|
|
352
347
|
>
|
|
353
|
-
<div className="flex items-center gap-
|
|
354
|
-
<div className="w-
|
|
355
|
-
<Lightning size={
|
|
348
|
+
<div className="flex items-center gap-3">
|
|
349
|
+
<div className="w-10 h-10 rounded-lg bg-[var(--cyan)]/10 flex items-center justify-center">
|
|
350
|
+
<Lightning size={20} weight="fill" className="text-[var(--cyan)]" />
|
|
356
351
|
</div>
|
|
357
352
|
<div className="text-left">
|
|
358
353
|
<div className="flex items-center gap-2">
|
|
@@ -366,34 +361,24 @@ export function ScenariosManager({
|
|
|
366
361
|
</div>
|
|
367
362
|
<p className="text-sm text-muted-foreground">
|
|
368
363
|
{scenarios.length === 0
|
|
369
|
-
? 'Define rules for edge cases
|
|
364
|
+
? 'Define rules for edge cases'
|
|
370
365
|
: `${scenarios.length} scenario${scenarios.length === 1 ? '' : 's'} defined`}
|
|
371
366
|
</p>
|
|
372
367
|
</div>
|
|
373
368
|
</div>
|
|
374
|
-
|
|
375
|
-
{
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
)}
|
|
380
|
-
</div>
|
|
369
|
+
{isExpanded ? (
|
|
370
|
+
<CaretUp size={20} className="text-muted-foreground" />
|
|
371
|
+
) : (
|
|
372
|
+
<CaretDown size={20} className="text-muted-foreground" />
|
|
373
|
+
)}
|
|
381
374
|
</button>
|
|
382
375
|
|
|
383
376
|
{/* Expandable content */}
|
|
384
377
|
{isExpanded && (
|
|
385
378
|
<>
|
|
386
|
-
{/* Add button */}
|
|
387
|
-
<div className="flex justify-end">
|
|
388
|
-
<Button variant="outline" size="sm" onClick={handleAddClick}>
|
|
389
|
-
<Plus size={16} className="mr-1" />
|
|
390
|
-
Add scenario
|
|
391
|
-
</Button>
|
|
392
|
-
</div>
|
|
393
|
-
|
|
394
379
|
{/* Scenarios list */}
|
|
395
380
|
{scenarios.length > 0 && (
|
|
396
|
-
<div className="
|
|
381
|
+
<div className="px-4">
|
|
397
382
|
{scenarios.map((scenario) => (
|
|
398
383
|
<ScenarioCard
|
|
399
384
|
key={scenario.id}
|
|
@@ -407,10 +392,7 @@ export function ScenariosManager({
|
|
|
407
392
|
|
|
408
393
|
{/* Empty state */}
|
|
409
394
|
{scenarios.length === 0 && (
|
|
410
|
-
<div className="
|
|
411
|
-
<div className="w-12 h-12 rounded-sm bg-muted flex items-center justify-center mx-auto mb-3">
|
|
412
|
-
<Lightning size={24} className="text-muted-foreground" />
|
|
413
|
-
</div>
|
|
395
|
+
<div className="px-4 py-6 text-center">
|
|
414
396
|
<p className="text-sm text-muted-foreground mb-4">
|
|
415
397
|
No scenarios yet. Add rules for how the worker should handle edge cases.
|
|
416
398
|
</p>
|
|
@@ -421,9 +403,19 @@ export function ScenariosManager({
|
|
|
421
403
|
</div>
|
|
422
404
|
)}
|
|
423
405
|
|
|
406
|
+
{/* Add button - at the end of the list */}
|
|
407
|
+
{scenarios.length > 0 && (
|
|
408
|
+
<div className="px-4 pt-2">
|
|
409
|
+
<Button variant="ghost" size="sm" onClick={handleAddClick} className="text-muted-foreground hover:text-[var(--black)]">
|
|
410
|
+
<Plus size={16} className="mr-1.5" />
|
|
411
|
+
Add scenario
|
|
412
|
+
</Button>
|
|
413
|
+
</div>
|
|
414
|
+
)}
|
|
415
|
+
|
|
424
416
|
{/* Suggestions */}
|
|
425
417
|
{filteredSuggestions.length > 0 && !isComplete && (
|
|
426
|
-
<div className="pt-2">
|
|
418
|
+
<div className="px-4 pt-2">
|
|
427
419
|
<p className="text-xs text-muted-foreground mb-2">Suggested scenarios:</p>
|
|
428
420
|
<div className="flex flex-wrap gap-2">
|
|
429
421
|
{filteredSuggestions.map((suggestion, index) => (
|
|
@@ -440,16 +432,11 @@ export function ScenariosManager({
|
|
|
440
432
|
|
|
441
433
|
{/* Complete button */}
|
|
442
434
|
{canComplete && (
|
|
443
|
-
<div className="pt-4 border-t border-border">
|
|
444
|
-
<div className="flex items-center justify-between gap-4
|
|
445
|
-
<
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
</p>
|
|
449
|
-
<p className="text-xs text-muted-foreground mt-0.5">
|
|
450
|
-
Mark your scenarios as complete to continue with the onboarding.
|
|
451
|
-
</p>
|
|
452
|
-
</div>
|
|
435
|
+
<div className="px-4 pt-4 mt-2 border-t border-border/50">
|
|
436
|
+
<div className="flex items-center justify-between gap-4">
|
|
437
|
+
<p className="text-sm text-muted-foreground">
|
|
438
|
+
Mark your scenarios as complete to continue.
|
|
439
|
+
</p>
|
|
453
440
|
<Button
|
|
454
441
|
onClick={handleComplete}
|
|
455
442
|
disabled={isCompleting}
|
|
@@ -466,7 +453,7 @@ export function ScenariosManager({
|
|
|
466
453
|
|
|
467
454
|
{/* Complete state - only show when expanded */}
|
|
468
455
|
{isComplete && (
|
|
469
|
-
<div className="
|
|
456
|
+
<div className="px-4 pt-3 mt-2 border-t border-border/50">
|
|
470
457
|
<p className="text-xs text-muted-foreground">
|
|
471
458
|
You can still add or edit scenarios while we build your worker.
|
|
472
459
|
</p>
|