Files
orca/mobile/src/components/pr-state-token.ts
T
c9bd61376f feat(mobile): combine PR sidebar and checks parity (#5641)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: gsxdsm <gsxdsm@users.noreply.github.com>
2026-06-17 22:52:12 -07:00

23 lines
913 B
TypeScript

import type { MobileStatusToken } from './pr-sidebar/pr-checks-presentation'
// Single source of truth for mapping a hosted-review PR state to a status-color
// token, shared by the workspace-list linked-PR badge (WorktreeMetaGlyphs) and
// the PR sidebar's state badge (PRSidebarHeader) so the two can't drift.
//
// Palette mirrors the desktop ReviewIcon (worktree-review-helpers.tsx): merged =
// purple, open = green, closed = red, draft/unknown = muted. Provider-agnostic —
// these are generic hosted-review states (GitHub PR, GitLab MR, etc.), accepted
// as a free-form string since the list payload carries a raw state.
export function prStateToken(state: string): MobileStatusToken {
switch (state.toLowerCase()) {
case 'merged':
return 'statusPurple'
case 'open':
return 'statusGreen'
case 'closed':
return 'statusRed'
default:
return 'textSecondary'
}
}