diff --git a/packages/app/src/runtime/extension/titlebar-items.stories.tsx b/packages/app/src/runtime/extension/titlebar-items.stories.tsx new file mode 100644 index 00000000000..dde5b9ebe58 --- /dev/null +++ b/packages/app/src/runtime/extension/titlebar-items.stories.tsx @@ -0,0 +1,58 @@ +import { For } from "solid-js" +import type { TitlebarItem } from "@opencode/gui-extensions/sdk" +import { TitlebarItems } from "./titlebar-items" + +const catalogs = import.meta.glob<{ default: Record }>( + "../../../../gui-extensions/src/updater/i18n/*.ts", + { eager: true }, +) + +const rtl = new Set(["ar", "dv", "fa", "he", "ur"]) + +const locales = Object.entries(catalogs) + .map(([file, module]) => ({ + locale: file.split("/").pop()!.replace(".ts", ""), + label: module.default["status.label"]!, + })) + .sort((a, b) => a.locale.localeCompare(b.locale)) + +const items = (label: string) => { + const item: TitlebarItem = { id: "update", label, run: () => {} } + + return { ids: () => [item.id], item: () => item } +} + +export default { + title: "App/Titlebar/Items", + id: "app-titlebar-items", + component: TitlebarItems, +} + +/** The update pill in every updater locale; hover or focus a pill to expand its label. */ +export const UpdateLabels = { + render: () => ( +
+ + {(entry) => ( +
+ {entry.locale} +
+
+ +
+
+
+ +
+
+ )} +
+
+ ), +} diff --git a/packages/app/src/runtime/extension/titlebar-items.tsx b/packages/app/src/runtime/extension/titlebar-items.tsx index 50e96b3eb1a..650df8ea7cb 100644 --- a/packages/app/src/runtime/extension/titlebar-items.tsx +++ b/packages/app/src/runtime/extension/titlebar-items.tsx @@ -35,7 +35,7 @@ export function TitlebarItems(props: { items: ReturnType ( ) + // The pill grows to fit its label, so translated labels of any length show in full. return (