Something went wrong. Try again.
Your thinking partner.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687/** * Screen scaffold: token background, safe areas, and the app's standard * header (back affordance, display or compact title, optional status sub-row). * Screens own their headers for full design control — the router chrome is off. */import { router } from "expo-router";import type { ReactNode } from "react";import { StyleSheet, View } from "react-native";import { useSafeAreaInsets } from "react-native-safe-area-context";
import { useTheme } from "../../theme/ThemeProvider";import { space } from "../../theme/tokens";import { Icon } from "./Icon";import { Text } from "./Text";import { Touchable } from "./Touchable";
export function Screen({ children }: { children: ReactNode }) { const { colors } = useTheme(); const insets = useSafeAreaInsets(); return ( <View style={[ styles.root, { backgroundColor: colors.bg, paddingTop: insets.top }, ]} > <View style={styles.canvas}>{children}</View> </View> );}
interface HeaderProps { title: string; /** Large editorial title (list screens) vs compact (chat). */ large?: boolean; /** Sub-row under the title, e.g. agent identity + status. */ subtitle?: ReactNode; back?: boolean; onBack?: () => void; /** Right-side actions. */ trailing?: ReactNode;}
export function Header({ title, large, subtitle, back, onBack, trailing,}: HeaderProps) { return ( <View style={[styles.header, large && styles.headerLarge]}> <View style={styles.headerRow}> {back ? ( <Touchable accessibilityLabel="Back" accessibilityRole="button" onPress={onBack ?? (() => router.back())} style={styles.back} > <Icon name="back" /> </Touchable> ) : null} <View style={styles.titleBlock}> <Text role={large ? "display" : "bodyEm"} numberOfLines={1}> {title} </Text> {subtitle} </View> {trailing ? <View style={styles.trailing}>{trailing}</View> : null} </View> </View> );}
const styles = StyleSheet.create({ root: { flex: 1 }, canvas: { flex: 1, width: "100%", maxWidth: 620, alignSelf: "center" }, header: { paddingHorizontal: space.gutter, paddingVertical: space.md }, headerLarge: { paddingTop: space.lg, paddingBottom: space.lg }, headerRow: { flexDirection: "row", alignItems: "center", gap: space.md }, back: { paddingHorizontal: space.xs, minWidth: 44, alignItems: "center" }, titleBlock: { flex: 1, gap: 2 }, trailing: { flexDirection: "row", alignItems: "center", gap: space.sm },});