From 86eac95a7ef92b6c771acd4b77654411e86be1e7 Mon Sep 17 00:00:00 2001 From: Dominik Stumpf Date: Wed, 20 Nov 2024 01:05:19 +0100 Subject: [PATCH] refactor: restructure files --- src/{app => }/actions/auth.ts | 2 +- src/app/explorer/components/GuildCard.tsx | 4 ++-- src/app/layout.tsx | 10 +++++----- src/{app => }/components/AuthBoundary.tsx | 0 src/{app => }/components/Header.tsx | 0 src/components/Providers.tsx | 2 +- src/{app => }/components/SignInButton.tsx | 2 +- src/{app => }/components/SignInDialog.tsx | 4 ++-- src/{app => }/components/SignOutButton.tsx | 2 +- src/{app => }/components/ui/Badge.tsx | 0 src/{app => }/components/ui/Button.tsx | 0 src/{app => }/components/ui/Card.tsx | 0 src/{app => }/components/ui/Dialog.tsx | 0 src/{app => }/components/ui/Drawer.tsx | 0 src/{app => }/components/ui/ResponsiveDialog.tsx | 0 src/{app => }/components/ui/ScrollArea.tsx | 0 src/{app => }/config/atoms.ts | 0 src/{app => }/config/constants.ts | 0 src/{app => }/config/wagmi.ts | 0 src/{ => lib}/fonts.ts | 8 ++++---- src/stories/Badge.stories.tsx | 2 +- src/stories/Button.stories.tsx | 2 +- src/stories/Dialog.stories.tsx | 4 ++-- src/stories/Drawer.stories.tsx | 6 +++--- src/stories/ResponsiveDialog.stories.tsx | 8 ++++---- src/{app => styles}/globals.css | 0 tsconfig.json | 2 +- 27 files changed, 29 insertions(+), 29 deletions(-) rename src/{app => }/actions/auth.ts (95%) rename src/{app => }/components/AuthBoundary.tsx (100%) rename src/{app => }/components/Header.tsx (100%) rename src/{app => }/components/SignInButton.tsx (90%) rename src/{app => }/components/SignInDialog.tsx (97%) rename src/{app => }/components/SignOutButton.tsx (90%) rename src/{app => }/components/ui/Badge.tsx (100%) rename src/{app => }/components/ui/Button.tsx (100%) rename src/{app => }/components/ui/Card.tsx (100%) rename src/{app => }/components/ui/Dialog.tsx (100%) rename src/{app => }/components/ui/Drawer.tsx (100%) rename src/{app => }/components/ui/ResponsiveDialog.tsx (100%) rename src/{app => }/components/ui/ScrollArea.tsx (100%) rename src/{app => }/config/atoms.ts (100%) rename src/{app => }/config/constants.ts (100%) rename src/{app => }/config/wagmi.ts (100%) rename src/{ => lib}/fonts.ts (77%) rename src/{app => styles}/globals.css (100%) diff --git a/src/app/actions/auth.ts b/src/actions/auth.ts similarity index 95% rename from src/app/actions/auth.ts rename to src/actions/auth.ts index fdd580ded3..5d051667c1 100644 --- a/src/app/actions/auth.ts +++ b/src/actions/auth.ts @@ -1,6 +1,6 @@ "use server"; -import { GUILD_AUTH_COOKIE_NAME } from "app/config/constants"; +import { GUILD_AUTH_COOKIE_NAME } from "@/config/constants"; import { cookies } from "next/headers"; import { redirect } from "next/navigation"; import { z } from "zod"; diff --git a/src/app/explorer/components/GuildCard.tsx b/src/app/explorer/components/GuildCard.tsx index e3116259fc..c2fc6d246d 100644 --- a/src/app/explorer/components/GuildCard.tsx +++ b/src/app/explorer/components/GuildCard.tsx @@ -1,6 +1,6 @@ +import { Badge } from "@/components/ui/Badge"; +import { Card } from "@/components/ui/Card"; import { ImageSquare, Users } from "@phosphor-icons/react/dist/ssr"; -import { Badge } from "app/components/ui/Badge"; -import { Card } from "app/components/ui/Card"; import Link from "next/link"; export const GuildCard = () => { diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 85ba30e47e..646f617485 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,10 +1,10 @@ import type { Metadata } from "next"; -import "./globals.css"; -import { Providers } from "components/Providers"; -import { dystopian, inter } from "fonts"; +import "@/styles/globals.css"; +import { Header } from "@/components/Header"; +import { Providers } from "@/components/Providers"; +import { SignInDialog } from "@/components/SignInDialog"; +import { dystopian, inter } from "@/lib/fonts"; import { cn } from "lib/cssUtils"; -import { Header } from "./components/Header"; -import { SignInDialog } from "./components/SignInDialog"; export const metadata: Metadata = { title: "Guildhall", diff --git a/src/app/components/AuthBoundary.tsx b/src/components/AuthBoundary.tsx similarity index 100% rename from src/app/components/AuthBoundary.tsx rename to src/components/AuthBoundary.tsx diff --git a/src/app/components/Header.tsx b/src/components/Header.tsx similarity index 100% rename from src/app/components/Header.tsx rename to src/components/Header.tsx diff --git a/src/components/Providers.tsx b/src/components/Providers.tsx index bb04febc46..33f57d07d9 100644 --- a/src/components/Providers.tsx +++ b/src/components/Providers.tsx @@ -1,7 +1,7 @@ "use client"; +import { wagmiConfig } from "@/config/wagmi"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { wagmiConfig } from "app/config/wagmi"; import { ThemeProvider } from "next-themes"; import type { FunctionComponent, PropsWithChildren } from "react"; import { WagmiProvider } from "wagmi"; diff --git a/src/app/components/SignInButton.tsx b/src/components/SignInButton.tsx similarity index 90% rename from src/app/components/SignInButton.tsx rename to src/components/SignInButton.tsx index 2bb021d294..639ec1ef45 100644 --- a/src/app/components/SignInButton.tsx +++ b/src/components/SignInButton.tsx @@ -1,7 +1,7 @@ "use client"; +import { signInDialogOpenAtom } from "@/config/atoms"; import { SignIn } from "@phosphor-icons/react/dist/ssr"; -import { signInDialogOpenAtom } from "app/config/atoms"; import { useSetAtom } from "jotai"; import { Button } from "./ui/Button"; import { Card } from "./ui/Card"; diff --git a/src/app/components/SignInDialog.tsx b/src/components/SignInDialog.tsx similarity index 97% rename from src/app/components/SignInDialog.tsx rename to src/components/SignInDialog.tsx index f147c72b4d..9ea2448a6b 100644 --- a/src/app/components/SignInDialog.tsx +++ b/src/components/SignInDialog.tsx @@ -1,9 +1,9 @@ "use client"; +import { signIn } from "@/actions/auth"; +import { signInDialogOpenAtom } from "@/config/atoms"; import { SignIn, User, Wallet } from "@phosphor-icons/react/dist/ssr"; import { useMutation } from "@tanstack/react-query"; -import { signIn } from "app/actions/auth"; -import { signInDialogOpenAtom } from "app/config/atoms"; import { useAtom, useSetAtom } from "jotai"; import { shortenHex } from "lib/shortenHex"; import { createSiweMessage } from "viem/siwe"; diff --git a/src/app/components/SignOutButton.tsx b/src/components/SignOutButton.tsx similarity index 90% rename from src/app/components/SignOutButton.tsx rename to src/components/SignOutButton.tsx index 3a8addaf51..137724e1ca 100644 --- a/src/app/components/SignOutButton.tsx +++ b/src/components/SignOutButton.tsx @@ -1,7 +1,7 @@ "use client"; +import { signOut } from "@/actions/auth"; import { SignOut } from "@phosphor-icons/react/dist/ssr"; -import { signOut } from "app/actions/auth"; import { usePathname } from "next/navigation"; import { Button } from "./ui/Button"; diff --git a/src/app/components/ui/Badge.tsx b/src/components/ui/Badge.tsx similarity index 100% rename from src/app/components/ui/Badge.tsx rename to src/components/ui/Badge.tsx diff --git a/src/app/components/ui/Button.tsx b/src/components/ui/Button.tsx similarity index 100% rename from src/app/components/ui/Button.tsx rename to src/components/ui/Button.tsx diff --git a/src/app/components/ui/Card.tsx b/src/components/ui/Card.tsx similarity index 100% rename from src/app/components/ui/Card.tsx rename to src/components/ui/Card.tsx diff --git a/src/app/components/ui/Dialog.tsx b/src/components/ui/Dialog.tsx similarity index 100% rename from src/app/components/ui/Dialog.tsx rename to src/components/ui/Dialog.tsx diff --git a/src/app/components/ui/Drawer.tsx b/src/components/ui/Drawer.tsx similarity index 100% rename from src/app/components/ui/Drawer.tsx rename to src/components/ui/Drawer.tsx diff --git a/src/app/components/ui/ResponsiveDialog.tsx b/src/components/ui/ResponsiveDialog.tsx similarity index 100% rename from src/app/components/ui/ResponsiveDialog.tsx rename to src/components/ui/ResponsiveDialog.tsx diff --git a/src/app/components/ui/ScrollArea.tsx b/src/components/ui/ScrollArea.tsx similarity index 100% rename from src/app/components/ui/ScrollArea.tsx rename to src/components/ui/ScrollArea.tsx diff --git a/src/app/config/atoms.ts b/src/config/atoms.ts similarity index 100% rename from src/app/config/atoms.ts rename to src/config/atoms.ts diff --git a/src/app/config/constants.ts b/src/config/constants.ts similarity index 100% rename from src/app/config/constants.ts rename to src/config/constants.ts diff --git a/src/app/config/wagmi.ts b/src/config/wagmi.ts similarity index 100% rename from src/app/config/wagmi.ts rename to src/config/wagmi.ts diff --git a/src/fonts.ts b/src/lib/fonts.ts similarity index 77% rename from src/fonts.ts rename to src/lib/fonts.ts index a7d0280104..71fb118f90 100644 --- a/src/fonts.ts +++ b/src/lib/fonts.ts @@ -11,21 +11,21 @@ const inter = Inter({ const dystopian = localFont({ src: [ { - path: "../public/fonts/Dystopian-Light.woff2", + path: "../../public/fonts/Dystopian-Light.woff2", weight: "300", style: "normal", }, { - path: "../public/fonts/Dystopian-Regular.woff2", + path: "../../public/fonts/Dystopian-Regular.woff2", style: "normal", }, { - path: "../public/fonts/Dystopian-Bold.woff2", + path: "../../public/fonts/Dystopian-Bold.woff2", weight: "600", style: "normal", }, { - path: "../public/fonts/Dystopian-Black.woff2", + path: "../../public/fonts/Dystopian-Black.woff2", weight: "700", style: "normal", }, diff --git a/src/stories/Badge.stories.tsx b/src/stories/Badge.stories.tsx index e567cfa9d0..d4edffda3d 100644 --- a/src/stories/Badge.stories.tsx +++ b/src/stories/Badge.stories.tsx @@ -1,5 +1,5 @@ +import { Badge, type BadgeProps } from "@/components/ui/Badge"; import type { Meta, StoryObj } from "@storybook/react"; -import { Badge, type BadgeProps } from "app/components/ui/Badge"; const meta: Meta = { title: "Design system/Badge", diff --git a/src/stories/Button.stories.tsx b/src/stories/Button.stories.tsx index 520ee9250c..78a27f17e7 100644 --- a/src/stories/Button.stories.tsx +++ b/src/stories/Button.stories.tsx @@ -1,6 +1,6 @@ +import { Button, type ButtonProps } from "@/components/ui/Button"; import { CircleDashed } from "@phosphor-icons/react/dist/ssr"; import type { Meta, StoryObj } from "@storybook/react"; -import { Button, type ButtonProps } from "app/components/ui/Button"; type ButtonExampleProps = Omit & { leftIcon?: boolean; diff --git a/src/stories/Dialog.stories.tsx b/src/stories/Dialog.stories.tsx index b40b731348..f04c052965 100644 --- a/src/stories/Dialog.stories.tsx +++ b/src/stories/Dialog.stories.tsx @@ -1,4 +1,3 @@ -import type { Meta, StoryObj } from "@storybook/react"; import { Dialog, DialogBody, @@ -9,7 +8,8 @@ import { DialogHeader, DialogTitle, DialogTrigger, -} from "app/components/ui/Dialog"; +} from "@/components/ui/Dialog"; +import type { Meta, StoryObj } from "@storybook/react"; import type { ComponentProps } from "react"; diff --git a/src/stories/Drawer.stories.tsx b/src/stories/Drawer.stories.tsx index c239caed1f..2b89c2823d 100644 --- a/src/stories/Drawer.stories.tsx +++ b/src/stories/Drawer.stories.tsx @@ -1,5 +1,4 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import { Button } from "app/components/ui/Button"; +import { Button } from "@/components/ui/Button"; import { Drawer, DrawerClose, @@ -8,7 +7,8 @@ import { DrawerHeader, DrawerTitle, DrawerTrigger, -} from "app/components/ui/Drawer"; +} from "@/components/ui/Drawer"; +import type { Meta, StoryObj } from "@storybook/react"; const DrawerExample = () => ( diff --git a/src/stories/ResponsiveDialog.stories.tsx b/src/stories/ResponsiveDialog.stories.tsx index fde2ebae9a..1619eacb74 100644 --- a/src/stories/ResponsiveDialog.stories.tsx +++ b/src/stories/ResponsiveDialog.stories.tsx @@ -1,6 +1,5 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import { Button } from "app/components/ui/Button"; -import type { DialogContentProps } from "app/components/ui/Dialog"; +import { Button } from "@/components/ui/Button"; +import type { DialogContentProps } from "@/components/ui/Dialog"; import { ResponsiveDialog, ResponsiveDialogBody, @@ -10,7 +9,8 @@ import { ResponsiveDialogHeader, ResponsiveDialogTitle, ResponsiveDialogTrigger, -} from "app/components/ui/ResponsiveDialog"; +} from "@/components/ui/ResponsiveDialog"; +import type { Meta, StoryObj } from "@storybook/react"; import type { ComponentProps } from "react"; diff --git a/src/app/globals.css b/src/styles/globals.css similarity index 100% rename from src/app/globals.css rename to src/styles/globals.css diff --git a/tsconfig.json b/tsconfig.json index 2f9a45c076..1af882232f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -28,7 +28,7 @@ ], "strictNullChecks": true, "paths": { - "@/*": ["./src/*"] + "@/*": ["./*"] } }, "include": [