diff --git a/api/src/events.ts b/api/src/events.ts index 1a47f9f..81c9744 100644 --- a/api/src/events.ts +++ b/api/src/events.ts @@ -65,13 +65,13 @@ export default function createEvents(log: Log, pg: Pg, discogs, offers) { log.info({ event: Events.ListingsUpdated, bundles: bundles.length }); for (const bundle of bundles) { - log.info({ seller: bundle.seller, items: bundle.items.length }, 'generating offers...'); + log.debug({ seller: bundle.seller, items: bundle.items.length }, 'generating offers...'); const listingIds = bundle.items.map(i => i.id); const updatedOffers = await offers.generate(listingIds, 100, 30) - log.info({ offers: updatedOffers.length }, 'offers set'); + log.debug({ offers: updatedOffers.length }, 'offers set'); } - log.info('offers up to date'); + log.trace('offers up to date'); }); events.on(Events.Connection, async function onConnection({ ws, id }) { diff --git a/api/src/offers.ts b/api/src/offers.ts index c7b7034..c9fba86 100644 --- a/api/src/offers.ts +++ b/api/src/offers.ts @@ -22,7 +22,7 @@ function sortOffers(o) { export default function createOffers(log: Log, pg: Pg) { async function generate(listingIds: DiscogsListing[], bulkShipping: number, baseShipping: number) { - log.info('generateOffers', { listingIds, bulkShipping, baseShipping }); + log.debug('generateOffers', { listingIds, bulkShipping, baseShipping }); const listings = await pg.listingByIds(listingIds); // log.info({ listings }, 'creating offers for listings') diff --git a/api/src/pg.ts b/api/src/pg.ts index 7708426..c8a436f 100644 --- a/api/src/pg.ts +++ b/api/src/pg.ts @@ -59,9 +59,10 @@ export default function createPg(log: Log, prisma: PrismaClient): Pg { include: { want: true, }, - orderBy: { - total: 'asc', - }, + orderBy: [ + { total: 'asc' }, + { listingId: 'asc' }, + ], }); } diff --git a/client/src/components/want.offers.tsx b/client/src/components/want.offers.tsx index 75c85cb..88b9da8 100644 --- a/client/src/components/want.offers.tsx +++ b/client/src/components/want.offers.tsx @@ -26,7 +26,8 @@ function OfferLine(offer) { return (
- ${offer.total} +
${offer.total}
+
{offer.condition}
{negBtn}
@@ -54,17 +55,19 @@ function OfferPriceBtn(offer) { } -export default function WantOffers(wantOffers) { +export default function WantOffers(wantOffers, i) { const ws = useSelector((state: State) => state.ws); const details = wantOffers[0].want.data; return ( -
+

{details.artists_sort} - {details.title}

-
{details.year}
-
{details.formats.map(f => f.descriptions.join(' ')).join(' ')}
+
+ {details.year} - {details.formats.map(f => f.descriptions.join(' ')).join(' ')} +
+
Status: {wantOffers[0].status}
diff --git a/client/src/routes/offers.tsx b/client/src/routes/offers.tsx index d9396df..ce379b3 100644 --- a/client/src/routes/offers.tsx +++ b/client/src/routes/offers.tsx @@ -14,7 +14,7 @@ function Home() { const groups = Object.values(offers); - if (!groups.length) { + if (offers && !groups.length) { route('/search'); } diff --git a/client/src/style/index.less b/client/src/style/index.less index f62c3af..07b5f75 100644 --- a/client/src/style/index.less +++ b/client/src/style/index.less @@ -403,6 +403,14 @@ header { margin: var(--spacing-half); background: var(--background-1); + .details { + font-size: var(--small-font-size); + } + + .status { + margin-top: var(--spacing-half); + } + section { grid-area: details; }