Skip to content

Commit

Permalink
Remove Server Dialog System (#250)
Browse files Browse the repository at this point in the history
* Remove Server Dialog System

* Fix Update Collection Dialog

* Comment Out Collections
  • Loading branch information
timoclsn authored Oct 14, 2023
1 parent 0f66ca2 commit 3eb708f
Show file tree
Hide file tree
Showing 28 changed files with 456 additions and 602 deletions.
12 changes: 3 additions & 9 deletions apps/resources/app/(home)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
import { Page } from 'components/Page/Page';
import { SearchParams } from 'lib/types';
import { NewResources } from '../../components/NewResources/NewResources';
import { Newsletter } from '../../components/Newsletter/Newsletter';
import { About } from './About/About';
import { Header } from './Header/Header';

interface Props {
searchParams: SearchParams;
}

const Home = ({ searchParams }: Props) => {
const Home = () => {
return (
<Page searchParams={searchParams}>
<>
<Header />
<NewResources />
<Newsletter />
<About />
</Page>
</>
);
};

Expand Down
13 changes: 7 additions & 6 deletions apps/resources/app/collections/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
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 { UpdateCollectionDialog } from 'components/Collections/UpdateCollectionDialog/UpdateCollectionDialog';
import { Button, 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: {
Expand All @@ -21,12 +20,14 @@ const CollectionPage = async ({ params, searchParams }: Props) => {
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)} />
<UpdateCollectionDialog collectionId={Number(id)}>
<Button>Update Collection</Button>
</UpdateCollectionDialog>
<DeleteCollectionButton collectionId={Number(id)} />
</div>
)}
Expand Down Expand Up @@ -69,7 +70,7 @@ const CollectionPage = async ({ params, searchParams }: Props) => {
);
}}
</Await>
</Page>
</>
);
};

