authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-17 20:19:46-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-17 20:19:46-07:00
log8eb1f6e74869130b7602e0c6b0ab56b7805c0889
treef5caca62030c3de55803362fe13e20726149f3be
parent4aa841a8d45ccd611a809351db0b693faba6ba13
signature Signed by PGP key B5690EEEBB952194

refactor(web): reuse inline settings actions (#12362)


2 files changed, 12 insertions(+), 14 deletions(-)

apps/web/src/components/settings/ExpandableText.tsx+4-4
...@@ -1,3 +1,4 @@...@@ -1,3 +1,4 @@
1import { InlineButton } from "../ui/button";
1import { useId, useState } from "react";2import { useId, useState } from "react";
23
3import { cn } from "../../lib/utils";4import { cn } from "../../lib/utils";
...@@ -33,15 +34,14 @@ export function ExpandableText({...@@ -33,15 +34,14 @@ export function ExpandableText({
33 {text}34 {text}
34 </div>35 </div>
35 {canExpand ? (36 {canExpand ? (
36 <button37 <InlineButton
37 type="button"
38 aria-expanded={expanded}38 aria-expanded={expanded}
39 aria-controls={textId}39 aria-controls={textId}
40 className="cursor-pointer mt-1 text-[11px] font-medium text-foreground/70 underline-offset-2 hover:text-foreground hover:underline"40 className="mt-1 text-[11px] font-medium text-foreground/70 underline-offset-2 hover:text-foreground hover:underline"
41 onClick={() => setExpanded((value) => !value)}41 onClick={() => setExpanded((value) => !value)}
42 >42 >
43 {expanded ? "Show less" : expandLabel}43 {expanded ? "Show less" : expandLabel}
44 </button>44 </InlineButton>
45 ) : null}45 ) : null}
46 </div>46 </div>
47 );47 );
apps/web/src/components/settings/SettingInheritance.tsx+8-10
...@@ -11,7 +11,7 @@ import type { EnvironmentPresentation } from "../../state/environments";...@@ -11,7 +11,7 @@ import type { EnvironmentPresentation } from "../../state/environments";
11import { EnvironmentMachineIcon } from "../EnvironmentMachineIcon";11import { EnvironmentMachineIcon } from "../EnvironmentMachineIcon";
12import { resolveEnvModeLabel } from "../BranchToolbar.logic";12import { resolveEnvModeLabel } from "../BranchToolbar.logic";
13import { PULL_REQUEST_MERGE_METHOD_LABELS } from "../pullRequest/pullRequestDetail.logic";13import { PULL_REQUEST_MERGE_METHOD_LABELS } from "../pullRequest/pullRequestDetail.logic";
14import { Button } from "../ui/button";14import { Button, InlineButton } from "../ui/button";
15import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";15import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
16import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";16import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
17import type { ProjectOverrideEntry, ScopedSettingsTarget } from "./scopedSettings";17import type { ProjectOverrideEntry, ScopedSettingsTarget } from "./scopedSettings";
...@@ -261,13 +261,12 @@ export function SettingInheritance({...@@ -261,13 +261,12 @@ export function SettingInheritance({
261 <div className="flex items-center justify-between gap-3 px-2 text-xs text-muted-foreground">261 <div className="flex items-center justify-between gap-3 px-2 text-xs text-muted-foreground">
262 <span>Overridden by</span>262 <span>Overridden by</span>
263 {onClearOverrides ? (263 {onClearOverrides ? (
264 <button264 <InlineButton
265 type="button"265 className="font-medium text-foreground underline-offset-2 hover:underline"
266 className="cursor-pointer font-medium text-foreground underline-offset-2 hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring"
267 onClick={() => onClearOverrides(overriding)}266 onClick={() => onClearOverrides(overriding)}
268 >267 >
269 Reset {overriding.length === 1 ? "it" : "all"}268 Reset {overriding.length === 1 ? "it" : "all"}
270 </button>269 </InlineButton>
271 ) : null}270 ) : null}
272 </div>271 </div>
273 <ul role="list" className="mt-0.5 text-sm">272 <ul role="list" className="mt-0.5 text-sm">
...@@ -276,13 +275,12 @@ export function SettingInheritance({...@@ -276,13 +275,12 @@ export function SettingInheritance({
276 key={project.projectId}275 key={project.projectId}
277 className="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 px-2 py-1"276 className="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 px-2 py-1"
278 >277 >
279 <button278 <InlineButton
280 type="button"279 className="min-w-0 justify-start text-left text-foreground underline-offset-2 hover:underline"
281 className="min-w-0 cursor-pointer truncate text-left text-foreground underline-offset-2 hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring"
282 onClick={project.open}280 onClick={project.open}
283 >281 >
284 {project.label}282 <span className="truncate">{project.label}</span>
285 </button>283 </InlineButton>
286 <span className="max-w-32 truncate text-muted-foreground tabular-nums">284 <span className="max-w-32 truncate text-muted-foreground tabular-nums">
287 {isProjectScopedSettingKey(key)285 {isProjectScopedSettingKey(key)
288 ? formatValue(key, overrides[project.projectId]?.[key])286 ? formatValue(key, overrides[project.projectId]?.[key])