Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions web/src/pages/admin-settings/ChatGPTConnection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ type LoginAttempt = { id: string; confirmed: boolean };
const DEFAULT_CALLBACK_URI = "http://127.0.0.1:51121/auth/callback";

/**
* A saved account's Reconnect and Disconnect buttons name its email, which can
* be wider than a phone's tile. The label wraps inside the button, breaking the
* email where it must, instead of running past the screen's edge.
* A button whose label can be wider than a phone's tile: a saved account's
* Reconnect and Disconnect name its email, and Retry can be a long translation
* at a large text size. The label wraps inside the button, breaking a long
* word such as an email where it must, instead of running past the screen's
* edge.
*/
const ACCOUNT_ACTION = "h-auto min-h-8 max-w-full py-1 wrap-anywhere whitespace-normal";
const WRAPPING_BUTTON = "h-auto min-h-8 max-w-full py-1 wrap-anywhere whitespace-normal";

/** Which note a saved account carries in the account select. */
function accountState(account: {
Expand Down Expand Up @@ -261,11 +263,16 @@ function ChatGPTConnectionPanel({
{t("web.admin.settings.ai.chatgptConnection.intro")}
</p>
{status.isError ? (
<div className="flex items-center gap-3">
<div className="flex flex-wrap items-center gap-x-3 gap-y-1">
<SettingFieldStatus tone="warn">
{t("web.admin.settings.ai.chatgptConnection.loadFailed")}
</SettingFieldStatus>
<Button size="sm" variant="outline" onClick={() => void status.refetch()}>
<Button
size="sm"
variant="outline"
className={WRAPPING_BUTTON}
onClick={() => void status.refetch()}
>
{t("common.retry")}
</Button>
</div>
Expand Down Expand Up @@ -324,11 +331,16 @@ function ChatGPTConnectionPanel({
disabled={models.isLoading || models.isError || availableModels.length === 0}
/>
{models.isError ? (
<div className="flex items-center gap-3">
<div className="flex flex-wrap items-center gap-x-3 gap-y-1">
<SettingFieldStatus tone="warn">
{t("web.admin.settings.ai.chatgptConnection.modelsFailed")}
</SettingFieldStatus>
<Button size="sm" variant="outline" onClick={() => void models.refetch()}>
<Button
size="sm"
variant="outline"
className={WRAPPING_BUTTON}
onClick={() => void models.refetch()}
>
{t("web.admin.settings.ai.chatgptConnection.retryModels")}
</Button>
</div>
Expand All @@ -353,7 +365,7 @@ function ChatGPTConnectionPanel({
<Button
size="sm"
variant="outline"
className={ACCOUNT_ACTION}
className={WRAPPING_BUTTON}
disabled={start.isPending}
onClick={() => void begin(account.client_id)}
>
Expand All @@ -370,7 +382,7 @@ function ChatGPTConnectionPanel({
<Button
size="sm"
variant="outline"
className={ACCOUNT_ACTION}
className={WRAPPING_BUTTON}
disabled={disconnect.isPending}
onClick={() => void signOut(account.client_id)}
>
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/setup-wizard/steps/SubtitlesStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function ProviderRow({
status = (
<SettingFieldStatus tone="warn">
{/* A live region, so a failed reload's new message is announced. */}
<span role="status" className="min-w-0 [overflow-wrap:anywhere]">
<span role="status">
{draft.loadFailed
? t("web.admin.settings.providers.subtitles.loadFailed")
: t("web.admin.settings.providers.subtitles.saveNotConfirmed")}
Expand Down
Loading