Orphaned submission fix

This commit is contained in:
MeowcaTheoRange 2024-04-25 16:56:02 -05:00
parent 4d11ac2382
commit 2dbb64b452
2 changed files with 10 additions and 5 deletions

View file

@ -88,12 +88,12 @@ export default async function Home({
<h1>{content.name}</h1>
<p><a href={content.url} target="_blank">{content.url}</a></p>
<ConditionalNull condition={submittedJam != null}>
<p><small>Submitted by <a href={`/jams/user/${contentOwner.id}`}>{`${contentOwner.username}@${contentOwner.instance}`}</a> to <a href={`/jams/jam/${submittedJam.id}?until=${content.submitted}`}>{submittedJam.name}</a> - {new Date(parseInt(content.submitted)).toDateString()}</small></p>
<p><small>Submitted by <a href={`/jams/user/${contentOwner.id}`}>{`${contentOwner.username}@${contentOwner.instance}`}</a> to <a href={`/jams/jam/${submittedJam?.id}?until=${content.submitted}`}>{submittedJam?.name}</a> - {new Date(parseInt(content.submitted)).toDateString()}</small></p>
</ConditionalNull>
<ConditionalNull condition={submittedJam == null}>
<p><small>Submitted by <a href={`/jams/user/${contentOwner.id}`}>{`${contentOwner.username}@${contentOwner.instance}`}</a> {new Date(parseInt(content.submitted)).toDateString()}</small></p>
</ConditionalNull>
<ConditionalNull condition={content.winner}>
<ConditionalNull condition={content.winner && submittedJam != null}>
<p><small><b>WINNER!</b></small></p>
</ConditionalNull>
<p>{content.description}</p>

View file

@ -146,13 +146,18 @@ export default async function Home({
.selectAll()
.executeTakeFirst() as unknown as JSONJamTable;
if (submittedJam == null) return <p>An error occured.</p>;
// if (submittedJam == null) return <p>An error occured.</p>;
return (<div style={{
margin: "16px 0"
}}>
<h2><Link href={`/jams/content/${content.id}`}>{content.name}</Link></h2>
<p><small>Submitted {new Date(parseInt(content.submitted)).toDateString()} to <a href={`/jams/jam/${submittedJam.id}?until=${content.submitted}`}>{submittedJam.name}</a></small></p>
<ConditionalNull condition={submittedJam != null}>
<p><small>Submitted to <a href={`/jams/jam/${submittedJam?.id}?until=${content.submitted}`}>{submittedJam?.name}</a> - {new Date(parseInt(content.submitted)).toDateString()}</small></p>
</ConditionalNull>
<ConditionalNull condition={submittedJam == null}>
<p><small>Submitted on {new Date(parseInt(content.submitted)).toDateString()}</small></p>
</ConditionalNull>
<p>{content.description}</p>
</div>);
})}
@ -187,7 +192,7 @@ export default async function Home({
margin: "16px 0"
}}>
<h2><a href={`/jams/content/${judgement.content_id}?until=${judgement.published}`}>{`${judgementOwner.username}@${judgementOwner.instance}`}</a></h2>
<p><small>Published {new Date(parseInt(judgement.published)).toDateString()} on <a href={`/jams/content/${submittedContent.id}?until=${judgement.published}`}>{submittedContent.name}</a></small></p>
<p><small>Published on {new Date(parseInt(judgement.published)).toDateString()} on <a href={`/jams/content/${submittedContent.id}?until=${judgement.published}`}>{submittedContent.name}</a></small></p>
<p>{judgement.content}</p>
</div>);
})}