File size: 866 Bytes
90d354b
 
 
 
 
 
 
1
2
3
4
5
6
7
8
import { Link } from 'react-router'
import { ArrowUpRight } from 'lucide-react'
import { itemStateText,stateBadge,templateOf,type WatchItem } from '@/lib/engine'
import { formatTime } from '@/lib/domain'
import { Badge,TemplateIcon } from './Design'
export default function WatchCard({item,compact=false}:{item:WatchItem;compact?:boolean}){const badge=stateBadge(item),t=templateOf(item);return <Link to={'/watch/'+item.id} className={'watch-card '+(compact?'compact':'')}><div className="watch-card-top"><span className={'template-icon template-'+t.icon}><TemplateIcon name={t.icon}/></span><Badge tone={badge.tone}>{badge.text}</Badge></div><h3>{item.name}</h3><p>{itemStateText(item)}</p><div className="watch-card-bottom"><span>{item.camera}<i/>{item.updatedAt?formatTime(item.updatedAt)+' 更新':'尚未取证'}</span><ArrowUpRight size={16}/></div></Link>}