Skip to content

Commit

Permalink
refactor directory structure and loading states
Browse files Browse the repository at this point in the history
  • Loading branch information
xvvvyz committed Jul 2, 2024
1 parent d668fe5 commit 6ac2efb
Show file tree
Hide file tree
Showing 111 changed files with 31 additions and 54 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 0 additions & 12 deletions app/(pages)/(public)/share/[subjectId]/@modal/(lg)/template.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions app/(pages)/(public)/share/[subjectId]/@modal/(md)/layout.tsx

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions app/(pages)/(public)/share/[subjectId]/@modal/default.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions app/(pages)/(public)/share/[subjectId]/default.tsx

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import { ReactNode } from 'react';

interface LayoutProps {
children: ReactNode;
modal: ReactNode;
}

const Layout = async ({ children, modal }: LayoutProps) => {
const Layout = async ({ children }: LayoutProps) => {
const [{ count }, user] = await Promise.all([
countNotifications(),
getCurrentUser(),
Expand Down Expand Up @@ -67,7 +66,6 @@ const Layout = async ({ children, modal }: LayoutProps) => {
</nav>
)}
{children}
{modal}
</div>
);
};
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ interface LayoutProps {
children: ReactNode;
}

const Template = ({ children }: LayoutProps) => (
const Layout = ({ children }: LayoutProps) => (
<PageModal className="max-w-4xl">{children}</PageModal>
);

export default Template;
export default Layout;
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ interface LayoutProps {
children: ReactNode;
}

const Template = ({ children }: LayoutProps) => (
<PageModal>{children}</PageModal>
);
const Layout = ({ children }: LayoutProps) => <PageModal>{children}</PageModal>;

export default Template;
export default Layout;
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import PageModalLoading from '@/_components/page-modal-loading';

const Loading = PageModalLoading;

export default Loading;
5 changes: 5 additions & 0 deletions app/(pages)/@modal/(md)/templates/create/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import PageModalLoading from '@/_components/page-modal-loading';

const Loading = PageModalLoading;

export default Loading;
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 10 additions & 12 deletions app/(pages)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,8 @@ import { ReactNode } from 'react';
import { twMerge } from 'tailwind-merge';
import '../../tailwind.css';

const figtree = Figtree({ subsets: ['latin'], variable: '--font-body' });

const inconsolata = Inconsolata({
subsets: ['latin'],
variable: '--font-mono',
});

interface LayoutProps {
children: ReactNode;
}
const sans = Figtree({ subsets: ['latin'], variable: '--font-body' });
const mono = Inconsolata({ subsets: ['latin'], variable: '--font-mono' });

export const metadata = {
description:
Expand All @@ -32,10 +24,16 @@ export const viewport: Viewport = {
width: 'device-width',
};

const Layout = ({ children }: LayoutProps) => (
<html className={twMerge(figtree.variable, inconsolata.variable)} lang="en">
interface LayoutProps {
children: ReactNode;
modal: ReactNode;
}

const Layout = ({ children, modal }: LayoutProps) => (
<html className={twMerge(sans.variable, mono.variable)} lang="en">
<body>
{children}
{modal}
<Analytics />
</body>
</html>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ import { ReactNode } from 'react';

interface LayoutProps {
children: ReactNode;
modal: ReactNode;
params: { subjectId: string };
}

const Layout = async ({
children,
modal,
params: { subjectId },
}: LayoutProps) => {
const Layout = async ({ children, params: { subjectId } }: LayoutProps) => {
const [{ data: subject }, user] = await Promise.all([
getSubject(subjectId),
getCurrentUser(),
Expand Down Expand Up @@ -67,7 +62,6 @@ const Layout = async ({
</div>
</div>
<div className="mx-auto max-w-lg pb-20">{children}</div>
{modal}
</>
);
};
Expand Down
5 changes: 5 additions & 0 deletions app/(pages)/share/[subjectId]/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Spinner from '@/_components/spinner';

const Loading = () => <Spinner className="mx-auto my-16" />;

export default Loading;

0 comments on commit 6ac2efb

Please sign in to comment.