-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Display Collections PoC * Add createCollection Function * Add Collections to Cache * Dialog PoC * Add More Collection Dialogs * Fix Build * Add Delete Collection Button * Update PoC * Update PoC * Update Next.js Redirect Handling * Update Create Server Action Handling Add server action clients that can have different middleware. * Fix Error Handling in Client Hook * Update Types * Add Util Functions * Remove Public References * Update Dependencies * Use Planetscale Serverless
- Loading branch information
Showing
68 changed files
with
2,636 additions
and
979 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
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,76 @@ | ||
import { auth } from '@clerk/nextjs'; | ||
import { Resources } from 'app/resources/Resources/Resources'; | ||
import { Await } from 'components/Await/Await'; | ||
import { Page } from 'components/Page/Page'; | ||
import { Heading, Text } from 'design-system'; | ||
import { getCollectionCached } from 'lib/cache'; | ||
import { SearchParams } from 'lib/types'; | ||
import { DeleteCollectionButton } from '../../../components/Collections/DeleteCollectionButton/DeleteCollectionButton'; | ||
import { UpdateBollectionButton } from '../../../components/Collections/UpdateBollectionButton'; | ||
|
||
interface Props { | ||
params: { | ||
id: string; | ||
}; | ||
searchParams: SearchParams; | ||
} | ||
|
||
const CollectionPage = async ({ params, searchParams }: Props) => { | ||
const { id } = params; | ||
const promise = getCollectionCached(Number(id)); | ||
const { userId } = auth(); | ||
|
||
return ( | ||
<Page searchParams={searchParams}> | ||
<div> | ||
<Heading>Collection Page</Heading> | ||
{userId && ( | ||
<div className="flex flex-col items-start gap-4"> | ||
<UpdateBollectionButton collectionId={Number(id)} /> | ||
<DeleteCollectionButton collectionId={Number(id)} /> | ||
</div> | ||
)} | ||
</div> | ||
<Await promise={promise}> | ||
{(collection) => { | ||
if (!collection) return <div>No collection found</div>; | ||
const isOwnCollection = collection.user?.id === userId; | ||
|
||
return ( | ||
<div className="flex flex-col gap-4"> | ||
<div className="flex flex-col gap-2"> | ||
<Heading>Title: {collection.title}</Heading> | ||
<Text>Description: {collection.description}</Text> | ||
<Text>Username: {collection.user?.username ?? 'anonymos'}</Text> | ||
</div> | ||
{collection.resources.length === 0 ? ( | ||
<div>No resources in collection</div> | ||
) : ( | ||
<div> | ||
Resources: | ||
<ul className="flex flex-col gap-2"> | ||
{collection.resources.map((resource) => { | ||
return ( | ||
<> | ||
<li key={`${resource.id}-${resource.type}`}> | ||
{'title' in resource | ||
? resource.title | ||
: resource.name} | ||
</li> | ||
<div>----------------------------------</div> | ||
</> | ||
); | ||
})} | ||
</ul> | ||
</div> | ||
)} | ||
{isOwnCollection && <Resources searchParams={searchParams} />} | ||
</div> | ||
); | ||
}} | ||
</Await> | ||
</Page> | ||
); | ||
}; | ||
|
||
export default CollectionPage; |
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,46 @@ | ||
import { auth } from '@clerk/nextjs'; | ||
import { Await } from 'components/Await/Await'; | ||
import { Page } from 'components/Page/Page'; | ||
import { Heading, Text } from 'design-system'; | ||
import { getCollectionsCached } from 'lib/cache'; | ||
import { SearchParams } from 'lib/types'; | ||
import Link from 'next/link'; | ||
import { AddCollectionButton } from '../../components/Collections/AddCollectionButton'; | ||
|
||
interface Props { | ||
searchParams: SearchParams; | ||
} | ||
|
||
const CollectionsPage = async ({ searchParams }: Props) => { | ||
const promise = getCollectionsCached(); | ||
const { userId } = auth(); | ||
return ( | ||
<Page searchParams={searchParams}> | ||
<Heading level="2">Collections</Heading> | ||
{userId && <AddCollectionButton />} | ||
<Await promise={promise}> | ||
{(collections) => { | ||
return ( | ||
<ul> | ||
{collections.map(({ id, title, description, user }) => ( | ||
<li key={id}> | ||
<Link | ||
href={`/collections/${id}`} | ||
className="flex flex-col gap-2" | ||
> | ||
<Heading level="3">Title: {title}</Heading> | ||
<Text>Description: {description}</Text> | ||
<Text>Username: {user?.username ?? 'anonymos'}</Text> | ||
</Link> | ||
<div>----------------------------------</div> | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
}} | ||
</Await> | ||
</Page> | ||
); | ||
}; | ||
|
||
export default CollectionsPage; |
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 |
---|---|---|
@@ -1,23 +1,32 @@ | ||
import { Page } from 'components/Page/Page'; | ||
import { allPages } from 'contentlayer/generated'; | ||
import { Heading } from 'design-system'; | ||
import { SearchParams } from 'lib/types'; | ||
import { Metadata } from 'next'; | ||
|
||
export const metadata: Metadata = { | ||
title: 'Imprint', | ||
}; | ||
|
||
const ImprintPage = () => { | ||
interface Props { | ||
searchParams: SearchParams; | ||
} | ||
|
||
const ImprintPage = ({ searchParams }: Props) => { | ||
const content = allPages.find((page) => page.title === 'Imprint'); | ||
return ( | ||
<section className="mx-auto max-w-prose space-y-20"> | ||
<Heading level="1" className="mb-6"> | ||
{content?.title} | ||
</Heading> | ||
<div | ||
className="prose" | ||
dangerouslySetInnerHTML={{ __html: content?.body.html ?? '' }} | ||
/> | ||
</section> | ||
<Page searchParams={searchParams}> | ||
<section className="mx-auto max-w-prose space-y-20"> | ||
<Heading level="1" className="mb-6"> | ||
{content?.title} | ||
</Heading> | ||
<div | ||
className="prose" | ||
dangerouslySetInnerHTML={{ __html: content?.body.html ?? '' }} | ||
/> | ||
</section> | ||
</Page> | ||
); | ||
}; | ||
|
||
export default ImprintPage; |
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
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
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
Oops, something went wrong.
de11c0d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
lcd-resources – ./
lifecentereddesign-net.vercel.app
lcd-resources-git-main-timoclsn.vercel.app
lcd-resources-timoclsn.vercel.app
lifecentereddesign.net