added tons of features

This commit is contained in:
2025-02-05 08:01:14 +02:00
parent 4ae0d8c545
commit 8138da6b1d
195 changed files with 12619 additions and 415 deletions

View File

@@ -0,0 +1,16 @@
import React from 'react'
export default async function AuthLayout({
children
}: {
children: React.ReactNode
}) {
return (
<section className='relative w-full'>
<div className='flex h-screen items-center justify-center bg-[radial-gradient(ellipse_at_top,_var(--tw-gradient-stops))] from-brand-violet-400 to-brand-yellow-200'>
{/**/}
{children}
</div>
</section>
)
}

View File

@@ -0,0 +1,5 @@
import LoginForm from '@/components/auth/forms/login-form'
export default function LoginPage() {
return <LoginForm />
}

View File

@@ -0,0 +1,5 @@
import RegisterForm from '@/components/auth/forms/register-form'
export default function RegisterPage() {
return <RegisterForm />
}

View File

@@ -0,0 +1,26 @@
import can, {CanAccessResponse} from '@/actions/permission'
import LoginForm from '@/components/auth/forms/login-form'
import CabinetIndex from '@/components/cabinet'
import {Access} from '@/lib/permission'
export default async function CabinetPage({
params
}: {
params: Promise<{slug?: string[]}>
}) {
const user = (await can(Access.Cabinet)) as CanAccessResponse
if (!user.can || !user.session) {
return (
<div className='my-8'>
<div className='container flex flex-col sm:flex-row'>
<LoginForm />
</div>
</div>
)
} else {
const {slug} = await params
return <CabinetIndex slug={slug} session={user.session} />
}
}

View File

@@ -0,0 +1,12 @@
import {Metadata} from 'next'
export const metadata: Metadata = {
title: 'Checkout'
}
export default function CheckoutPage() {
//throw new Error('NOT IMPLEMENTED')
//const session = await auth()
return <div>CheckoutPage</div>
}

View File

@@ -0,0 +1,17 @@
import {ReactNode} from 'react'
import Above from '@/components/shared/above'
import Footer from '@/components/shared/footer'
import Header from '@/components/shared/header'
export default async function HomeLayout({children}: {children: ReactNode}) {
return (
<>
<Above />
<Header />
{/*<Above />*/}
{children}
<Footer />
</>
)
}

View File

@@ -0,0 +1,69 @@
import Image from 'next/image'
import FeatureCards from '@/components/shared/home/feature-cards'
import {HomeCarousel} from '@/components/shared/home/home-carousel'
import AppCatalog from '@/components/shared/sidebar/app-catalog'
import {carousels} from '@/lib/data'
import {db} from '@/lib/db/prisma/client'
import {dump} from '@/lib/utils'
import image from '@/public/uploads/products/IMG_6572.jpg'
// const storeModel = async (id: any) => {
// return db.store.findFirst({
// where: {id},
// include: {
// storeLocale: {
// include: {
// meta: {
// include: {
// openGraph: true
// }
// }
// }
// }
// }
// })
// }
export default async function HomePage() {
return (
<>
<div className='mt-1'>
<div className='container flex flex-col sm:flex-row'>
<section className='bw-layout-col-left pt-3'>
<AppCatalog />
</section>
<div className='bw-layout-col-right pt-3'>
{/*<pre>{dump(await storeModel(1))}</pre>*/}
<section className='w-full'>
<HomeCarousel items={carousels}></HomeCarousel>
</section>
</div>
</div>
</div>
{/*<pre>{JSON.stringify(session)}</pre>*/}
<section className='relative mx-auto mt-8 h-[640px] w-[840px] bg-brand-violet-200'>
<Image
src={'/uploads/products/IMG_6572.jpg'}
//fill
//sizes='(min-width: 808px) 50vw, 100vw'
width={1280}
height={1280}
alt=''
title=''
priority
style={{
objectFit: 'contain' // cover, contain, none
}}
/>
</section>
<section className='mb-4 mt-[128px]'>
<div className='container'>
<FeatureCards />
</div>
</section>
</>
)
}

34
app/[locale]/error.tsx Normal file
View File

@@ -0,0 +1,34 @@
'use client'
import {useTranslations} from 'next-intl'
import React from 'react'
import {Button} from '@/components/ui/button'
export default function ErrorPage({
error,
reset
}: {
error: Error
reset: () => void
}) {
const t = useTranslations('Error')
return (
<div className='flex min-h-screen flex-col items-center justify-center'>
<div className='w-1/3 rounded-lg p-6 text-center shadow-md'>
<h1 className='mb-4 text-3xl font-bold'>{t('title')}</h1>
<p className='text-destructive'>{error.message}</p>
<Button variant='outline' className='mt-4' onClick={() => reset()}>
{t('try-again')}
</Button>
<Button
variant='outline'
className='ml-2 mt-4'
onClick={() => (window.location.href = '/')}
>
{t('back-to-home')}
</Button>
</div>
</div>
)
}

33
app/[locale]/layout.tsx Normal file
View File

@@ -0,0 +1,33 @@
import {NextIntlClientProvider} from 'next-intl'
import {getMessages} from 'next-intl/server'
import {notFound} from 'next/navigation'
import {ReactNode} from 'react'
import {routing} from '@/i18n/routing'
import {TIMEZONE} from '@/lib/constants'
export default async function RootLayout({
children,
params
}: Readonly<{
children: ReactNode
params: Promise<{locale: string}>
}>) {
const {locale} = await params
if (!routing.locales.includes(locale as any)) {
notFound()
}
const messages = await getMessages()
//const queryClient = new QueryClient()
return (
<NextIntlClientProvider
messages={messages}
timeZone={TIMEZONE}
now={new Date()}
>
{children}
</NextIntlClientProvider>
)
}