From fcf9e70d54bd737d2dea848d25314120f37db503 Mon Sep 17 00:00:00 2001 From: soryu Date: Sun, 18 Jan 2026 02:58:27 +0000 Subject: [WIP] Heartbeat checkpoint - 2026-01-18 02:58:27 UTC --- apps/mobile/components/TaskStatusBadge.tsx | 111 +++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 apps/mobile/components/TaskStatusBadge.tsx (limited to 'apps/mobile/components/TaskStatusBadge.tsx') diff --git a/apps/mobile/components/TaskStatusBadge.tsx b/apps/mobile/components/TaskStatusBadge.tsx new file mode 100644 index 0000000..a1ba9cb --- /dev/null +++ b/apps/mobile/components/TaskStatusBadge.tsx @@ -0,0 +1,111 @@ +import React from 'react'; +import { View, Text, StyleSheet } from 'react-native'; +import { TaskStatusColors } from '../constants/Colors'; +import type { TaskStatus } from '../lib/api'; + +interface TaskStatusBadgeProps { + status: TaskStatus; + showLabel?: boolean; + size?: 'small' | 'medium' | 'large'; +} + +const statusLabels: Record = { + pending: 'Pending', + initializing: 'Initializing', + starting: 'Starting', + running: 'Running', + paused: 'Paused', + blocked: 'Blocked', + done: 'Done', + failed: 'Failed', + merged: 'Merged', +}; + +export function TaskStatusBadge({ + status, + showLabel = false, + size = 'medium', +}: TaskStatusBadgeProps) { + const colors = TaskStatusColors[status] || TaskStatusColors.pending; + + const dotSize = { + small: 8, + medium: 10, + large: 12, + }[size]; + + const fontSize = { + small: 10, + medium: 12, + large: 14, + }[size]; + + const paddingHorizontal = { + small: 6, + medium: 8, + large: 10, + }[size]; + + const paddingVertical = { + small: 2, + medium: 4, + large: 6, + }[size]; + + if (showLabel) { + return ( + + + + {statusLabels[status]} + + + ); + } + + return ( + + ); +} + +const styles = StyleSheet.create({ + badge: { + flexDirection: 'row', + alignItems: 'center', + borderRadius: 999, + gap: 6, + }, + dot: { + borderRadius: 999, + }, + label: { + fontWeight: '500', + }, +}); -- cgit v1.2.3