import { h } from 'preact'; import { ExternalLink, Check } from 'react-feather'; import { useState } from 'preact/hooks'; import http from '../http'; export default function Offer(offer) { const { want: { data: details } } = offer; const [accepted, setAccepted] = useState(offer.status !== 'pending'); async function onClick() { const [error] = await http.postOfferAccept(offer.id); if (error) return false; setAccepted(true); } const classes = `${accepted ? 'accepted' : ''}`; const btnText = accepted ? offer.status : 'Accept'; return (

{details.artists_sort} - {details.title}

{details.year}
{details.formats[0].descriptions.join(' ')}
${offer.total}
) }