refactor(ui): replace middle-dot separators with clearer hierarchy (#6087)
* refactor(ui): replace middle-dot separators with clearer hierarchy * refactor(ui): use layout instead of punctuation separators
This commit is contained in:
1 parent
d6ddceed99
commit
7cb396788c
82 files changed
+433
-462
No files matched your search
@@ -344,10 +344,9 @@ export function ModelIdPicker({
|
||||
{model.label ?? model.id}
|
||||
</span>
|
||||
{model.description || (model.label && model.label !== model.id) ? (
|
||||
<span className="mt-0.5 block truncate text-[10.5px] text-muted-foreground">
|
||||
{[model.label && model.label !== model.id ? model.id : null, model.description]
|
||||
.filter(Boolean)
|
||||
.join(" · ")}
|
||||
<span className="mt-0.5 flex min-w-0 flex-wrap gap-x-2 text-[10.5px] text-muted-foreground">
|
||||
{model.label && model.label !== model.id ? <span className="truncate font-mono">{model.id}</span> : null}{" "}
|
||||
{model.description ? <span className="truncate">{model.description}</span> : null}
|
||||
</span>
|
||||
) : null}
|
||||
</span>
|
||||
|
||||
@@ -23,15 +23,15 @@ export function TimezonePicker({ value, onChange, ...triggerProps }: {
|
||||
.formatToParts(now).find((part) => part.type === "timeZoneName")?.value ?? zone;
|
||||
const offset = new Intl.DateTimeFormat("en", { timeZone: zone, timeZoneName: "longOffset" })
|
||||
.formatToParts(now).find((part) => part.type === "timeZoneName")?.value ?? "";
|
||||
return { zone, detail: `${name} · ${offset.replace("GMT", "UTC")}` };
|
||||
return { zone, detail: name, offset: offset.replace("GMT", "UTC") };
|
||||
} catch {
|
||||
// Keep a server-supported timezone visible even if this browser cannot format it.
|
||||
return { zone, detail: zone };
|
||||
return { zone, detail: zone, offset: "" };
|
||||
}
|
||||
});
|
||||
}, [i18n.language, value]);
|
||||
const filtered = options.filter(({ zone, detail }) =>
|
||||
`${zone.replaceAll("_", " ")} ${zone} ${detail}`.toLocaleLowerCase(i18n.language)
|
||||
const filtered = options.filter(({ zone, detail, offset }) =>
|
||||
`${zone.replaceAll("_", " ")} ${zone} ${detail} ${offset}`.toLocaleLowerCase(i18n.language)
|
||||
.includes(query.trim().toLocaleLowerCase(i18n.language)));
|
||||
const select = (zone: string) => { onChange(zone); setOpen(false); };
|
||||
const navigation = useComboboxNavigation({
|
||||
@@ -52,10 +52,12 @@ export function TimezonePicker({ value, onChange, ...triggerProps }: {
|
||||
aria-label={t("sidebar.searchAria")} placeholder={t("sidebar.searchPlaceholder")}
|
||||
className="mb-1.5 h-9 rounded-full" />
|
||||
<div {...navigation.listProps} aria-label={triggerProps["aria-label"]} className="max-h-64 overflow-y-auto">
|
||||
{filtered.map(({ zone, detail }) => (
|
||||
{filtered.map(({ zone, detail, offset }) => (
|
||||
<ComboboxOption key={zone} {...navigation.getOptionProps(zone)} className="block">
|
||||
<span className="block">{zone}</span>
|
||||
<span className="block text-xs text-muted-foreground">{detail}</span>
|
||||
<span className="flex flex-wrap gap-x-2 text-xs text-muted-foreground">
|
||||
<span>{detail}</span>{" "}<span className="tabular-nums">{offset}</span>
|
||||
</span>
|
||||
</ComboboxOption>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user