refactor(preview): restore in-place modal, keep crawlable links
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
70b825c2dc
commit
8b56268430
13 files changed
+64
-128
No files matched your search
@@ -1,11 +0,0 @@
|
||||
import { FC } from 'react';
|
||||
|
||||
import PreviewModal from '../../preview';
|
||||
|
||||
interface Props {
|
||||
params: { id: string };
|
||||
}
|
||||
|
||||
const MovieModal: FC<Props> = ({ params: { id } }) => <PreviewModal showId={Number(id)} showType='movie' />;
|
||||
|
||||
export default MovieModal;
|
||||
@@ -1,11 +0,0 @@
|
||||
import { FC } from 'react';
|
||||
|
||||
import PreviewModal from '../../preview';
|
||||
|
||||
interface Props {
|
||||
params: { id: string };
|
||||
}
|
||||
|
||||
const SeriesModal: FC<Props> = ({ params: { id } }) => <PreviewModal showId={Number(id)} showType='tv' />;
|
||||
|
||||
export default SeriesModal;
|
||||
@@ -1,5 +0,0 @@
|
||||
// Matches every non-intercepted route so the preview modal unmounts
|
||||
// when navigating elsewhere (e.g. to a person page from the credits).
|
||||
const CatchAll = () => null;
|
||||
|
||||
export default CatchAll;
|
||||
@@ -1,3 +0,0 @@
|
||||
const Default = () => null;
|
||||
|
||||
export default Default;
|
||||
@@ -1,4 +0,0 @@
|
||||
// Matches the root route so the preview modal unmounts when navigating home.
|
||||
const Empty = () => null;
|
||||
|
||||
export default Empty;
|
||||
@@ -1,29 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { FC } from 'react';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
import Preview from '@/components/Preview';
|
||||
import { previewSeedAtom } from '@/components/Preview/seed';
|
||||
import { Modal } from '@/components/ui/dialog';
|
||||
|
||||
interface Props {
|
||||
showId: Show['id'];
|
||||
showType: Show['type'];
|
||||
}
|
||||
|
||||
const PreviewModal: FC<Props> = ({ showId, showType }) => {
|
||||
const router = useRouter();
|
||||
const seed = useAtomValue(previewSeedAtom);
|
||||
|
||||
const show = seed?.id === showId && seed?.type === showType ? seed : undefined;
|
||||
|
||||
return (
|
||||
<Modal className='block bg-background p-0 md:bg-black' onClose={() => router.back()}>
|
||||
<Preview modal show={show} showId={showId} showType={showType} />
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default PreviewModal;
|
||||
@@ -1,10 +0,0 @@
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
const SiteLayout = ({ children, modal }: { children: ReactNode; modal: ReactNode }) => (
|
||||
<>
|
||||
{children}
|
||||
{modal}
|
||||
</>
|
||||
);
|
||||
|
||||
export default SiteLayout;
|
||||
Reference in new issue
Block a user