Skip to content

Commit a00e9b7

Browse files
committed
Move custom duration field to top
1 parent b54847b commit a00e9b7

1 file changed

Lines changed: 29 additions & 23 deletions

File tree

apps/webapp/app/components/runs/v3/SharedFilters.tsx

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -434,29 +434,6 @@ export function TimeDropdown({
434434
Runs created in the last
435435
</Label>
436436
<div className="grid grid-cols-4 gap-2">
437-
{timePeriods.map((p) => (
438-
<Button
439-
key={p.value}
440-
variant="secondary/small"
441-
className={
442-
activeSection === "duration" && p.value === selectedPeriod
443-
? "border-indigo-500 group-hover/button:border-indigo-500"
444-
: undefined
445-
}
446-
onClick={(e) => {
447-
e.preventDefault();
448-
e.stopPropagation();
449-
setActiveSection("duration");
450-
setSelectedPeriod(p.value);
451-
setCustomValue("");
452-
setValidationError(null);
453-
}}
454-
fullWidth
455-
type="button"
456-
>
457-
{p.label}
458-
</Button>
459-
))}
460437
{/* Custom duration row */}
461438
<div
462439
className={cn(
@@ -514,6 +491,35 @@ export function TimeDropdown({
514491
))}
515492
</div>
516493
</div>
494+
{timePeriods.map((p) => {
495+
const parsed = parsePeriodString(p.value);
496+
return (
497+
<Button
498+
key={p.value}
499+
variant="secondary/small"
500+
className={
501+
activeSection === "duration" && p.value === selectedPeriod
502+
? "border-indigo-500 group-hover/button:border-indigo-500"
503+
: undefined
504+
}
505+
onClick={(e) => {
506+
e.preventDefault();
507+
e.stopPropagation();
508+
setActiveSection("duration");
509+
setSelectedPeriod(p.value);
510+
if (parsed) {
511+
setCustomValue(parsed.value.toString());
512+
setCustomUnit(parsed.unit);
513+
}
514+
setValidationError(null);
515+
}}
516+
fullWidth
517+
type="button"
518+
>
519+
{p.label}
520+
</Button>
521+
);
522+
})}
517523
</div>
518524
{validationError && activeSection === "duration" && selectedPeriod === "custom" && (
519525
<p className="mt-1 text-xs text-error">{validationError}</p>

0 commit comments

Comments
 (0)