diff --git a/public/language/en.json b/public/language/en.json index 0f386ef..bafee50 100644 --- a/public/language/en.json +++ b/public/language/en.json @@ -136,5 +136,10 @@ "reading": "Reading", "continue-reading": "Continue Reading", "delete-all": "Delete All", + "price": "Price", + "content": "Content", + "collaborators": "Collaborators", + "update-by": "Update By", + "search-for-users": "Search for users", "description_0": "The largest online comic reading website updated continuously every day - Join reading and discussing with more than 10 million members 🎉 at YouthBook ❤️💛💚" } \ No newline at end of file diff --git a/public/language/vi.json b/public/language/vi.json index 890c907..491aae3 100644 --- a/public/language/vi.json +++ b/public/language/vi.json @@ -137,5 +137,10 @@ "not-found-history": "Không tìm thấy lịch sử", "continue-reading": "Đọc tiếp", "delete-all": "Xóa tất cả", + "price": "Giá", + "content": "Nội dung", + "collaborators": "Collaborators", + "update-by": "Người cập nhật", + "search-for-users": "Tìm tài khoản", "description_0": "Web đọc truyện tranh online lớn nhất được cập nhật liên tục mỗi ngày - Cùng tham gia đọc truyện và thảo luận với hơn 10 triệu thành viên 🎉 tại YouthBook ❤️💛💚" } \ No newline at end of file diff --git a/src/components/Header/AccountInfo.tsx b/src/components/Header/AccountInfo.tsx index 2d87ce6..79b9861 100644 --- a/src/components/Header/AccountInfo.tsx +++ b/src/components/Header/AccountInfo.tsx @@ -85,7 +85,7 @@ const AccountInfo = ({ userInfo }: AccountInfoProps) => { {translate('account-page')} - {userInfo.role === ROLES.admin && ( + {(userInfo.role === ROLES.admin || userInfo.role === ROLES.collaborators) && ( <> { { title: translate('new-comic-title'), link: { - pathname: APP_PATH.new, + pathname: APP_PATH.recent, search: createSearchParams({ type: 'all', page: '1', }).toString(), }, name: translate('new-comic'), - isCurrent: useMatch(APP_PATH.new), + isCurrent: useMatch(APP_PATH.recent), }, { title: translate('top-comic-title'), diff --git a/src/components/Pagination/Pagination.tsx b/src/components/Pagination/Pagination.tsx index d8f7748..a3bf2c7 100644 --- a/src/components/Pagination/Pagination.tsx +++ b/src/components/Pagination/Pagination.tsx @@ -15,7 +15,6 @@ const Pagination = ({ page, totalPage, queryConfig }: PaginationProps) => { const RANGE = 2; const lang = useAppSelector((state) => selectLanguage(state.settings)); const translate = useTranslation(lang); - if (totalPage <= 1) return <>>; const _renderPagination = () => { let dotAfter = false; diff --git a/src/components/Preview/ListPreview.tsx b/src/components/Preview/ListPreview.tsx index c4ce641..e24a1c6 100644 --- a/src/components/Preview/ListPreview.tsx +++ b/src/components/Preview/ListPreview.tsx @@ -8,7 +8,7 @@ interface ListPreviewProps { const ListPreview = ({ data, className }: ListPreviewProps) => { return ( -
diff --git a/src/constants/settings.ts b/src/constants/settings.ts index 99bd19a..f428d9b 100644 --- a/src/constants/settings.ts +++ b/src/constants/settings.ts @@ -27,6 +27,7 @@ export const COOKIE_KEYS = { export const ROLES = { admin: 1, + collaborators: 2, }; export const ROLE_LIST = [ @@ -38,6 +39,10 @@ export const ROLE_LIST = [ value: 1, name: 'admin', }, + { + value: 2, + name: 'collaborators', + }, ]; export const COMIC_TYPES_LIST = [ @@ -74,16 +79,20 @@ export const FILTER_OPTIONS = [ name: 'All', value: 0, }, - { - name: '1 Year', - value: 12, - }, { name: '3 Months', - value: 3, + value: 3 * 30, }, { name: '1 Month', + value: 30, + }, + { + name: '1 Week', + value: 7, + }, + { + name: '1 Day', value: 1, }, ]; diff --git a/src/layouts/ManagementLayout.tsx b/src/layouts/ManagementLayout.tsx index 1fe126c..3597e25 100644 --- a/src/layouts/ManagementLayout.tsx +++ b/src/layouts/ManagementLayout.tsx @@ -1,13 +1,23 @@ import { APP_PATH } from '@/constants/path'; +import { COOKIE_KEYS, ROLES } from '@/constants/settings'; import { useAppSelector } from '@/hooks/reduxHook'; import useTranslation from '@/hooks/useTranslation'; import { selectLanguage } from '@/redux/slices/settings'; +import { getCookie } from '@/utils/cookies'; +import { decodeJWTToken } from '@/utils/token'; import { Helmet } from 'react-helmet-async'; import { Link, Outlet } from 'react-router-dom'; const ManagementLayout = () => { const lang = useAppSelector((state) => selectLanguage(state.settings)); const translate = useTranslation(lang); + const token = getCookie(COOKIE_KEYS.token); + const userInfoPayload = decodeJWTToken(token); + + if (!userInfoPayload) { + window.location.href = APP_PATH.home; + } + return (