"use client"; import { useState } from "react"; import { Card } from "@/components/ui/Card"; import { Button } from "@/components/ui/Button"; import { Input } from "@/components/ui/Input"; import { EmptyState } from "@/components/ui/EmptyState"; const CATEGORIES = [ { key: "food", icon: "🍖", label: "饮食" }, { key: "exercise", icon: "🏃", label: "运动" }, { key: "excretion", icon: "💩", label: "排泄" }, { key: "weight", icon: "⚖️", label: "体重" }, ]; interface LogEntry { id: string; category: string; icon: string; value: string; time: string; } export default function DailyLogPage() { const [logs, setLogs] = useState([]); const [category, setCategory] = useState("food"); const [value, setValue] = useState(""); const addLog = () => { if (!value.trim()) return; const cat = CATEGORIES.find(c => c.key === category)!; setLogs(prev => [{ id: Date.now().toString(), category: cat.key, icon: cat.icon, value, time: new Date().toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" }), }, ...prev]); setValue(""); }; return (

日常记录

记录宠物的饮食、运动、排泄和体重变化

{/* Quick Record */}
{CATEGORIES.map(c => ( ))}
setValue(e.target.value)} onKeyDown={e => e.key === "Enter" && addLog()} />
{/* Log Timeline */}
{logs.length > 0 ? logs.map(log => (
{log.icon} {log.value} {log.time}
)) : }
); }