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,30 @@
import ProductCreateEditForm from '@/components/(protected)/admin/product/create-edit-form'
import {getProductById} from '@/lib/data/models/product'
import {dump} from '@/lib/utils'
export default async function Page({
params
}: {
params: Promise<{slug?: string[]}>
}) {
const {slug} = await params
const [method, id] = slug || []
let data = null
if (id) {
data = await getProductById(parseInt(id))
if (data) {
data = JSON.parse(JSON.stringify(data))
}
}
switch (method) {
case 'create':
return <ProductCreateEditForm />
case 'update':
return <ProductCreateEditForm data={data} />
default:
return <div>{dump(slug)}</div>
}
}

View File

@@ -0,0 +1,34 @@
import {Product} from '@prisma/client'
import {LayoutList} from 'lucide-react'
import Link from 'next/link'
import AdminPermission from '@/components/(protected)/admin/auth/permission'
import dayjs from '@/lib/config/dayjs'
import {getProducts} from '@/lib/data/models/product'
import {dump} from '@/lib/utils'
//const products = await getProducts()
export default async function AdminProductPage() {
return (
<>
<AdminPermission />
<p>
<Link href='/admin/product/create'>Створити</Link>
</p>
{/*<section className={'mt-12'}>
{products
? products.map((product: Product) => (
<article
key={product.id}
className={'flex flex-row items-center justify-evenly'}
>
<LayoutList />
{product.locales[0].headingTitle || product.locales[0].title}
</article>
))
: null}
</section>*/}
</>
)
}