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,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { FC } from 'react';
|
||||
import { FC, MouseEvent } from 'react';
|
||||
import Link from 'next/link';
|
||||
|
||||
import { useMutateShowState } from '@/hooks/useShowState';
|
||||
@@ -14,8 +14,18 @@ interface Props {
|
||||
const Handlers: FC<Props> = ({ href, onClick, show }) => {
|
||||
const { mutate } = useMutateShowState(show);
|
||||
|
||||
// The link exists for crawlers and new-tab clicks; a plain click opens the preview modal in place
|
||||
const handleClick = (event: MouseEvent<HTMLElement>) => {
|
||||
if (!onClick) return;
|
||||
|
||||
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
||||
|
||||
event.preventDefault();
|
||||
onClick();
|
||||
};
|
||||
|
||||
const handlers = {
|
||||
onClick,
|
||||
onClick: handleClick,
|
||||
onDoubleClick: () => mutate({ list: 'favorite', value: true }),
|
||||
className: 'absolute left-0 top-0 size-full'
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user