Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
/**
* Empty-state surface shown when the active session has no messages.
*
* Two modes mirror web (packages/views/chat/components/chat-window.tsx
* `EmptyState`):
*
* - first-time (the workspace has never started a chat) → educate and
* offer conversation starters so the composer is not a blank dead end.
* - returning (at least one prior session exists) → lead with starter
* starters. Tapping prefills the draft so the user can edit before sending.
*
* Copy mirrors the web `chat.json` namespace 1:1. Mobile doesn't have
* i18n yet so the strings are inlined in English — when mobile adopts
* i18n the lookup keys (`empty_state.first_time_title` etc.) are already
* established on the web side, so the migration is a literal
* key-by-key swap.
*/
import { View } from "react-native";
import type { Agent, AgentConversationStarter } from "@multica/core/types";
import { Text } from "@/components/ui/text";
import { Button } from "@/components/ui/button";
import { useT } from "@/lib/i18n";
const FALLBACK_CONVERSATION_STARTER_KEYS = [
{ labelKey: "empty.starter_help_label", promptKey: "empty.starter_help_prompt" },
{ labelKey: "empty.starter_task_label", promptKey: "empty.starter_task_prompt" },
{ labelKey: "empty.starter_action_label", promptKey: "empty.starter_action_prompt" },
] as const;
interface Props {
hasSessions: boolean;
agent: Agent | null;
onPickPrompt: (text: string) => void;
}
export function ChatEmptyState({ hasSessions, agent, onPickPrompt }: Props) {
const { t } = useT("chat");
const title = agent
? t("empty.greeting", { name: agent.name })
: t("empty.no_agent_title");
const configured = (agent?.conversation_starters ?? []).filter(
(item) => item.label.trim() && item.prompt.trim(),
);
const fallbackStarters: AgentConversationStarter[] = FALLBACK_CONVERSATION_STARTER_KEYS.map(
(starter) => ({
label: t(starter.labelKey),
prompt: t(starter.promptKey),
}),
);
const starters = configured.length > 0 ? configured : fallbackStarters;
return (
<View className="flex-1 items-center justify-center px-6 py-8 gap-5">
<View className="items-center gap-1">
<Text className="text-base font-semibold text-foreground text-center">
{title}
</Text>
{agent?.description ? (
<Text className="text-sm text-muted-foreground text-center">
{agent.description}
</Text>
) : null}
{!hasSessions ? (
<Text className="text-sm text-muted-foreground text-center">
{t("empty.examples")}
</Text>
) : null}
</View>
{agent ? (
<View className="w-full max-w-xs gap-2">
{starters.map((item, index) => (
<Button
key={index}
variant="outline"
onPress={() => onPickPrompt(item.prompt)}
className="h-auto justify-start px-3 py-2.5"
accessibilityLabel={item.label}
>
<Text className="text-sm text-foreground">{item.label}</Text>
</Button>
))}
</View>
) : null}
</View>
);
}