mirror of
https://github.com/traberph/short.git
synced 2026-11-22 22:55:12 +00:00
PWA functionality
This commit is contained in:
@@ -23,24 +23,22 @@ export default async function CustomPageDashboard(params: { customPage: CustomPa
|
||||
});
|
||||
|
||||
return (<>
|
||||
<h2>Links on Page</h2>
|
||||
<h2 className="mb-5">Links on Page</h2>
|
||||
{linkBlocks.map((block) => (
|
||||
|
||||
<div key={block.uuid} className="flex items-center justify-center mb-2 zebra">
|
||||
<div className="mr-5">order: {block.order}</div>
|
||||
<div className="mr-5">title: <span className="font-bold">{block.title}</span></div>
|
||||
<div>connected link page: <span className="font-bold">{block.redirectPage.page.shortcode}</span></div>
|
||||
<div className="ml-auto">
|
||||
<div key={block.uuid} className="flex items-center justify-between zebra max-sm:flex-col max-sm:items-start">
|
||||
<div className="flex">
|
||||
<div className="mr-5">order: {block.order}</div>
|
||||
<div className="mr-5">title: <span className="font-bold">{block.title}</span></div>
|
||||
<div>link page: <span className="font-bold">{block.redirectPage.page.shortcode}</span></div>
|
||||
</div>
|
||||
<div className="flex max-sm:mt-3 max-sm:w-full max-sm:justify-between">
|
||||
<button>
|
||||
<a href={`/${block.redirectPage.page.shortcode}`} className="btn btn-primary"><ArrowTopRightOnSquareIcon className="button-icon" /></a>
|
||||
</button>
|
||||
</div>
|
||||
<div className="ml-5">
|
||||
<button>
|
||||
<button className="ml-3">
|
||||
<a href={`/~/dash/${block.redirectPage.page.uuid}`} className="btn btn-primary"><ArrowTrendingUpIcon className="button-icon" /></a>
|
||||
</button>
|
||||
</div>
|
||||
<div className="ml-5">
|
||||
<DeleteLinkBlockForm linkBlockUuid={block.uuid} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,7 @@ export default function LinkFavicon({ url }: { url: string }) {
|
||||
|
||||
const hostname = new URL(url).hostname;
|
||||
|
||||
return (<div className=" h-10 w-10">
|
||||
return (
|
||||
<Image
|
||||
src={`https://logo.clearbit.com/${hostname}?`}
|
||||
width={100}
|
||||
@@ -12,6 +12,5 @@ export default function LinkFavicon({ url }: { url: string }) {
|
||||
alt=" "
|
||||
className="rounded-full"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import Image from 'next/image';
|
||||
import Link from 'next/link';
|
||||
import LinkFavicon from './LinkFavicon';
|
||||
import PinPageToRootForm from './forms/pinPageToRootForm';
|
||||
import { BookmarkIcon } from '@heroicons/react/24/solid';
|
||||
|
||||
type PageWithRelations = Prisma.PageGetPayload<{
|
||||
include: {
|
||||
@@ -24,9 +25,11 @@ export default async function PageListComponent({ page }: { page: PageWithRelati
|
||||
|
||||
return (
|
||||
<Link href={`/~/dash/${page.uuid}`}>
|
||||
<div className="w-full my-3 flex items-center hover:bg-slate-600 rounded p-1">
|
||||
<div className="flex-shrink-0 h-8 w-8 flex items-center justify-center mr-4">
|
||||
{redirectPage ? <LinkFavicon url={redirectPage.dest} /> :
|
||||
<div className='flex justify-between items-center hover:bg-slate-700 my-2 p-1 rounded'>
|
||||
<div className='flex items-center'>
|
||||
<div className='w-8 h-8'>
|
||||
{redirectPage ?
|
||||
<LinkFavicon url={redirectPage.dest} /> :
|
||||
<Image
|
||||
loading='lazy'
|
||||
width={100}
|
||||
@@ -35,19 +38,17 @@ export default async function PageListComponent({ page }: { page: PageWithRelati
|
||||
alt="icon"
|
||||
className="rounded-full"
|
||||
/>}
|
||||
</div>
|
||||
<div className='ml-3'>
|
||||
<p className="font-bold text-lg text-white">{page.shortcode}</p>
|
||||
<p className="text-sm text-gray-400">{redirectPage ? redirectPage.dest : customPage.title}</p>
|
||||
</div>
|
||||
<div className="ml-5">
|
||||
{page.pinnedPage ? <BookmarkIcon className='button-icon common-red'/> : ""}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<p className="font-bold text-lg text-white">{page.shortcode}</p>
|
||||
<p className="text-sm text-gray-400">{redirectPage ? redirectPage.dest : customPage.title}</p>
|
||||
|
||||
</div>
|
||||
<div className="ml-5">
|
||||
{page.pinnedPage ? <p className="text-red-500">Pinned to root</p> : ""}
|
||||
</div>
|
||||
<div className="ml-auto">
|
||||
{page._count.stat ? <p className="text-gray-400 font-bold">{page._count.stat} visits</p> : ""}
|
||||
{//<DeletePageForm uuid={page.uuid} />
|
||||
}
|
||||
{page._count.stat ? <p className="text-gray-400 font-bold text-right">{page._count.stat} visits</p> : ""}
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
|
||||
@@ -24,7 +24,7 @@ export default function QRCode({ url }: { url: string }) {
|
||||
{values.map((value, index) => (
|
||||
<span
|
||||
key={index}
|
||||
className={`mx-2 ${errorCorrectionLevel === index ? 'text-white' : 'text-gray-400'}`}
|
||||
className={`cursor-pointer mx-2 ${errorCorrectionLevel === index ? 'text-white' : 'text-gray-400'}`}
|
||||
onClick={() => setErrorCorrectionLevel(index)}>
|
||||
{value}
|
||||
</span>
|
||||
|
||||
@@ -18,7 +18,7 @@ export default function CreateLinkBlockForm({ customPage, shortcodes }: { custom
|
||||
|
||||
useEffect(() => { handleToast(state); }, [state]);
|
||||
|
||||
return (<form action={formAction}>
|
||||
return (<form action={formAction} className="mt-5">
|
||||
<div className="form-group">
|
||||
<label htmlFor="redirectPageShortcode">Redirect Page</label>
|
||||
<select name="redirectPageShortcode" id="redirectPageShortcode" className={state.error?.redirectPageShortcode ? "border-red-400" : ""}>
|
||||
|
||||
@@ -17,7 +17,7 @@ export default function DeleteLinkBlockForm({ linkBlockUuid }: { linkBlockUuid:
|
||||
|
||||
useEffect(() => { handleToast(state); }, [state]);
|
||||
|
||||
return (<form action={formAction}>
|
||||
return (<form action={formAction} className="ml-3 w-min">
|
||||
<input type="hidden" name="uuid" id="uuid" value={linkBlockUuid} />
|
||||
<SubmitButton>
|
||||
<LinkSlashIcon className="button-icon" />
|
||||
|
||||
Reference in New Issue
Block a user