import React from 'react'; import { themedColor } from '../../theme'; import { Pressable, SafeAreaView, Text, View } from 'react-native'; import { ArrowRight } from 'lucide-react-native'; import { AgentSphereIcon } from '../branding/AgentSphereIcon'; import { styles } from '../../styles'; import { formatRelativeTime } from './timeUtils'; import type { SuperagentAgent, SuperagentHomeScreenViewProps, SuperagentMessage } from '../../types'; export function AgentCard({ agent, latestMessages, currentUserAvatarUrl, onPress, }: { agent: SuperagentAgent; // Accepted for call-site compatibility; no longer shown (meta pills removed). automationCount?: number; connectorCount?: number; latestMessages: SuperagentHomeScreenViewProps['latestMessages']; currentUserAvatarUrl?: string | null; onPress: () => void; }) { const previewMessages = getPreviewMessages(latestMessages); const agentName = agent.name || 'Untitled Agent'; const relativeTime = formatRelativeTime(agent.updatedAt); const activeText = relativeTime ? `Active ${relativeTime}` : 'Active recently'; return ( {/* Agent identity header */} {agentName} {activeText} {/* Message preview — last two messages as chat bubbles */} {previewMessages.length > 0 ? ( {previewMessages.map((message, index) => ( ))} ) : null} {/* Continue button */} [styles.continueButton, pressed && styles.pressed]} > Continue with {agentName} ); } function MessageBubble({ message, agent, agentName, currentUserAvatarUrl, isFirst, }: { message: SuperagentMessage; agent: SuperagentAgent; agentName: string; currentUserAvatarUrl?: string | null; isFirst: boolean; }) { const isUser = message.role === 'user'; return ( {/* Label row */} {!isUser ? : null} {isUser ? 'You' : agentName} {isUser ? : null} {/* Bubble */} {message.content.trim()} ); } export function EmptyState({ onCreateAgent, isCreating, }: { onCreateAgent: () => void; isCreating: boolean; }) { return ( Start with one task Create a Superagent that can remember context, work with tools, and keep moving from your phone. {['Research', 'Sales', 'Support', 'Automations'].map((label) => ( {label} ))} [styles.primaryButton, pressed && styles.pressed]} > {isCreating ? 'Creating...' : 'Create Superagent'} ); } export function RecentAgentCard({ agent, onPress, }: { agent: SuperagentAgent; onPress: () => void; }) { const relativeTime = formatRelativeTime(agent.updatedAt); const updatedText = relativeTime ? `Updated ${relativeTime}` : 'Updated recently'; return ( [styles.recentCard, pressed && styles.pressed]} > {agent.name || 'Untitled Agent'} {updatedText} ); } export function HeaderProfile({ userAvatarUrl }: { userAvatarUrl?: string | null }) { return ( ); } export function CreateAgentButton({ isCreating, onPress, }: { isCreating: boolean; onPress: () => void; }) { return ( Or pressed && styles.pressed} > {isCreating ? 'Creating…' : 'Create a new superagent'} ); } export function PlaceholderPage({ title, body, onBack, }: { title: string; body: string; onBack: () => void; }) { return ( Back {title} {body} ); } // Last two user/assistant messages with content, oldest-first — matches the // web hero, which shows the tail of the conversation as chat bubbles. function getPreviewMessages(messages: SuperagentHomeScreenViewProps['latestMessages']): SuperagentMessage[] { if (!messages?.length) return []; return messages .filter((message) => (message.role === 'user' || message.role === 'assistant') && message.content?.trim()) .slice(-2); }