refactor(preview): restore in-place modal, keep crawlable links

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
nerandClaude Fable 5 committed 2026-08-07 16:48:11 +03:00
1 parent 70b825c2dc
commit 8b56268430
13 files changed
+64 -128

No files matched your search

+19 -4
View File
@@ -1,10 +1,12 @@
'use client';
import { FC, ReactNode } from 'react';
import { create, InstanceProps } from 'react-modal-promise';
import Poster from '@/components/Poster';
import Credits from '@/components/Preview/components/Credits';
import useDetails from '@/components/Preview/useDetails';
import { Modal } from '@/components/ui/dialog';
import { cn } from '@/lib/utils';
import Actions from './components/Actions';
@@ -17,7 +19,7 @@ interface Props {
showId?: Show['id'];
className?: string;
posterClassName?: string;
modal?: boolean;
onClose?: () => void;
poster?: ReactNode;
externalLink?: boolean;
}
@@ -28,7 +30,7 @@ const Preview: FC<Props> = ({
showId,
className,
posterClassName,
modal,
onClose,
poster,
externalLink = true
}) => {
@@ -38,7 +40,7 @@ const Preview: FC<Props> = ({
const show: Show & Partial<Details> = (detailedShow || baseShow)!;
const isModal = Boolean(modal);
const isModal = Boolean(onClose);
return (
<div
@@ -74,11 +76,24 @@ const Preview: FC<Props> = ({
{show.overview}
</p>
<div className='order-5 mt-5 grid grid-cols-1 rounded-lg md:order-5 md:mt-auto'>
<Credits showType={show.type} showId={show.id} />
<Credits showType={show.type} showId={show.id} onClick={onClose} />
</div>
</div>
</div>
);
};
export const showPreviewModal = create(({ onResolve, onClose, show }: Props & InstanceProps<void>) => (
<Modal className='block bg-background p-0 md:bg-black' onClose={onResolve}>
<Preview
show={show}
onClose={() => {
onClose?.();
onResolve();
window.scrollTo({ top: 0, behavior: 'smooth' });
}}
/>
</Modal>
));
export default Preview;