Repository navigation
fix(web): keep restore names that can't wrap inside their box #4921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 ( | ||
| <ul | ||
| className={cn( | ||
| "-me-[0.25em] list-disc space-y-1.5 overflow-x-clip ps-5 pe-[0.25em] text-sm wrap-anywhere", | ||
| className, | ||
| )} | ||
| > | ||
| {sentences.map((sentence, position) => ( | ||
| <li key={position}>{t("web.admin.backups.restore.plan.sentence", { sentence })}</li> | ||
|
Comment on lines
+60
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clipped plan names cannot be inspected in the summary or review Users cannot distinguish selected plans with the same visible prefix when their names are clipped. Provide an accessible way to reveal the full Prompt for LLMTalk to Kody by mentioning @kody Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction. |
||
| ))} | ||
| </ul> | ||
| ); | ||
| } | ||
|
|
||
| /** Step 2: the whole plan in sentences, what it leaves out, and the button. */ | ||
| export function RestoreReview({ | ||
| set, | ||
|
|
@@ -58,25 +89,27 @@ export function RestoreReview({ | |
| <div className="max-w-[70rem] space-y-5"> | ||
| {plan.map((group) => ( | ||
| <FieldGroup key={group.section} label={group.title}> | ||
| <ul className="list-disc space-y-1.5 py-3.5 ps-5 text-sm wrap-anywhere"> | ||
| {group.sentences.map((sentence, position) => ( | ||
| <li key={position}>{t("web.admin.backups.restore.plan.sentence", { sentence })}</li> | ||
| ))} | ||
| </ul> | ||
| <PlanSentences sentences={group.sentences} className="py-3.5" /> | ||
| </FieldGroup> | ||
| ))} | ||
| {caveats.length > 0 ? ( | ||
| <FieldGroup | ||
| label={t("web.admin.backups.restore.review.leftOut")} | ||
| description={t("web.admin.backups.restore.review.leftOutDescription")} | ||
| > | ||
| <ul className="space-y-2 py-3.5 text-sm wrap-anywhere"> | ||
| {/* Clips a name that can't wrap like PlanSentences, but on both sides: this list | ||
| has no start padding or bullets. The name's title shows it in full. */} | ||
| <ul className="-mx-[0.25em] space-y-2 overflow-x-clip px-[0.25em] py-3.5 text-sm wrap-anywhere"> | ||
| {caveats.map((caveat) => ( | ||
| <li key={caveat.key}> | ||
| {t("web.admin.backups.restore.review.caveat", { | ||
| label: caveat.label, | ||
| text: caveat.text, | ||
| b: (chunks) => <span className="font-medium">{chunks}</span>, | ||
| b: (chunks) => ( | ||
| <span title={caveat.label} className="font-medium"> | ||
| {chunks} | ||
| </span> | ||
| ), | ||
| muted: (chunks) => <span className="text-muted-foreground">{chunks}</span>, | ||
| })} | ||
| </li> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,21 +88,30 @@ function ReportRow({ item }: { item: RestoreReportItem }) { | |
| ? t("web.admin.backups.restore.run.restart") | ||
| : null, | ||
| ].filter((detail): detail is string => Boolean(detail)); | ||
| const label = displayLabel(item); | ||
| return ( | ||
| <li className="border-border/60 flex items-start gap-3 border-b py-3 last:border-b-0"> | ||
| <outcome.Icon aria-hidden="true" className={cn("mt-0.5 size-4 shrink-0", outcome.tone)} /> | ||
| <div className="min-w-0 flex-1"> | ||
| {/* Part of a name that can't wrap, such as one long run of joined emoji, is clipped | ||
| sideways at the row's edge, in the item's line and in its profiles' lines; the words | ||
| around it still wrap. The 0.25em of padding, offset by a negative margin, keeps | ||
| letters whole whose ink reaches past their edge. */} | ||
| <div className="-mx-[0.25em] min-w-0 flex-1 overflow-x-clip px-[0.25em]"> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Report row clipping hides portions of restore diagnostics Users can lose diagnostic details in unbreakable text from Prompt for LLMTalk to Kody by mentioning @kody Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction. |
||
| <p className="text-sm wrap-anywhere"> | ||
| {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 | ||
| // `wrap-anywhere`. (An inline block would let the line break before it, leaving | ||
| // the message's "·" at the end of a line.) <bdi> keeps the direction isolation a | ||
| // string value gets in right-to-left languages. | ||
| outcome: <bdi className="break-keep">{nonBreaking(t(outcome.label))}</bdi>, | ||
| b: (chunks) => <span className="font-medium">{chunks}</span>, | ||
| b: (chunks) => ( | ||
| <span title={label} className="font-medium"> | ||
| {chunks} | ||
| </span> | ||
| ), | ||
| muted: (chunks) => ( | ||
| <span className="text-muted-foreground">{keepSeparatorsWithNext(chunks)}</span> | ||
| ), | ||
|
|
@@ -172,7 +181,7 @@ function AccountReport({ | |
| <span className="me-1.5 font-medium"> | ||
| {/* <bdi> isolates the name's direction. It sits inside the span, so the | ||
| margin follows the page's direction, not the name's. */} | ||
| <bdi>{profile.label}</bdi> | ||
| <bdi title={profile.label}>{profile.label}</bdi> | ||
| </span> | ||
| <wbr /> | ||
| <span className="text-muted-foreground inline-block"> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S1 (P3) — Keep clipped names distinguishable in the restore plan
At a 1024 px viewport with default Text Size, two library names made from 41 joined emoji that differ only in the last emoji render identically in both Choose and Review. In a Chromium fixture using the app CSS, main’s Choose summary could scroll 474 px sideways to reveal the difference. With this change it has zero horizontal scroll, and neither plan displays the differing character. An admin can no longer tell those entries apart by reading the plan before restoring.
Keep the list inside its column and offer a keyboard- and touch-accessible way to read the full name when a line clips. Limit that reveal to clipped names so ordinary sentences don’t gain tooltips.