Skip to content

Commit 2eefa7d

Browse files
committed
refactor: extract runtime status marker helper
1 parent 9130fbf commit 2eefa7d

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

index.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ import { runOAuthBrowserFlow } from "./lib/runtime/oauth-browser-flow.js";
186186
import { applyRuntimePreemptiveQuotaSettings } from "./lib/runtime/preemptive-quota.js";
187187
import { ensureRuntimeRefreshGuardian } from "./lib/runtime/refresh-guardian.js";
188188
import { ensureRuntimeSessionAffinity } from "./lib/runtime/session-affinity.js";
189+
import { getRuntimeStatusMarker } from "./lib/runtime/status-marker.js";
189190
import { showRuntimeToast } from "./lib/runtime/toast.js";
190191
import { applyRuntimeUiOptions } from "./lib/runtime/ui-runtime.js";
191192
import { SessionAffinityStore } from "./lib/session-affinity.js";
@@ -409,16 +410,7 @@ export const OpenAIOAuthPlugin: Plugin = async ({ client }: PluginInput) => {
409410
const getStatusMarker = (
410411
ui: UiRuntimeOptions,
411412
status: "ok" | "warning" | "error",
412-
): string => {
413-
if (!ui.v2Enabled) {
414-
if (status === "ok") return "✓";
415-
if (status === "warning") return "!";
416-
return "✗";
417-
}
418-
if (status === "ok") return ui.theme.glyphs.check;
419-
if (status === "warning") return "!";
420-
return ui.theme.glyphs.cross;
421-
};
413+
): string => getRuntimeStatusMarker(ui, status);
422414

423415
const invalidateAccountManagerCache = (): void => {
424416
cachedAccountManager = null;

lib/runtime/status-marker.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { UiRuntimeOptions } from "../ui/runtime.js";
2+
3+
export function getRuntimeStatusMarker(
4+
ui: UiRuntimeOptions,
5+
status: "ok" | "warning" | "error",
6+
): string {
7+
if (!ui.v2Enabled) {
8+
if (status === "ok") return "✓";
9+
if (status === "warning") return "!";
10+
return "✗";
11+
}
12+
if (status === "ok") return ui.theme.glyphs.check;
13+
if (status === "warning") return "!";
14+
return ui.theme.glyphs.cross;
15+
}

0 commit comments

Comments
 (0)