diff --git a/src/components/readlist-button/readlist-button.tsx b/src/components/readlist-button/readlist-button.tsx index 04894422..84baebe2 100644 --- a/src/components/readlist-button/readlist-button.tsx +++ b/src/components/readlist-button/readlist-button.tsx @@ -30,6 +30,7 @@ interface Props { disabled?: boolean; content_type: 'novel' | 'manga'; read?: API.Read; + content?: API.Manga | API.Novel; size?: 'sm' | 'md'; } @@ -63,6 +64,7 @@ const Component = ({ content_type, disabled, read: readProp, + content: contentProp, size, }: Props) => { const { openModal } = useModalContext(); @@ -79,24 +81,23 @@ const Component = ({ { slug, }, - { enabled: !disabled && content_type === 'manga' }, + { enabled: !disabled && content_type === 'manga' && !contentProp }, ); const { data: novel } = useNovelInfo( { slug, }, - { enabled: !disabled && content_type === 'novel' }, + { enabled: !disabled && content_type === 'novel' && !contentProp }, ); const { mutate: addRead } = useAddRead(); const read = readProp || (readQuery && !readError ? readQuery : undefined); + const content = contentProp || manga || novel; const openReadEditModal = () => { - if (manga || novel) { - const content = manga || novel; - + if (content) { openModal({ content: ( { +const Component = ({ + slug, + disabled, + watch: watchProp, + anime: animeProp, + size, +}: Props) => { const { openModal } = useModalContext(); const { data: watchQuery, isError: watchError } = useWatch( @@ -65,17 +72,19 @@ const Component = ({ slug, disabled, watch: watchProp, size }: Props) => { }, { enabled: !disabled && !watchProp }, ); - const { data: anime } = useAnimeInfo( + const { data: animeQuery } = useAnimeInfo( { slug, }, - { enabled: !disabled }, + { enabled: !disabled && !animeProp }, ); const { mutate: addWatch } = useAddWatch(); const watch = watchProp || (watchQuery && !watchError ? watchQuery : undefined); + const anime = animeProp || (animeQuery ? animeQuery : undefined); + const openWatchEditModal = () => { if (anime) { openModal({ diff --git a/src/features/franchise/franchise-item.tsx b/src/features/franchise/franchise-item.tsx index edc0ea30..77c4b52f 100644 --- a/src/features/franchise/franchise-item.tsx +++ b/src/features/franchise/franchise-item.tsx @@ -51,6 +51,7 @@ const FranchiseItem: FC = ({ content }) => { {content.data_type === 'anime' && ( @@ -59,6 +60,7 @@ const FranchiseItem: FC = ({ content }) => {