From b32df2a6eb4e578d9c6c95f09a174e4f89d828ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yusuf=20Akg=C3=BCl?= <s86116@bht-berlin.de> Date: Tue, 11 Jul 2023 04:06:01 +0200 Subject: [PATCH] cleanup --- app/error.tsx | 38 ++++++++++ app/layout.tsx | 68 +++++++++++++++++- app/not-found.tsx | 17 +++++ components/icons.tsx | 2 + .../components/profile-side-content.tsx | 4 +- components/user-not-found.tsx | 6 +- lib/config/site.ts | 4 +- {app => public}/favicon.ico | Bin 8 files changed, 130 insertions(+), 9 deletions(-) create mode 100644 app/error.tsx create mode 100644 app/not-found.tsx rename {app => public}/favicon.ico (100%) diff --git a/app/error.tsx b/app/error.tsx new file mode 100644 index 0000000..45016b4 --- /dev/null +++ b/app/error.tsx @@ -0,0 +1,38 @@ +"use client" + +import { Icons } from "@/components/icons" +import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert" +import { Button } from "@/components/ui/button" +import Link from "next/link" + +export default function Error({ + error, + reset, +}: { + error: Error + reset: () => void +}) { + return ( + <div className="flex h-[80vh] w-full flex-col items-center justify-center"> + <Alert className="my-6 w-[40%]"> + <Icons.terminal className="h-4 w-4" /> + <AlertTitle>{error.name}</AlertTitle> + <AlertDescription>{error.message}</AlertDescription> + </Alert> + + <div className="mt-5 flex items-center"> + <Button onClick={() => reset()} className="ml-3"> + Try again + </Button> + </div> + + <div className="mt-5 flex items-center"> + <Link href="/home"> + <Button size="lg"> + Back to Home Page + </Button> + </Link> + </div> + </div> + ) +} \ No newline at end of file diff --git a/app/layout.tsx b/app/layout.tsx index 79aaabb..8890656 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -3,13 +3,77 @@ import './globals.css' import { ThemeProvider } from '@/components/ui/theme-provider' import { Toaster } from '@/components/ui/toaster' +import { siteConfig } from "@/lib/config/site" import Providers from '@/lib/react-query/provider' const inter = Inter({ subsets: ['latin'] }) export const metadata = { - title: 'Create Next App', - description: 'Generated by create next app', + title: { + default: siteConfig.name, + template: `%s | ${siteConfig.name}`, + }, + description: siteConfig.description, + keywords: [ + "Next.js", + "React", + "Tailwind CSS", + "Server Components", + "Radix UI", + "TypeScript", + "ESLint", + "Prisma ORM", + "PostgreSQL", + "Vercel", + "Jest", + "IGDB", + ], + authors: [ + { + name: "Yusuf Akgül", + }, + { + name: "Caner Ilaslan", + }, + { + name: "David Jakszta", + }, + { + name: "Omar Kasbah", + }, + { + name: "Serdar Dorak", + }, + { + name: "Valeria Luft", + }, + ], + creator: "The Golden Order Studio", + themeColor: [ + { media: "(prefers-color-scheme: light)", color: "white" }, + { media: "(prefers-color-scheme: dark)", color: "black" }, + ], + openGraph: { + type: "website", + locale: "en_US", + url: siteConfig.url, + title: siteConfig.name, + description: siteConfig.description, + siteName: siteConfig.name, + }, + twitter: { + card: "summary_large_image", + title: siteConfig.name, + description: siteConfig.description, + images: [`${siteConfig.url}/og.jpg`], + creator: "@shadcn", + }, + icons: { + icon: "/favicon.ico", + shortcut: "/favicon-16x16.png", + apple: "/apple-touch-icon.png", + }, + manifest: `${siteConfig.url}/site.webmanifest`, } export default function RootLayout({ diff --git a/app/not-found.tsx b/app/not-found.tsx new file mode 100644 index 0000000..8248c2d --- /dev/null +++ b/app/not-found.tsx @@ -0,0 +1,17 @@ +import { Button } from "@/components/ui/button" +import Link from "next/link" + +export default function notFound() { + return ( + <div className="flex h-[50vh] w-full flex-col items-center justify-center space-y-6"> + <p className="text-xl text-muted-foreground">Page not found</p> + <p className="text-muted-foreground">Could not find requested resource</p> + + <Link href="/home"> + <Button size="lg"> + Back to Home Page + </Button> + </Link> + </div> + ) +} \ No newline at end of file diff --git a/components/icons.tsx b/components/icons.tsx index e21aac5..78360c4 100644 --- a/components/icons.tsx +++ b/components/icons.tsx @@ -33,6 +33,7 @@ import { Settings, SunMedium, SwitchCamera, + TerminalIcon, Trash, User, Users, @@ -91,6 +92,7 @@ export const Icons = { website: Link2, // Website Button calendar: CalendarRange, // Calendar Button camera: SwitchCamera, // Change Image Button + terminal: TerminalIcon, // Terminal Icon post: FileText, page: File, media: Image, diff --git a/components/profile/components/profile-side-content.tsx b/components/profile/components/profile-side-content.tsx index b273d8a..493e216 100644 --- a/components/profile/components/profile-side-content.tsx +++ b/components/profile/components/profile-side-content.tsx @@ -6,9 +6,9 @@ import { Connect } from "./connect" export const ProfileSideContent = async ({ user }: { user: IUser }) => { const session = await getCurrentUser() - const arrayOfUserMedia = user.gweets.slice(0, 4) + const arrayOfUserMedia = user?.gweets.slice(0, 4) .flatMap((gweet) => gweet.media.slice(0, 4).map((media) => ({ id: gweet.id, url: media.url }))) - .slice(0, 4) + .slice(0, 4) ?? [] return ( <div className="space-y-6"> diff --git a/components/user-not-found.tsx b/components/user-not-found.tsx index f08a2ba..d232053 100644 --- a/components/user-not-found.tsx +++ b/components/user-not-found.tsx @@ -1,8 +1,8 @@ export const UserNotFound = () => { return ( - <div className=""> - <h1>This account does not exist.</h1> - <p>Try searching for another.</p> + <div className="flex flex-col items-center p-6 space-y-3"> + <h1 className="text-tertiary text-center">This account does not exist.</h1> + <h1 className="text-tertiary text-center">Try searching for another.</h1> </div> ) } \ No newline at end of file diff --git a/lib/config/site.ts b/lib/config/site.ts index 2ca42ca..955f866 100644 --- a/lib/config/site.ts +++ b/lib/config/site.ts @@ -3,7 +3,7 @@ import { SiteConfig } from "@/types" export const siteConfig: SiteConfig = { name: "GameUnity", description: - "Your game tracker to finally get an overview of your games built using the new router, server components and everything new in Next.js 13.", - url: "", + "Your social media for game tracking needs, so you can finally get an overview of your games. Built using the new router, server components and everything new in Next.js 13.", + url: "https://gameunity.vercel.app/", ogImage: "", } \ No newline at end of file diff --git a/app/favicon.ico b/public/favicon.ico similarity index 100% rename from app/favicon.ico rename to public/favicon.ico -- GitLab