-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add designer section to show page
This patch adds a designer description to our Prisma schema and uses it to add the designer section to the show page. This patch also includes the corresponding updates to my import scripts. Closes: NC-626 Closes: NC-640
- Loading branch information
1 parent
f705c8f
commit ed19e4f
Showing
7 changed files
with
145 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { useLoaderData } from '@remix-run/react' | ||
|
||
import { Avatar } from 'components/avatar' | ||
import { Empty } from 'components/empty' | ||
import { ExternalLink } from 'components/external-link' | ||
|
||
import { type loader } from './route' | ||
import { Section } from './section' | ||
|
||
export function Designers() { | ||
const show = useLoaderData<typeof loader>() | ||
const designers = show.collections.flatMap((c) => c.designers) | ||
return ( | ||
<Section | ||
header={designers.length === 1 ? 'Designer' : 'Designers'} | ||
id='designers' | ||
> | ||
{designers.length === 0 && ( | ||
<Empty className='mt-2'> | ||
No designers have claimed this show yet. Please check back later. | ||
</Empty> | ||
)} | ||
{designers.length > 0 && ( | ||
<ul className='mt-2 grid gap-2'> | ||
{designers.map((designer) => ( | ||
<li key={designer.id}> | ||
<Avatar src={designer} /> | ||
<h3 className='flex items-center group gap-1'> | ||
{designer.name} | ||
{designer.url != null && ( | ||
<ExternalLink | ||
className='group-hover:opacity-100 opacity-0 transition-opacity text-gray-400 dark:text-gray-600' | ||
href={designer.url} | ||
/> | ||
)} | ||
</h3> | ||
{designer.description != null && ( | ||
<article | ||
className='prose prose-sm dark:prose-invert' | ||
dangerouslySetInnerHTML={{ __html: designer.description }} | ||
/> | ||
)} | ||
{designer.description == null && ( | ||
<Empty> | ||
No designer description to show yet. Please check back later. | ||
</Empty> | ||
)} | ||
</li> | ||
))} | ||
</ul> | ||
)} | ||
</Section> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
prisma/migrations/20230724000908_add_user_descriptions/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "User" ADD COLUMN "description" TEXT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters