feat(seo): crawlable show links, intercepted preview modal, real 404s
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
919dcf9a42
commit
25a5d535a4
21 files changed
+231
-127
No files matched your search
@@ -1,24 +1,28 @@
|
||||
'use client';
|
||||
|
||||
import { FC } from 'react';
|
||||
import Link from 'next/link';
|
||||
|
||||
import { useMutateShowState } from '@/hooks/useShowState';
|
||||
|
||||
interface Props {
|
||||
show: Show;
|
||||
href?: string;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
const Handlers: FC<Props> = ({ onClick, show }) => {
|
||||
const Handlers: FC<Props> = ({ href, onClick, show }) => {
|
||||
const { mutate } = useMutateShowState(show);
|
||||
|
||||
return (
|
||||
<div
|
||||
onClick={onClick}
|
||||
onDoubleClick={() => mutate({ list: 'favorite', value: true })}
|
||||
className='absolute left-0 top-0 size-full'
|
||||
/>
|
||||
);
|
||||
const handlers = {
|
||||
onClick,
|
||||
onDoubleClick: () => mutate({ list: 'favorite', value: true }),
|
||||
className: 'absolute left-0 top-0 size-full'
|
||||
};
|
||||
|
||||
if (!href) return <div {...handlers} />;
|
||||
|
||||
return <Link {...handlers} href={href} prefetch={false} aria-label={show.title} />;
|
||||
};
|
||||
|
||||
export default Handlers;
|
||||
@@ -6,6 +6,7 @@ import Handlers from './components/Handlers';
|
||||
|
||||
interface Props {
|
||||
show: Show;
|
||||
href?: string;
|
||||
onClick?: () => void;
|
||||
className?: string;
|
||||
lazy?: boolean;
|
||||
@@ -14,7 +15,7 @@ interface Props {
|
||||
|
||||
type FetchPriorityProps = ImgHTMLAttributes<HTMLImageElement> & { fetchPriority?: 'high' | 'low' | 'auto' };
|
||||
|
||||
const Poster: FC<Props> = ({ show, onClick, className, lazy = true, priority = false }) => {
|
||||
const Poster: FC<Props> = ({ show, href, onClick, className, lazy = true, priority = false }) => {
|
||||
const fetchPriorityProps: FetchPriorityProps = priority ? { fetchPriority: 'high' } : {};
|
||||
|
||||
return (
|
||||
@@ -38,7 +39,7 @@ const Poster: FC<Props> = ({ show, onClick, className, lazy = true, priority = f
|
||||
{...fetchPriorityProps}
|
||||
/>
|
||||
</picture>
|
||||
<Handlers show={show} onClick={onClick} />
|
||||
<Handlers show={show} href={href} onClick={onClick} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user