diff --git a/web/src/pages/admin-backups/RestoreChoose.tsx b/web/src/pages/admin-backups/RestoreChoose.tsx index 8e73ea95bf..73cbe7bb29 100644 --- a/web/src/pages/admin-backups/RestoreChoose.tsx +++ b/web/src/pages/admin-backups/RestoreChoose.tsx @@ -29,6 +29,7 @@ import { SettingFieldStatus } from "@/pages/admin-settings/SettingField"; import { OmittedAccounts } from "./BackupWarningDetails"; import { Disclosure } from "./Disclosure"; +import { PlanSentences } from "./RestoreReview"; import { ItemRow, SameRow, type ToggleKeys } from "./RestoreRows"; import { AccountRow, DataTypesPanel } from "./RestoreUsers"; import { @@ -240,13 +241,20 @@ function LibraryGroupRows({ open={open} onOpenChange={setOpen} controls={listId} - className="text-foreground gap-1.5 text-[13px] font-medium" + className="text-foreground max-w-full gap-1.5 text-[13px] font-medium" > {/* One run of text, so the count follows the name's last word. A name with no spaces still breaks to fit. The name keeps its own direction, so a name in another script can't pull the count across it. The count - is an inline block, so it moves to the next line whole. */} - + is an inline block, so it moves to the next line whole. The button and + the text stay within the row, which clips sideways the part of a name + that can't wrap, such as one long run of joined emoji. The 0.25em of + padding, offset by a negative margin, keeps letters whole whose ink + reaches past their edge. */} + {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx -- a space, not text */} {name}{" "} @@ -669,10 +677,12 @@ export function RestoreChoose({ background playback bar, and for the 6rem of page padding below this grid: without that, the end of the page pushes the panel back up under the control. A longer summary scrolls on its own, above - Review. */} + Review. min-w-0: on a narrow screen the summary shares the sections' + column, so a sentence it can't wrap would otherwise widen every + section past the screen. */}
) : ( -{t("web.admin.backups.restore.choose.recoveryPoint")} diff --git a/web/src/pages/admin-backups/RestoreReview.tsx b/web/src/pages/admin-backups/RestoreReview.tsx index ba0704c072..bfd5e62c92 100644 --- a/web/src/pages/admin-backups/RestoreReview.tsx +++ b/web/src/pages/admin-backups/RestoreReview.tsx @@ -3,6 +3,7 @@ import { Button } from "@/components/ui/button"; import { Checkbox } from "@/components/ui/checkbox"; import { Label } from "@/components/ui/label"; import { useT } from "@/i18n"; +import { cn } from "@/lib/utils"; import { FieldGroup } from "@/pages/admin-settings/FieldGroup"; import { restoreCaveats, restorePlan, type SelectionKeys } from "./restoreModel"; @@ -37,6 +38,36 @@ export interface RestoreReviewProps { */ const REFUSAL_ACTION = "h-auto min-h-8 max-w-full py-1 text-balance whitespace-normal"; +/** + * The plan's sentences as a bulleted list, here and in the Choose step's summary. The part + * of a name that can't wrap, such as one long run of joined emoji, is clipped sideways at + * the list's edge; the words around it still wrap. The clip has 0.25em of padding, offset by + * a negative margin, so letters whose ink reaches past their edge stay whole. It sits on the + * end side only: the start padding already gives that room and holds the bullets, which + * clipping each item would cut off. + */ +export function PlanSentences({ + sentences, + className, +}: { + sentences: readonly string[]; + className?: string; +}) { + const t = useT(); + return ( +
{t("web.admin.backups.restore.run.itemLine", {
- label: displayLabel(item),
+ label,
section: t(SECTION_TITLES[item.section]),
// The status stays whole: no break at its spaces or between its Chinese, Japanese,
// or Korean characters. One wider than the line still breaks, through
@@ -102,7 +107,11 @@ function ReportRow({ item }: { item: RestoreReportItem }) {
// the message's "ยท" at the end of a line.) keeps the direction isolation a
// string value gets in right-to-left languages.
outcome: {nonBreaking(t(outcome.label))},
- b: (chunks) => {chunks},
+ b: (chunks) => (
+
+ {chunks}
+
+ ),
muted: (chunks) => (
{keepSeparatorsWithNext(chunks)}
),
@@ -172,7 +181,7 @@ function AccountReport({
{/* isolates the name's direction. It sits inside the span, so the
margin follows the page's direction, not the name's. */}
- {profile.label}
+ {profile.label}