mirror of
https://github.com/traberph/short.git
synced 2026-11-22 22:55:12 +00:00
connect custom pages and link pages with link blocks
This commit is contained in:
+25
-12
@@ -1,23 +1,36 @@
|
||||
import React from 'react';
|
||||
import prisma from '@/../prisma/prisma'
|
||||
import CreateUrlForm from '@/components/forms/createUrlForm';
|
||||
import UrlComponent from '@/components/UrlComponent';
|
||||
import CreateRedirectPageForm from '@/components/forms/createRedirectPageForm';
|
||||
import CreateCustomPageForm from '@/components/forms/createCustomPageForm';
|
||||
import PageListComponent from '@/components/PageListComponent';
|
||||
|
||||
|
||||
export default async function Dashboard() {
|
||||
|
||||
const urls = await prisma.uRL.findMany();
|
||||
|
||||
const pages = await prisma.page.findMany({
|
||||
include: {
|
||||
RedirectPage: true,
|
||||
CustomPage: true,
|
||||
_count: {
|
||||
select: { Stat: true }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const redirectPages = pages.filter((page) => page.RedirectPage.length > 0);
|
||||
const customPages = pages.filter((page) => page.CustomPage.length > 0);
|
||||
|
||||
return (<>
|
||||
<h2>URLs</h2>
|
||||
<div>
|
||||
{urls.map((url) => (
|
||||
<UrlComponent key={url.url_id} url={url}/>
|
||||
))}
|
||||
</div>
|
||||
<h2 className='mt-11'>Create URL</h2>
|
||||
<CreateUrlForm/>
|
||||
<h2>Redirect Pages</h2>
|
||||
{redirectPages.map((page) => (
|
||||
<PageListComponent key={page.uuid} page={page} />))}
|
||||
<h2 className='mt-11'>Create Redirect Page</h2>
|
||||
<CreateRedirectPageForm />
|
||||
|
||||
<h2 className='mt-11'>Custom Pages</h2>
|
||||
{customPages.map((page) => (<PageListComponent key={page.uuid} page={page} />))}
|
||||
<h2 className='mt-11'>Create Custom Page</h2>
|
||||
<CreateCustomPageForm />
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user