diff --git a/public/locales/vn/common.json b/public/locales/vn/common.json index 3989653a..1ab18739 100644 --- a/public/locales/vn/common.json +++ b/public/locales/vn/common.json @@ -15,6 +15,8 @@ "Unknown creator": "Tác giả ẩn danh", "views": "luợt xem", "likes": "lượt thích", + "view": "luợt xem", + "like": "lượt thích", "Latest": "Mới nhất", "Chap": "Chương", "Subscribed": "Đã đăng ký", @@ -33,6 +35,7 @@ "Please": "Vui lòng", "to countinue reading": "để tiếp tục đọc", "comments": "bình luận", + "comment": "bình luận", "Previous chap": "Chương trước", "Next chap": "Chương sau", "See Detail": "Chi tiết", @@ -45,7 +48,7 @@ "Only digits": "Chỉ nhập chữ số", "All types": "Tất cả loại", "Free": "Miễn phí", - "NFTs only": "Cần NFT", + "NFTs only": "Yêu cầu NFT", "Sort by newest": "Mới nhất", "Sort by oldest": "Cũ nhất", "Search by title": "Tìm kiếm truyện và tác giả", diff --git a/src/components/pages/chapter/chapterList.tsx b/src/components/pages/chapter/chapterList.tsx index 11f11416..066fcbbd 100644 --- a/src/components/pages/chapter/chapterList.tsx +++ b/src/components/pages/chapter/chapterList.tsx @@ -17,6 +17,7 @@ import Image from 'next/image' import { useRouter } from 'next/router' import { useContext, useEffect, useState } from 'react' import m6 from 'src/assets/images/mockup6.png' +import { CHAPTER_STATUS, CHAPTER_TYPE } from 'src/constants/chapter.constant' import { Context } from 'src/context' import { getBlurUrl } from 'src/utils' @@ -86,15 +87,15 @@ export default function ChapterList({ }, { - key: 'Free', + key: CHAPTER_TYPE.FREE, value: t('Free'), }, { - key: 'NFTs only', + key: CHAPTER_TYPE.NFTS_ONLY, value: t('NFTs only'), }, { - key: 'Account only', + key: CHAPTER_TYPE.ACCOUNT_ONLY, value: t('Account only'), }, ]} @@ -206,6 +207,10 @@ const Chapter = ({ ;(document.querySelector('#open-sign-in-btn') as any)?.click() } } + const unavailable = + chapter.status == CHAPTER_STATUS.UPCOMING || + (!account && chapter.type == CHAPTER_TYPE.ACCOUNT_ONLY) || + (!data.hasAccess && chapter.type == CHAPTER_TYPE.NFTS_ONLY) return ( <>
{`${t('Chapter')} ${chapter.number}`}
{(function () { switch (chapter.type) { - case 'Account only': + case CHAPTER_TYPE.ACCOUNT_ONLY: if (account) { return (- {data.views?.toLocaleString('en-US')} {t('views')} + {data.views?.toLocaleString('en-US')} {data.views > 1 ? t('views') : t('view')} - {comicLikes?.toLocaleString('en-US')} {t('likes')} + {comicLikes?.toLocaleString('en-US')} {comicLikes > 1 ? t('likes') : t('like')}
@@ -260,9 +261,9 @@ export default function ReadingSection({
- {(chapterLikes || 0).toLocaleString('en-US')} {t('likes')} •{' '} - {(chapterData.views || 0).toLocaleString('en-US')} {t('views')} •{' '} - {(commentNumber || 0).toLocaleString('en-US')} {t('comments')} + {(chapterLikes || 0).toLocaleString('en-US')} {chapterLikes > 1 ? t('likes') : t('like')} •{' '} + {(chapterData.views || 0).toLocaleString('en-US')} {chapterData.views > 1 ? t('views') : t('view')} •{' '} + {(commentNumber || 0).toLocaleString('en-US')} {commentNumber > 1 ? t('comments') : t('comment')}
- {(chapterLikes || 0).toLocaleString('en-US')} {t('likes')} •{' '} - {(chapterData.views || 0).toLocaleString('en-US')} {t('views')} •{' '} - {(commentNumber || 0).toLocaleString('en-US')} {t('comments')} + {(chapterLikes || 0).toLocaleString('en-US')} {chapterLikes > 1 ? t('likes') : t('like')} •{' '} + {(chapterData.views || 0).toLocaleString('en-US')} {chapterData.views > 1 ? t('views') : t('view')} •{' '} + {(commentNumber || 0).toLocaleString('en-US')} {commentNumber > 1 ? t('comments') : t('comment')}
{`${t('Chapter')} ${chapter.number}`}
- {/* {(function () { - switch (chapter.status) { - case 'Published': - return <>> - case 'Upcoming': - return ( -
diff --git a/src/pages/comic/[comicId]/chapter/[chapterNumber]/with-api.tsx b/src/pages/comic/[comicId]/chapter/[chapterNumber]/with-api.tsx
index d7befa59..809de101 100644
--- a/src/pages/comic/[comicId]/chapter/[chapterNumber]/with-api.tsx
+++ b/src/pages/comic/[comicId]/chapter/[chapterNumber]/with-api.tsx
@@ -2,79 +2,18 @@ import axios from 'axios'
import getConfig from 'next/config'
import { useRouter } from 'next/router'
import { useContext, useRef } from 'react'
-import { COMIC_STATUS, LANGUAGE } from 'src/constants'
+import { LANGUAGE } from 'src/constants'
import { Context, privateAxios } from 'src/context'
import useApi from 'src/hooks/useApi'
import { IChapter } from 'src/models/chapter'
import { IComicDetail } from 'src/models/comic'
import { IComment } from 'src/models/comment'
-import { formatStatus } from 'src/utils'
+import { getComicDetail } from 'src/services'
const withApi = (Component: React.FC