Expand Down
22 changes: 10 additions & 12 deletions apps/resources/app/collections/page.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
import { auth } from '@clerk/nextjs';
import { Await } from 'components/Await/Await';
import { Page } from 'components/Page/Page';
import { Heading, Text } from 'design-system';
import { AddCollectionDialog } from 'components/Collections/AddCollectionDialog/AddCollectionDialog';
import { Button, 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 CollectionsPage = async () => {
const promise = getCollectionsCached();
const { userId } = auth();
return (
<Page searchParams={searchParams}>
<>
<Heading level="2">Collections</Heading>
{userId && <AddCollectionButton />}
{userId && (
<AddCollectionDialog>
<Button>Add Collection</Button>
</AddCollectionDialog>
)}
<Await promise={promise}>
{(collections) => {
return (
Expand All @@ -39,7 +37,7 @@ const CollectionsPage = async ({ searchParams }: Props) => {
);
}}
</Await>
</Page>
</>
);
};

Expand Down
28 changes: 10 additions & 18 deletions apps/resources/app/imprint/page.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
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',
};

interface Props {
searchParams: SearchParams;
}

const ImprintPage = ({ searchParams }: Props) => {
const ImprintPage = () => {
const content = allPages.find((page) => page.title === 'Imprint');
return (
<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>
<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>
);
};

Expand Down
28 changes: 10 additions & 18 deletions apps/resources/app/privacy/page.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
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: 'Privacy Policy',
};

interface Props {
searchParams: SearchParams;
}

const PrivacyPage = ({ searchParams }: Props) => {
const PrivacyPage = () => {
const content = allPages.find((page) => page.title === 'Privacy');
return (
<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>
<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>
);
};

Expand Down
58 changes: 25 additions & 33 deletions apps/resources/app/profile/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,37 @@ import {
SignedOut,
UserProfile,
} from '@clerk/nextjs';
import { Page } from 'components/Page/Page';
import { Heading } from 'design-system';
import { SearchParams } from 'lib/types';
import { DeleteAccountButton } from './DeleteAccountButton';

interface Props {
searchParams: SearchParams;
}

const ProfilePage = ({ searchParams }: Props) => {
const ProfilePage = () => {
return (
<Page searchParams={searchParams}>
<section className="mx-auto max-w-4xl">
<Heading level="1" className="mb-8">
Profile
</Heading>
<SignedIn>
<section className="mx-auto max-w-4xl">
<Heading level="1" className="mb-8">
Profile
</Heading>
<SignedIn>
<div className="flex flex-col items-center justify-center gap-10">
<UserProfile
appearance={{
variables: {
colorPrimary: '#101b2c',
borderRadius: 'none',
},
elements: {
card: 'shadow-none',
},
}}
/>
<div className="flex flex-col items-center justify-center gap-10">
<UserProfile
appearance={{
variables: {
colorPrimary: '#101b2c',
borderRadius: 'none',
},
elements: {
card: 'shadow-none',
},
}}
/>
<div className="flex flex-col items-center justify-center gap-10">
<DeleteAccountButton />
</div>
<DeleteAccountButton />
</div>
</SignedIn>
<SignedOut>
<RedirectToSignIn />
</SignedOut>
</section>
</Page>
</div>
</SignedIn>
<SignedOut>
<RedirectToSignIn />
</SignedOut>
</section>
);
};

Expand Down
9 changes: 3 additions & 6 deletions apps/resources/app/resources/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Page } from 'components/Page/Page';
import { SearchParams } from 'lib/types';
import { Comments } from '../../../components/Comments/Comments';
import { NewResources } from '../../../components/NewResources/NewResources';
import { Newsletter } from '../../../components/Newsletter/Newsletter';
Expand Down Expand Up @@ -57,21 +55,20 @@ interface Props {
params: {
slug: string;
};
searchParams: SearchParams;
}

const ResourcePage = async ({ params, searchParams }: Props) => {
const ResourcePage = async ({ params }: Props) => {
const { slug } = params;
const { resourceId, resourceType } = parseResourceSlug(slug);

return (
<Page searchParams={searchParams}>
<>
<ResourceCard resourceId={resourceId} resourceType={resourceType} />
<Comments resourceId={resourceId} resourceType={resourceType} />
<RelatedResources resourceId={resourceId} resourceType={resourceType} />
<NewResources />
<Newsletter />
</Page>
</>
);
};

Expand Down
5 changes: 2 additions & 3 deletions apps/resources/app/resources/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Page } from 'components/Page/Page';
import { SearchParams } from 'lib/types';
import { Metadata } from 'next';
import { Resources } from './Resources/Resources';
Expand All @@ -14,10 +13,10 @@ interface Props {

const ResourcesPage = ({ searchParams }: Props) => {
return (
<Page searchParams={searchParams}>
<>
<Resources searchParams={searchParams} />
<Suggestion />
</Page>
</>
);
};

Expand Down
66 changes: 29 additions & 37 deletions apps/resources/app/sign-in/[[...sign-in]]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,36 @@
import { SignIn } from '@clerk/nextjs';
import { Page } from 'components/Page/Page';
import { Heading } from 'design-system';
import { SearchParams } from 'lib/types';

interface Props {
searchParams: SearchParams;
}

const SignInPage = ({ searchParams }: Props) => {
const SignInPage = () => {
return (
<Page searchParams={searchParams}>
<section className="mx-auto max-w-lg">
<Heading level="1" className="mb-8">
Sign in
</Heading>
<div className="flex items-center justify-center">
<SignIn
path="/sign-in"
routing="path"
signUpUrl="/sign-up"
appearance={{
layout: {
privacyPageUrl: '/privacy',
socialButtonsPlacement: 'bottom',
socialButtonsVariant: 'blockButton',
},
variables: {
colorPrimary: '#101b2c',
borderRadius: 'none',
},
elements: {
headerTitle: 'hidden',
headerSubtitle: 'hidden',
card: 'shadow-none',
},
}}
/>
</div>
</section>
</Page>
<section className="mx-auto max-w-lg">
<Heading level="1" className="mb-8">
Sign in
</Heading>
<div className="flex items-center justify-center">
<SignIn
path="/sign-in"
routing="path"
signUpUrl="/sign-up"
appearance={{
layout: {
privacyPageUrl: '/privacy',
socialButtonsPlacement: 'bottom',
socialButtonsVariant: 'blockButton',
},
variables: {
colorPrimary: '#101b2c',
borderRadius: 'none',
},
elements: {
headerTitle: 'hidden',
headerSubtitle: 'hidden',
card: 'shadow-none',
},
}}
/>
</div>
</section>
);
};

Expand Down
Loading

1 comment on commit 3eb708f

@vercel
Copy link

@vercel vercel bot commented on 3eb708f Oct 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.