Skip to content

Commit

Permalink
fixing some prices things (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
destinio authored Jan 22, 2025
1 parent ba624f1 commit b5787e3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions resources/js/Components/SaveModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { BaseSyntheticEvent, useState } from 'react';
const wait = () => new Promise((resolve) => setTimeout(resolve, 1000));

export function SaveCardForm({ card }: { card: ICard }) {
console.log(card);
const [type, setType] = useState<CardPriceType>(
() => Object.entries(card.tcgplayer.prices)[0][0] as CardPriceType,
);
Expand Down
8 changes: 7 additions & 1 deletion resources/js/Pages/Sets/Show.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ export default function SetsShowPage({ set }: PageProps<{ set: ISet }>) {
<section className="grid grid-cols-2 gap-4 md:grid-cols-4">
{loading ? <h2>Loading cards...</h2> : null}
{data?.map((card) => {
const hasPrice = !!card.tcgplayer?.prices;

return (
<div key={card.id} className="">
<img src={card.images.small} alt={card.name} />
{!loading ? <SaveModal card={card} /> : null}
{!loading && hasPrice ? (
<SaveModal card={card} />
) : (
<span>No price data</span>
)}
</div>
);
})}
Expand Down
2 changes: 1 addition & 1 deletion resources/js/all-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export interface IOwned {
name: string;
number: string;
pricePaid: number;
prices: IPrice[]; // TODO: Change out for new IPrice
prices: IPrice[];
rarity: string;
rawJson: object; // JSON object, could be any complex structure
seenName: string;
Expand Down

0 comments on commit b5787e3

Please sign in to comment.