import React from 'react';
import { ActivityIndicator, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { colors, statusColor } from './theme';
export function StatusDot({ status }: { status: string }) {
return (
);
}
export function StatusBadge({ status }: { status: string }) {
const c = statusColor[status] ?? colors.textDim;
return (
{status}
);
}
export function Card({ children, style }: { children: React.ReactNode; style?: object }) {
return {children};
}
export function SectionTitle({ children }: { children: React.ReactNode }) {
return {children};
}
export function Empty({ text }: { text: string }) {
return {text};
}
export function ErrorBox({ error }: { error: unknown }) {
const msg = error instanceof Error ? error.message : String(error);
return {msg};
}
export function ActionButton({
label,
onPress,
kind = 'default',
disabled,
}: {
label: string;
onPress: () => void;
kind?: 'default' | 'primary' | 'danger';
disabled?: boolean;
}) {
const bg =
kind === 'primary' ? colors.accent : kind === 'danger' ? colors.err : colors.surfaceAlt;
return (
{label}
);
}
export function Row({
title,
subtitle,
right,
onPress,
}: {
title: string;
subtitle?: string;
right?: React.ReactNode;
onPress?: () => void;
}) {
return (
{title}
{subtitle ? (
{subtitle}
) : null}
{right}
);
}
export function Loading() {
return (
);
}
const styles = StyleSheet.create({
dot: { width: 8, height: 8, borderRadius: 4 },
badge: {
flexDirection: 'row',
alignItems: 'center',
gap: 6,
borderWidth: 1,
borderRadius: 12,
paddingHorizontal: 8,
paddingVertical: 3,
},
badgeText: { fontSize: 11, fontWeight: '600', textTransform: 'uppercase' },
card: {
backgroundColor: colors.surface,
borderRadius: 12,
borderWidth: 1,
borderColor: colors.border,
padding: 14,
marginBottom: 10,
},
section: {
color: colors.textDim,
fontSize: 12,
fontWeight: '700',
textTransform: 'uppercase',
letterSpacing: 1,
marginTop: 14,
marginBottom: 8,
},
empty: { color: colors.textDim, fontSize: 14, paddingVertical: 12 },
err: { color: colors.err, fontSize: 13, paddingVertical: 8 },
btn: {
borderRadius: 8,
paddingVertical: 10,
paddingHorizontal: 14,
alignItems: 'center',
marginRight: 8,
marginBottom: 8,
},
btnText: { color: colors.text, fontWeight: '600', fontSize: 13 },
row: {
flexDirection: 'row',
alignItems: 'center',
paddingVertical: 10,
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: colors.border,
},
rowTitle: { color: colors.text, fontSize: 15, fontWeight: '500' },
rowSub: { color: colors.textDim, fontSize: 12, marginTop: 2 },
center: { flex: 1, alignItems: 'center', justifyContent: 'center' },
});