feat(webui): add reading text size preferences (#6325)
* feat(webui): add reading text size preferences * fix(webui): align loading skeletons with reading typography
This commit is contained in:
1 parent
816c9221a0
commit
282839cc65
48 files changed
+662
-120
No files matched your search
@@ -103,7 +103,7 @@ export function SettingsSidebar(props: SettingsSidebarProps) {
|
||||
onClick={onBackToChat}
|
||||
aria-label={t("settings.backToChat")}
|
||||
className={cn(
|
||||
"touch-target mb-2 inline-flex h-9 w-9 items-center justify-center rounded-xl text-[13px] leading-5 font-normal text-sidebar-content transition-colors duration-150 motion-reduce:transition-none focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-ring hover:text-foreground lg:mb-3",
|
||||
"touch-target mb-2 inline-flex h-9 w-9 items-center justify-center rounded-xl text-ui text-sidebar-content transition-colors duration-150 motion-reduce:transition-none focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-ring hover:text-foreground lg:mb-3",
|
||||
hostChromeInset && "-ml-1",
|
||||
)}
|
||||
>
|
||||
@@ -130,7 +130,7 @@ export function SettingsSidebar(props: SettingsSidebarProps) {
|
||||
aria-current={active ? "page" : undefined}
|
||||
onClick={() => onSelectSection(key)}
|
||||
className={cn(
|
||||
"touch-target flex h-9 w-full items-center gap-2 rounded-xl px-2.5 text-left text-[13px] leading-5 font-normal",
|
||||
"touch-target flex h-9 w-full items-center gap-2 rounded-xl px-2.5 text-left text-ui",
|
||||
SIDEBAR_SELECTION_ITEM_CLASS,
|
||||
active
|
||||
? "text-sidebar-accent-foreground"
|
||||
@@ -161,7 +161,7 @@ export function SettingsSidebar(props: SettingsSidebarProps) {
|
||||
onClick={onRestart}
|
||||
disabled={isRestarting}
|
||||
aria-describedby={restartPending ? "settings-restart-status" : undefined}
|
||||
className={cn("h-9 w-full justify-start gap-2 rounded-control px-2.5 text-[13px] leading-5 font-normal settings-hover",
|
||||
className={cn("h-9 w-full justify-start gap-2 rounded-control px-2.5 text-ui settings-hover",
|
||||
restartPending && !isRestarting
|
||||
? "settings-restart-pending text-orange-600 hover:text-orange-700 dark:text-orange-400 dark:hover:text-orange-300"
|
||||
: "text-sidebar-content hover:text-foreground")}
|
||||
@@ -177,7 +177,7 @@ export function SettingsSidebar(props: SettingsSidebarProps) {
|
||||
type="button"
|
||||
variant="ghost"
|
||||
onClick={onLogout}
|
||||
className="hidden h-9 w-full justify-start gap-2 rounded-control px-2.5 text-[13px] leading-5 font-normal text-sidebar-content hover:bg-destructive/8 hover:text-destructive lg:flex"
|
||||
className="hidden h-9 w-full justify-start gap-2 rounded-control px-2.5 text-ui text-sidebar-content hover:bg-destructive/8 hover:text-destructive lg:flex"
|
||||
>
|
||||
<LogOut className="h-4 w-4" aria-hidden />
|
||||
<span>{t("app.account.logout")}</span>
|
||||
|
||||
@@ -50,6 +50,28 @@ export function AppearanceSettingsView({
|
||||
<section>
|
||||
<SettingsSectionTitle>{tx("settings.sections.localPreferences", "Local preferences")}</SettingsSectionTitle>
|
||||
<SettingsGroup>
|
||||
<SettingsRow title={t("settings.rows.readingTextSize")}>
|
||||
<SegmentedControl
|
||||
value={localPrefs.readingTextSize}
|
||||
mode="radio"
|
||||
ariaLabel={t("settings.rows.readingTextSize")}
|
||||
className="w-36 [@media(pointer:coarse)]:w-40"
|
||||
itemClassName="flex flex-1 basis-0 items-center justify-center !overflow-visible px-0 after:absolute after:inset-x-0 after:top-1/2 after:h-11 after:-translate-y-1/2 after:content-['']"
|
||||
options={([
|
||||
["small", "text-[12px]"],
|
||||
["standard", "text-[16px]"],
|
||||
["large", "text-[20px]"],
|
||||
] as const).map(([value, size]) => ({
|
||||
value,
|
||||
label: <span aria-hidden className={size}>A</span>,
|
||||
ariaLabel: t(`settings.readingTextSize.${value}`),
|
||||
tooltip: t(`settings.readingTextSize.${value}`),
|
||||
}))}
|
||||
onChange={(readingTextSize) =>
|
||||
onChangeLocalPrefs((prev) => ({ ...prev, readingTextSize }))
|
||||
}
|
||||
/>
|
||||
</SettingsRow>
|
||||
<SettingsRow title={tx("settings.rows.activityMode", "Activity detail")}>
|
||||
<SegmentedControl
|
||||
value={localPrefs.activityMode}
|
||||
|
||||
@@ -68,7 +68,7 @@ export function NanobotFeatureInstallDialog({
|
||||
className="w-[min(calc(100vw-2rem),24rem)] gap-0 p-5 text-center"
|
||||
>
|
||||
<DialogHeader className="items-center space-y-0 text-center">
|
||||
<DialogTitle className="text-center text-[20px] font-semibold leading-tight tracking-[-0.02em] text-foreground">
|
||||
<DialogTitle className="text-center text-title tracking-[-0.02em] text-foreground">
|
||||
{tx("settings.nanobotFeatures.installConfirmTitle", "Install support for {{name}}?", { name })}
|
||||
</DialogTitle>
|
||||
<DialogDescription className="mt-3 max-w-[20rem] text-center text-[14px] leading-6 text-muted-foreground">
|
||||
@@ -189,7 +189,7 @@ export function RestartRequiredNotice({
|
||||
|
||||
export function SettingsSectionTitle({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<h2 className="settings-section-title select-none text-[13px] font-semibold tracking-[-0.01em] text-foreground/85">
|
||||
<h2 className="settings-section-title select-none text-ui-heading tracking-[-0.01em] text-foreground/85">
|
||||
{children}
|
||||
</h2>
|
||||
);
|
||||
@@ -215,7 +215,7 @@ export function SettingsRow({
|
||||
return (
|
||||
<div className="settings-row rounded-xl transition-colors settings-hover focus-within:bg-sidebar-accent/60">
|
||||
<div className="min-w-0">
|
||||
<div className="select-none text-[14px] font-medium leading-5 text-foreground">
|
||||
<div className="select-none text-control-label text-foreground">
|
||||
{description ? <SettingsHint description={description}>{title}</SettingsHint> : title}
|
||||
</div>
|
||||
</div>
|
||||
@@ -235,7 +235,7 @@ export function ReadOnlyRow({
|
||||
}) {
|
||||
return (
|
||||
<SettingsRow title={title} description={description}>
|
||||
<span className="block max-w-full truncate text-left text-[13px] text-muted-foreground sm:max-w-[320px] sm:text-right">
|
||||
<span className="block max-w-full truncate text-left text-ui text-muted-foreground sm:max-w-[320px] sm:text-right">
|
||||
{value}
|
||||
</span>
|
||||
</SettingsRow>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { SkeletonStatus } from "@/components/settings/shared/SkeletonStatus";
|
||||
import { RUNTIME_CONFIG_FIELDS, RUNTIME_CONFIG_GROUPS, type RuntimeConfigPage } from "@/components/settings/system/runtime-config-fields";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type Control = "switch" | "input" | "duration" | "segments" | "theme" | "edit" | "text" | "feature";
|
||||
type Control = "switch" | "input" | "duration" | "segments" | "reading" | "theme" | "edit" | "text" | "feature";
|
||||
const block = "rounded bg-muted-foreground/20";
|
||||
|
||||
function Title({ heading = false }: { heading?: boolean }) {
|
||||
@@ -22,10 +22,11 @@ function Row({ control }: { control: Control }) {
|
||||
<div className="flex h-5 items-center"><div className={cn(block, "h-3.5 w-32 max-w-full")} /></div>
|
||||
<div className="settings-control">
|
||||
{control === "feature" ? <div className={cn(block, "mr-3 h-3 w-14")} /> : null}
|
||||
{control === "duration" ? <div className="w-full"><div className={cn(block, "h-9 w-full rounded-full")} /><div className="mt-1.5 flex h-4 items-center"><div className={cn(block, "h-2.5 w-4/5 opacity-60")} /></div></div> : <div data-skeleton-switch={toggle ? "" : undefined} className={cn(block,
|
||||
{control === "duration" ? <div className="w-full"><div className={cn(block, "h-9 w-full rounded-full")} /><div className="mt-1.5 flex h-4 items-center"><div className={cn(block, "h-2.5 w-4/5 opacity-60")} /></div></div> : <div data-skeleton-switch={toggle ? "" : undefined} data-skeleton-reading-size={control === "reading" ? "" : undefined} className={cn(block,
|
||||
toggle ? "h-5 w-9 shrink-0 rounded-full" : control === "input" ? "h-9 w-full rounded-full"
|
||||
: control === "segments" || control === "theme" ? "segmented-control w-44 rounded-full" : control === "edit" ? "ml-auto h-9 w-9 rounded-full" : "h-[19.5px] w-24",
|
||||
control === "segments" && "h-[34px]", control === "theme" && "h-8",
|
||||
: control === "segments" || control === "reading" || control === "theme" ? "segmented-control w-44 rounded-full" : control === "edit" ? "ml-auto h-9 w-9 rounded-full" : "h-[1lh] w-24 text-ui",
|
||||
(control === "segments" || control === "reading") && "h-[34px]", control === "theme" && "h-8",
|
||||
control === "reading" && "w-36 [@media(pointer:coarse)]:w-40",
|
||||
)} />}
|
||||
</div>
|
||||
</div>;
|
||||
@@ -52,7 +53,7 @@ export function SettingsSectionSkeleton({ section, showRestart = false }: { sect
|
||||
</>;
|
||||
else switch (section) {
|
||||
case "appearance":
|
||||
content = <><Group controls={["theme", "input"]} /><Group controls={["segments", "segments", "switch", "switch"]} /></>;
|
||||
content = <><Group controls={["theme", "input"]} /><Group controls={["reading", "segments", "segments", "switch", "switch"]} /></>;
|
||||
break;
|
||||
case "notifications":
|
||||
content = <section><Title /><SettingsGroup>
|
||||
|
||||
@@ -82,7 +82,7 @@ export function AutomationRunDialogView({ job, run, locale, open, result, onRetr
|
||||
</Button>
|
||||
</div>
|
||||
) : result.response?.trim() ? (
|
||||
<MarkdownText className="min-w-0 text-sm [overflow-wrap:anywhere]">{result.response}</MarkdownText>
|
||||
<MarkdownText className="min-w-0 [overflow-wrap:anywhere]">{result.response}</MarkdownText>
|
||||
) : (
|
||||
<p className="text-muted-foreground">{t(result.response === null
|
||||
? "settings.automations.runDetails.noOutput"
|
||||
|
||||
Reference in new issue
Block a user