Skip to content

Commit 3dcafbd

Browse files
samejrTrigger.dev RepoOps
authored andcommitted
fix(webapp): improve preview branch auto-archive feature UI
Improve preview branch auto-archive feature with clearer fields, optional branch exclusions, and smoother modal transitions. Keep branch creation alongside the search controls while simplifying the empty state. Mono-RevId: 8423e6181629877a7971abc9e52cd6fc578a9613
1 parent 80bbfef commit 3dcafbd

2 files changed

Lines changed: 336 additions & 171 deletions

File tree

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.branches/route.tsx

Lines changed: 59 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,7 @@ export default function Page() {
287287
Branches docs
288288
</LinkButton>
289289
</WhenAgentUnavailable>
290-
291-
{limits.isAtLimit ? (
290+
{!hasBranches && limits.isAtLimit && (
292291
<UpgradePanel
293292
limits={limits}
294293
canUpgrade={canUpgrade ?? false}
@@ -298,46 +297,68 @@ export default function Page() {
298297
maxBranchQuota={maxBranchQuota}
299298
planBranchLimit={planBranchLimit}
300299
/>
301-
) : (
302-
<NewBranchPanel
303-
button={
304-
<Button
305-
variant="primary/small"
306-
shortcut={{ key: "n" }}
307-
LeadingIcon={PlusIcon}
308-
leadingIconClassName="text-white"
309-
fullWidth
310-
textAlignLeft
311-
disabled={!canManageBranches}
312-
tooltip={
313-
canManageBranches ? undefined : "You don't have permission to create branches."
314-
}
315-
>
316-
New branch…
317-
</Button>
318-
}
319-
env="preview"
320-
/>
321300
)}
322301
</PageAccessories>
323302
</NavBar>
324303
<PageBody scrollable={false}>
325-
<div className="grid max-h-full min-h-full grid-rows-[auto_1fr_auto]">
326-
<div className="flex items-center justify-between gap-x-1.5 p-2">
327-
<BranchFilters>
328-
{autoArchiveAvailable && (
329-
<AutoArchiveSettings
330-
environment={branchableEnvironment}
331-
canManage={canManageBranches}
304+
<div
305+
className={cn(
306+
"grid max-h-full min-h-full",
307+
hasBranches ? "grid-rows-[auto_1fr_auto]" : "grid-rows-[1fr]"
308+
)}
309+
>
310+
{hasBranches && (
311+
<div className="flex items-center justify-between gap-x-1.5 p-2">
312+
<BranchFilters>
313+
{autoArchiveAvailable && (
314+
<AutoArchiveSettings
315+
environment={branchableEnvironment}
316+
canManage={canManageBranches}
317+
/>
318+
)}
319+
</BranchFilters>
320+
<div className="flex shrink-0 items-center gap-1.5">
321+
<PaginationControls
322+
currentPage={currentPage}
323+
totalPages={totalPages}
324+
showPageNumbers={false}
332325
/>
333-
)}
334-
</BranchFilters>
335-
<PaginationControls
336-
currentPage={currentPage}
337-
totalPages={totalPages}
338-
showPageNumbers={false}
339-
/>
340-
</div>
326+
{limits.isAtLimit ? (
327+
<UpgradePanel
328+
limits={limits}
329+
canUpgrade={canUpgrade ?? false}
330+
canPurchaseBranches={canPurchaseBranches}
331+
branchPricing={branchPricing}
332+
extraBranches={extraBranches}
333+
maxBranchQuota={maxBranchQuota}
334+
planBranchLimit={planBranchLimit}
335+
/>
336+
) : (
337+
<NewBranchPanel
338+
button={
339+
<Button
340+
variant="primary/small"
341+
shortcut={{ key: "n" }}
342+
LeadingIcon={PlusIcon}
343+
leadingIconClassName="text-white"
344+
fullWidth
345+
textAlignLeft
346+
disabled={!canManageBranches}
347+
tooltip={
348+
canManageBranches
349+
? undefined
350+
: "You don't have permission to create branches."
351+
}
352+
>
353+
New branch…
354+
</Button>
355+
}
356+
env="preview"
357+
/>
358+
)}
359+
</div>
360+
</div>
361+
)}
341362
{!hasBranches ? (
342363
<MainCenteredContainer className="max-w-md">
343364
<BranchesNoBranches
@@ -589,7 +610,7 @@ export function BranchFilters({ children }: { children?: ReactNode }) {
589610
return (
590611
<div className="flex w-full flex-wrap items-center justify-between gap-2">
591612
<SearchInput placeholder="Search branch name…" resetParams={["page"]} />
592-
<div className="ml-auto flex flex-wrap items-center gap-2">
613+
<div className="ml-auto flex flex-wrap items-center gap-1.5">
593614
<Switch
594615
checked={showArchived ?? false}
595616
onCheckedChange={handleArchivedChange}

0 commit comments

Comments
 (0)