fix: use TruncatedText in oauth-selector to prevent line overflow

This commit is contained in:
Mario Zechner 2025-12-02 09:28:27 +01:00
parent 87b7343b00
commit 5a65ce5349
2 changed files with 97 additions and 80 deletions

View file

@ -1,4 +1,4 @@
import { Container, Spacer, Text } from "@mariozechner/pi-tui";
import { Container, Spacer, TruncatedText } from "@mariozechner/pi-tui";
import { getOAuthProviders, type OAuthProviderInfo } from "../oauth/index.js";
import { loadOAuthCredentials } from "../oauth/storage.js";
import { theme } from "../theme/theme.js";
@ -31,7 +31,7 @@ export class OAuthSelectorComponent extends Container {
// Add title
const title = mode === "login" ? "Select provider to login:" : "Select provider to logout:";
this.addChild(new Text(theme.bold(title), 0, 0));
this.addChild(new TruncatedText(theme.bold(title)));
this.addChild(new Spacer(1));
// Create list container
@ -77,14 +77,14 @@ export class OAuthSelectorComponent extends Container {
line = text + statusIndicator;
}
this.listContainer.addChild(new Text(line, 0, 0));
this.listContainer.addChild(new TruncatedText(line, 0, 0));
}
// Show "no providers" if empty
if (this.allProviders.length === 0) {
const message =
this.mode === "login" ? "No OAuth providers available" : "No OAuth providers logged in. Use /login first.";
this.listContainer.addChild(new Text(theme.fg("muted", ` ${message}`), 0, 0));
this.listContainer.addChild(new TruncatedText(theme.fg("muted", ` ${message}`), 0, 0));
}
}