The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 03:37 UTC
| 1 | import type { EnvironmentThreadStatus } from "@t3tools/client-runtime/state/threads"; |
| 2 | import { msg } from "gt-react"; |
| 3 | |
| 4 | import { m, type MessageResolver } from "./i18n/messages"; |
| 5 | |
| 6 | export type ThreadSyncPhase = "loading" | "syncing"; |
| 7 | |
| 8 | export function resolveThreadSyncPhase(input: { |
| 9 | readonly detailExists: boolean; |
| 10 | readonly shellExists: boolean; |
| 11 | readonly status: EnvironmentThreadStatus; |
| 12 | }): ThreadSyncPhase | null { |
| 13 | if (!input.shellExists) { |
| 14 | return null; |
| 15 | } |
| 16 | |
| 17 | switch (input.status) { |
| 18 | case "empty": |
| 19 | case "cached": |
| 20 | case "synchronizing": |
| 21 | return input.detailExists ? "syncing" : "loading"; |
| 22 | case "deleted": |
| 23 | case "live": |
| 24 | return null; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | export function threadSyncLabel(phase: ThreadSyncPhase, resolve: MessageResolver = m): string { |
| 29 | return phase === "loading" |
| 30 | ? resolve(msg("Loading messages...")) |
| 31 | : resolve(msg("Syncing messages...")); |
| 32 | } |