import { h } from 'preact';
import { useState, useEffect } from 'preact/hooks';
import { connect } from 'unistore/preact'
import http from './../http';
import AcpOffer from './../components/acp.offer';
import { Status } from './../../../api/src/offers';
function Item({ item, ws }) {
const statuses = Object.entries(Status).map(([label, value]) => (
));
function onChange(e) {
console.log(item.id, e.target.value);
}
return (
);
}
function SellerGroup(group) {
return (
{group.username} - {group.seller}
{group.offers.length} offers
Ships: {group.mentionsAustralia && 'AU'} {group.mentionsWorldwide && 'WORLD'}
{group.offers.map(i => )}
)
}
function Home() {
const [offers, setOffers] = useState([]);
useEffect(() => {
async function getOffers() {
const [error, offers] = await http.getOffersAcp();
if (error) return console.error(error);
setOffers(offers);
}
getOffers();
}, []);
if (!offers.length) {
return (
loading...
);
}
return (
{offers.map(SellerGroup)}
);
}
export default Home;