@dilipod/ui 0.4.19 → 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 +30 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/scenarios-manager.tsx +65 -76
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,50 +343,42 @@ 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
348
|
<div className="flex items-center gap-3">
|
|
354
|
-
<div className="w-10 h-10 rounded-
|
|
349
|
+
<div className="w-10 h-10 rounded-lg bg-[var(--cyan)]/10 flex items-center justify-center">
|
|
355
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">
|
|
354
|
+
<h3 className="font-semibold text-[var(--black)]">Scenarios</h3>
|
|
355
|
+
{isComplete && (
|
|
356
|
+
<Badge variant="primary" size="sm">
|
|
357
|
+
<CheckCircle size={12} weight="fill" />
|
|
358
|
+
Complete
|
|
359
|
+
</Badge>
|
|
360
|
+
)}
|
|
361
|
+
</div>
|
|
359
362
|
<p className="text-sm text-muted-foreground">
|
|
360
363
|
{scenarios.length === 0
|
|
361
|
-
? 'Define rules for edge cases
|
|
364
|
+
? 'Define rules for edge cases'
|
|
362
365
|
: `${scenarios.length} scenario${scenarios.length === 1 ? '' : 's'} defined`}
|
|
363
366
|
</p>
|
|
364
367
|
</div>
|
|
365
368
|
</div>
|
|
366
|
-
|
|
367
|
-
{
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
</div>
|
|
372
|
-
)}
|
|
373
|
-
{isExpanded ? (
|
|
374
|
-
<CaretUp size={20} className="text-muted-foreground" />
|
|
375
|
-
) : (
|
|
376
|
-
<CaretDown size={20} className="text-muted-foreground" />
|
|
377
|
-
)}
|
|
378
|
-
</div>
|
|
369
|
+
{isExpanded ? (
|
|
370
|
+
<CaretUp size={20} className="text-muted-foreground" />
|
|
371
|
+
) : (
|
|
372
|
+
<CaretDown size={20} className="text-muted-foreground" />
|
|
373
|
+
)}
|
|
379
374
|
</button>
|
|
380
375
|
|
|
381
376
|
{/* Expandable content */}
|
|
382
377
|
{isExpanded && (
|
|
383
378
|
<>
|
|
384
|
-
{/* Add button */}
|
|
385
|
-
<div className="flex justify-end">
|
|
386
|
-
<Button variant="outline" size="sm" onClick={handleAddClick}>
|
|
387
|
-
<Plus size={16} className="mr-1" />
|
|
388
|
-
Add scenario
|
|
389
|
-
</Button>
|
|
390
|
-
</div>
|
|
391
|
-
|
|
392
379
|
{/* Scenarios list */}
|
|
393
380
|
{scenarios.length > 0 && (
|
|
394
|
-
<div className="
|
|
381
|
+
<div className="px-4">
|
|
395
382
|
{scenarios.map((scenario) => (
|
|
396
383
|
<ScenarioCard
|
|
397
384
|
key={scenario.id}
|
|
@@ -405,10 +392,7 @@ export function ScenariosManager({
|
|
|
405
392
|
|
|
406
393
|
{/* Empty state */}
|
|
407
394
|
{scenarios.length === 0 && (
|
|
408
|
-
<div className="
|
|
409
|
-
<div className="w-12 h-12 rounded-sm bg-muted flex items-center justify-center mx-auto mb-3">
|
|
410
|
-
<Lightning size={24} className="text-muted-foreground" />
|
|
411
|
-
</div>
|
|
395
|
+
<div className="px-4 py-6 text-center">
|
|
412
396
|
<p className="text-sm text-muted-foreground mb-4">
|
|
413
397
|
No scenarios yet. Add rules for how the worker should handle edge cases.
|
|
414
398
|
</p>
|
|
@@ -419,9 +403,19 @@ export function ScenariosManager({
|
|
|
419
403
|
</div>
|
|
420
404
|
)}
|
|
421
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
|
+
|
|
422
416
|
{/* Suggestions */}
|
|
423
417
|
{filteredSuggestions.length > 0 && !isComplete && (
|
|
424
|
-
<div className="pt-2">
|
|
418
|
+
<div className="px-4 pt-2">
|
|
425
419
|
<p className="text-xs text-muted-foreground mb-2">Suggested scenarios:</p>
|
|
426
420
|
<div className="flex flex-wrap gap-2">
|
|
427
421
|
{filteredSuggestions.map((suggestion, index) => (
|
|
@@ -438,16 +432,11 @@ export function ScenariosManager({
|
|
|
438
432
|
|
|
439
433
|
{/* Complete button */}
|
|
440
434
|
{canComplete && (
|
|
441
|
-
<div className="pt-4 border-t border-border">
|
|
442
|
-
<div className="flex items-center justify-between gap-4
|
|
443
|
-
<
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
</p>
|
|
447
|
-
<p className="text-xs text-muted-foreground mt-0.5">
|
|
448
|
-
Mark your scenarios as complete to continue with the onboarding.
|
|
449
|
-
</p>
|
|
450
|
-
</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>
|
|
451
440
|
<Button
|
|
452
441
|
onClick={handleComplete}
|
|
453
442
|
disabled={isCompleting}
|
|
@@ -464,7 +453,7 @@ export function ScenariosManager({
|
|
|
464
453
|
|
|
465
454
|
{/* Complete state - only show when expanded */}
|
|
466
455
|
{isComplete && (
|
|
467
|
-
<div className="
|
|
456
|
+
<div className="px-4 pt-3 mt-2 border-t border-border/50">
|
|
468
457
|
<p className="text-xs text-muted-foreground">
|
|
469
458
|
You can still add or edit scenarios while we build your worker.
|
|
470
459
|
</p>
|