problem: product layour is shitty

This commit is contained in:
gsovereignty
2024-07-06 14:28:09 +08:00
parent aa2d9a3075
commit 77e513e3f7
2 changed files with 44 additions and 13 deletions

View File

@@ -10,16 +10,47 @@
export let event: NDKEvent; export let event: NDKEvent;
//$page.url.searchParams.get("tab") //$page.url.searchParams.get("tab")
function validate(event: NDKEvent): boolean {
let test = 0;
if (
event.getMatchingTags('name') &&
event.getMatchingTags('name')[0] &&
event.getMatchingTags('name')[0][1]
) {
test++;
}
if (
event.getMatchingTags('description') &&
event.getMatchingTags('description')[0] &&
event.getMatchingTags('description')[0][1]
) {
test++;
}
if (
event.getMatchingTags('cover') &&
event.getMatchingTags('cover')[0] &&
event.getMatchingTags('cover')[0][1]
) {
test++;
}
return test == 3;
}
</script> </script>
<Card.Root class="w-[350px]"> {#if validate(event)}
<Card.Root class="w-[350px] m-2">
<Card.Header> <Card.Header>
<Card.Title>{event.getMatchingTags('name')[0][1]}</Card.Title> <Card.Title>{event.getMatchingTags('name')[0][1]}</Card.Title>
<Card.Description>{getMission(event)}</Card.Description> <Card.Description>{event.getMatchingTags('description')[0][1]}</Card.Description>
</Card.Header> </Card.Header>
<img src={event.getMatchingTags('cover')[0][1]} />
<Card.Content></Card.Content> <Card.Content></Card.Content>
<Card.Footer class="flex justify-between"> <Card.Footer class="flex justify-between">
<Button on:click={()=>{console.log(event.rawEvent())}} variant="outline">Print to Console</Button> <Button
<Button on:click={()=>{goto(`${base}/rockets/${getRocketURL(event)}`)}}>View Full Rocket<ChevronRight class="h-4 w-4" /></Button> on:click={() => {
goto(`${base}/rockets/${getRocketURL(event)}`);
}}>Make Available to Purchase<ChevronRight class="h-4 w-4" /></Button
>
</Card.Footer> </Card.Footer>
</Card.Root> </Card.Root>
{/if}

View File

@@ -79,7 +79,7 @@
]} ]}
/> />
{#if candidateProducts && $candidateProducts} {#if candidateProducts && $candidateProducts}
<Subheading title="Products" /> <Subheading title="Product Candidates" />
<CreateNewProduct rocketEvent={$latestRocketEvent} /> <CreateNewProduct rocketEvent={$latestRocketEvent} />
{#each $candidateProducts as r}<ProductCard event={r} />{/each} {#each $candidateProducts as r}<ProductCard event={r} />{/each}
{/if} {/if}