diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index 56d5cc94..0e6edbc4 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -47,6 +47,10 @@ export default function Header({}) { const [searchValue, setSearchValue] = useState('') const { account, wallet, logout, unlinkWallet } = useContext(Context) const searchComic = useApi(async () => await search(searchValue), !!searchValue, [searchValue]) + + useEffect(() => { + ;(window as any).isSearchFocused = isSearchFocused + }, [isSearchFocused]) useEffect(() => { ref.current?.addEventListener( 'keypress', @@ -116,47 +120,49 @@ export default function Header({}) { /> {!!searchComic.data?.length && (
- {searchComic.data?.map((manga, index) => ( -
- -
-
-

router.push(`/comic/${manga.id}/chapter/1`)}> - {manga[locale].title} -

-
- {manga.authors.map((author, index) => ( - - , - {author} - - ))} +
+ {searchComic.data?.map((manga, index) => ( +
+ +
+
+

router.push(`/comic/${manga.id}/chapter/1`)}> + {manga[locale].title} +

+
+ {manga.authors.map((author, index) => ( + + , + {author} + + ))} +
+ {!!manga.latestChap.number && ( +

+ Latest chap:{' '} + router.push(`/comic/${manga.id}/chapter/${manga.latestChap.number}`)}> + {manga.latestChap.number} + +

+ )}
- {!!manga.latestChap.number && ( -

- Latest chap:{' '} - router.push(`/comic/${manga.id}/chapter/${manga.latestChap.number}`)}> - {manga.latestChap.number} - -

- )}
-
- ))} + ))} +
)}
@@ -278,47 +284,49 @@ export default function Header({}) { /> {!!searchComic.data?.length && (
- {searchComic.data?.map((manga, index) => ( -
- -
-
-

router.push(`/comic/${manga.id}/chapter/1`)}> - {manga[locale].title} -

-
- {manga.authors.map((author, index) => ( - - , - {author} - - ))} +
+ {searchComic.data?.map((manga, index) => ( +
+ +
+
+

router.push(`/comic/${manga.id}/chapter/1`)}> + {manga[locale].title} +

+
+ {manga.authors.map((author, index) => ( + + , + {author} + + ))} +
+ {!!manga.latestChap.number && ( +

+ Latest chap:{' '} + router.push(`/comic/${manga.id}/chapter/${manga.latestChap.number}`)}> + {manga.latestChap.number} + +

+ )}
- {!!manga.latestChap.number && ( -

- Latest chap:{' '} - router.push(`/comic/${manga.id}/chapter/${manga.latestChap.number}`)}> - {manga.latestChap.number} - -

- )}
-
- ))} + ))} +
)}
diff --git a/src/components/pages/chapter/readingSection.tsx b/src/components/pages/chapter/readingSection.tsx index cb6b1533..f4f191e9 100644 --- a/src/components/pages/chapter/readingSection.tsx +++ b/src/components/pages/chapter/readingSection.tsx @@ -125,7 +125,7 @@ export default function ReadingSection({ useEffect(() => { const pageHandler = (event: any) => { - if (!chapterData || !chapterData?.[chapterLocale]) return + if (!chapterData || !chapterData?.[chapterLocale] || (window as any).isSearchFocused) return if (event.deltaY < 0 || event.which == 37 || event.which == 38) { setCurrentPage((prevState) => (prevState - 2 < 0 ? 0 : prevState - 2)) } else if (event.deltaY > 0 || event.which == 39 || event.which == 40) { diff --git a/src/components/pages/homepage/comic.tsx b/src/components/pages/homepage/comic.tsx index 4058b703..e6f657a9 100644 --- a/src/components/pages/homepage/comic.tsx +++ b/src/components/pages/homepage/comic.tsx @@ -10,10 +10,22 @@ import { IComic } from 'src/models/comic' export default function Comic(props: IComic) { const { locale } = useRouter() + const router = useRouter() return ( <>
- + + + +
- + + {props[locale].title} {props.status.text} + + {props[locale].title} {props.status.text}
@@ -40,7 +57,7 @@ export default function Comic(props: IComic) { ))}
-
+
{props.tags.map((tag, index) => { return {tag[locale]} })} @@ -55,14 +72,16 @@ export default function Comic(props: IComic) {
{props[locale].description}
-
- Latest:{' '} - - Chap #{props.latestChap.number} - -
+ {!!props.latestChap.number && ( +
+ Latest:{' '} + + Chap #{props.latestChap.number} + +
+ )}
diff --git a/src/components/pages/homepage/trendingComic.tsx b/src/components/pages/homepage/trendingComic.tsx index 21c2f249..0e633576 100644 --- a/src/components/pages/homepage/trendingComic.tsx +++ b/src/components/pages/homepage/trendingComic.tsx @@ -1,28 +1,46 @@ -import { EyeIcon } from "@heroicons/react/20/solid" -import NoImage from "images/no_img.png" -import Image from "next/image" -import Link from "next/link" -import { useRouter } from "next/router" -import { Fragment } from "react" -import { IComic } from "src/models/comic" +import { EyeIcon } from '@heroicons/react/20/solid' +import NoImage from 'images/no_img.png' +import Image from 'next/image' +import Link from 'next/link' +import { useRouter } from 'next/router' +import { Fragment } from 'react' +import { IComic } from 'src/models/comic' export default function TrendingComic(props: IComic) { const { locale } = useRouter() return (
- + + + + + +
-
{props[locale].title}
+ + {props[locale].title} + + + {props[locale].title} +
{props.authors.map((author, index) => ( @@ -36,12 +54,16 @@ export default function TrendingComic(props: IComic) { {props.views.toLocaleString('en-US')}
-
- Latest:{' '} - - Chap #{props.latestChap.number} - -
+ {!!props.latestChap.number && ( +
+ Latest:{' '} + + Chap #{props.latestChap.number} + +
+ )}
) diff --git a/src/components/pages/profile/comic.tsx b/src/components/pages/profile/comic.tsx index 2d6e7c2f..5a8b6025 100644 --- a/src/components/pages/profile/comic.tsx +++ b/src/components/pages/profile/comic.tsx @@ -16,58 +16,60 @@ export default function Comic(props: IComic & { unsubscribe?: () => void; subscr const { locale } = useRouter() const [isSub, setIsSub] = useState(true) return ( -
- +
+ -
-
- +
+
+ {props[locale].title} {props.status.text}
- by{" "} + by{' '} {props.authors.map((author, index) => ( - , - {author} + , + {author} ))}
-
+
{props.tags.map((tag, index) => { return {tag[locale]} })}
-
+
- {props.views.toLocaleString("en-US")} views + {props.views.toLocaleString('en-US')} views
- {props.likes.toLocaleString("en-US")} likes + {props.likes.toLocaleString('en-US')} likes
-
{props[locale].description}
+
{props[locale].description}
-
-
- Latest:{" "} - +
+
+ Latest:{' '} + Chap #{props.latestChap.number}
{props.latestChap?.pushlishDate && ( -
- New chapter arrives:{" "} - {moment(props.latestChap?.pushlishDate).format("DD/MM/YYYY")} +
+ New chapter arrives:{' '} + {moment(props.latestChap?.pushlishDate).format('DD/MM/YYYY')}
)} {!!props.subscribe && ( @@ -78,8 +80,8 @@ export default function Comic(props: IComic & { unsubscribe?: () => void; subscr setIsSub(false) props.unsubscribe() }}> -
- +
+ Unsubscribe
@@ -89,8 +91,8 @@ export default function Comic(props: IComic & { unsubscribe?: () => void; subscr setIsSub(true) props.subscribe() }}> -
- +
+ Subscribe
diff --git a/src/pages/comic/[comicId]/comic.tsx b/src/pages/comic/[comicId]/comic.tsx index 4e25aaa2..1ca7cd1e 100644 --- a/src/pages/comic/[comicId]/comic.tsx +++ b/src/pages/comic/[comicId]/comic.tsx @@ -81,7 +81,7 @@ export default function Comic({ comicDetails, subscribe, unsubscribe }) { ))}
{data[selectedLanguage.shortLang]?.description}
-
+
{data.tags.map((tag, index) => { return {tag[selectedLanguage.shortLang]} })}