Fix weird menus click via a weird hack

This commit is contained in:
Zoe Roux 2023-12-14 14:55:31 +01:00
parent 10924e2410
commit c67a11b8b6
4 changed files with 8 additions and 8 deletions

View File

@ -32,7 +32,7 @@ export const EpisodesContext = ({
slug, slug,
status, status,
...props ...props
}: { showSlug?: string; slug: string; status: WatchStatusV | null } & Partial< }: { showSlug?: string | null; slug: string; status: WatchStatusV | null } & Partial<
ComponentProps<typeof Menu<typeof IconButton>> ComponentProps<typeof Menu<typeof IconButton>>
>) => { >) => {
const account = useAccount(); const account = useAccount();
@ -50,11 +50,6 @@ export const EpisodesContext = ({
return ( return (
<Menu Trigger={IconButton} icon={MoreVert} {...tooltip(t("misc.more"))} {...(props as any)}> <Menu Trigger={IconButton} icon={MoreVert} {...tooltip(t("misc.more"))} {...(props as any)}>
<Menu.Item
label={t("home.episodeMore.goToShow")}
icon={Info}
onSelect={() => console.log("tot")}
/>
{showSlug && ( {showSlug && (
<Menu.Item label={t("home.episodeMore.goToShow")} icon={Info} href={`/show/${showSlug}`} /> <Menu.Item label={t("home.episodeMore.goToShow")} icon={Info} href={`/show/${showSlug}`} />
)} )}

View File

@ -158,11 +158,13 @@ export const EpisodeLine = ({
runtime, runtime,
watchedPercent, watchedPercent,
watchedStatus, watchedStatus,
href,
...props ...props
}: WithLoading<{ }: WithLoading<{
id: string; id: string;
slug: string; slug: string;
showSlug: string; // if show slug is null, disable "Go to show" in the context menu
showSlug: string | null;
displayNumber: string; displayNumber: string;
name: string | null; name: string | null;
overview: string | null; overview: string | null;
@ -174,6 +176,7 @@ export const EpisodeLine = ({
runtime: number | null; runtime: number | null;
watchedPercent: number | null; watchedPercent: number | null;
watchedStatus: WatchStatusV | null; watchedStatus: WatchStatusV | null;
href: string;
}> & }> &
Partial<PressableProps>) => { Partial<PressableProps>) => {
const [moreOpened, setMoreOpened] = useState(false); const [moreOpened, setMoreOpened] = useState(false);
@ -182,7 +185,7 @@ export const EpisodeLine = ({
return ( return (
<Link <Link
href={slug ? `/watch/${slug}` : ""} href={moreOpened ? undefined : href}
onLongPress={() => setMoreOpened(true)} onLongPress={() => setMoreOpened(true)}
{...css( {...css(
{ {

View File

@ -147,6 +147,7 @@ export const EpisodeList = <Props,>({
)} )}
<EpisodeLine <EpisodeLine
{...item} {...item}
showSlug={null}
displayNumber={item.isLoading ? undefined! : episodeDisplayNumber(item)!} displayNumber={item.isLoading ? undefined! : episodeDisplayNumber(item)!}
watchedPercent={item.watchStatus?.watchedPercent ?? null} watchedPercent={item.watchStatus?.watchedPercent ?? null}
watchedStatus={item.watchStatus?.status ?? null} watchedStatus={item.watchStatus?.status ?? null}

View File

@ -75,6 +75,7 @@ export const ShowWatchStatusCard = ({ watchedPercent, status, nextEpisode }: Sho
<EpisodeLine <EpisodeLine
isLoading={false} isLoading={false}
{...nextEpisode} {...nextEpisode}
showSlug={null}
watchedPercent={watchedPercent || null} watchedPercent={watchedPercent || null}
watchedStatus={status || null} watchedStatus={status || null}
displayNumber={episodeDisplayNumber(nextEpisode, "???")!} displayNumber={episodeDisplayNumber(nextEpisode, "???")!}