diff --git a/client/src/styles/antd/override.less b/client/config/override.less similarity index 100% rename from client/src/styles/antd/override.less rename to client/config/override.less diff --git a/client/src/components/global/Aggrements/components/PrivacyPolicy/index.tsx b/client/src/components/global/Aggrements/PrivacyPolicy.tsx similarity index 100% rename from client/src/components/global/Aggrements/components/PrivacyPolicy/index.tsx rename to client/src/components/global/Aggrements/PrivacyPolicy.tsx diff --git a/client/src/components/global/Aggrements/components/TermsAndConditions/index.tsx b/client/src/components/global/Aggrements/TermsAndConditions.tsx similarity index 100% rename from client/src/components/global/Aggrements/components/TermsAndConditions/index.tsx rename to client/src/components/global/Aggrements/TermsAndConditions.tsx diff --git a/client/src/components/global/Aggrements/index.tsx b/client/src/components/global/Aggrements/index.tsx index 0da9f536..02127e81 100644 --- a/client/src/components/global/Aggrements/index.tsx +++ b/client/src/components/global/Aggrements/index.tsx @@ -5,8 +5,8 @@ import { Modal } from 'antd' import React from 'react' // Local files -import { PrivacyPolicy } from './components/PrivacyPolicy' -import { TermsAndConditions } from './components/TermsAndConditions' +import { PrivacyPolicy } from './PrivacyPolicy' +import { TermsAndConditions } from './TermsAndConditions' import { AggrementsProps } from '@/@types/components' export const Aggrements: React.FC = (props): JSX.Element => ( diff --git a/client/src/components/global/CategorySelect/index.tsx b/client/src/components/global/CategorySelect/index.tsx deleted file mode 100644 index 3ab003bf..00000000 --- a/client/src/components/global/CategorySelect/index.tsx +++ /dev/null @@ -1,64 +0,0 @@ -// Antd dependencies -import { TreeSelect } from 'antd' - -// Other dependencies -import React, { useState, useEffect } from 'react' - -// Local files -import { fetchMainCategories, fetchChildCategories } from '@/services/api' -import { CategoryData, CategorySelectProps } from '@/@types/components' -import './style.less' - -export const CategorySelect: React.FC = (props): JSX.Element => { - const [categories, setCategories] = useState([]) - - useEffect(() => { - fetchMainCategories().then(async ({ data }) => { - const refactoredArray = await data.attributes.categories.map((category: CategoryData) => { - return { - id: category.id, - pId: 0, - title: category.name.toUpperCase(), - value: category.id, - disabled: (!category.is_leaf && !props.multiple), - isLeaf: category.is_leaf - } - }) - setCategories(refactoredArray) - }) - }, []) - - const handleOnCategoryChangeEvent = (id: string, title: React.ReactNode[]): void => { - props.onSelect(id, title) - } - - const handleOnCategoryLoad = async (treeNode: any) => { - await fetchChildCategories(treeNode.id).then(async ({ data }) => { - data.attributes.categories.map((item: CategoryData) => { - setCategories((currentState) => [...currentState, { - id: item.id, - pId: treeNode.id, - title: item.is_leaf ? item.name : item.name.toUpperCase(), - value: item.id, - disabled: (!item.is_leaf && !props.multiple), - isLeaf: item.is_leaf - }]) - }) - }) - } - - return ( - - ) -} diff --git a/client/src/components/global/CategorySelect/style.less b/client/src/components/global/CategorySelect/style.less deleted file mode 100644 index b568b57e..00000000 --- a/client/src/components/global/CategorySelect/style.less +++ /dev/null @@ -1,12 +0,0 @@ -@import '~antd/es/style/themes/default.less'; - -.ant-select-tree .ant-select-tree-node-content-wrapper { - color: #188fce; - font-weight: bold; -} - -.ant-select-tree .ant-select-tree-treenode-disabled .ant-select-tree-node-content-wrapper { - color: #616161 !important; - cursor: default !important; - font-weight: bold !important; -} diff --git a/client/src/components/global/SignModal/components/LoginForm.tsx b/client/src/components/global/SignModal/LoginForm.tsx similarity index 100% rename from client/src/components/global/SignModal/components/LoginForm.tsx rename to client/src/components/global/SignModal/LoginForm.tsx diff --git a/client/src/components/global/SignModal/index.tsx b/client/src/components/global/SignModal/index.tsx index 3daac360..cabed9de 100644 --- a/client/src/components/global/SignModal/index.tsx +++ b/client/src/components/global/SignModal/index.tsx @@ -5,7 +5,7 @@ import { Modal, Typography, Divider } from 'antd' import React from 'react' // Local files -import { LoginForm } from './components/LoginForm' +import { LoginForm } from './LoginForm' import { SignModalProps } from '@/@types/components' import './style.less' diff --git a/client/src/components/pages/[feed]/FeedHeader.tsx b/client/src/components/pages/[feed]/FeedHeader.tsx index 4d9be48f..db9c3827 100644 --- a/client/src/components/pages/[feed]/FeedHeader.tsx +++ b/client/src/components/pages/[feed]/FeedHeader.tsx @@ -26,19 +26,19 @@ import { import React, { useState } from 'react' import { format, parseISO } from 'date-fns' import { useRouter } from 'next/router' +import stringToColor from 'string-to-color' // Local files import { getUserRateOfTitle, rateTitle, deleteTitle } from '@/services/api' import { SignModal } from '@/components/global/SignModal' import { API_URL } from '@/../config/constants' import { FeedHeaderProps } from '@/@types/pages' -import '@/styles/components/[feed]/style.less' +import './style.less' const FeedHeader: React.FC = (props): JSX.Element => { const { titleData, openUpdateModal, - categoryData, accessToken, averageTitleRate, refreshTitleRate, @@ -73,6 +73,18 @@ const FeedHeader: React.FC = (props): JSX.Element => { .catch(_error => setInitialRatingModalValue(0)) } + const handleTagsView = (tags: string[]) => { + return tags.map(tag => { + return ( +
+ 0xffffff / 2) ? '#000' : '#fff', background: (parseInt(stringToColor(tag).replace('#', ''), 16) > 0xffffff / 2) ? '#fff' : '#000', opacity: 0.9 }}> + #{tag} + +
+ ) + }) + } + const handleRateModalRender = (): JSX.Element => ( = (props): JSX.Element => { value: titleData.attributes.name }, { - title: 'Category', - value: categoryData.attributes.name + title: 'Tags', + value: titleData.attributes.tags }, { title: 'Entry Count', @@ -159,6 +171,7 @@ const FeedHeader: React.FC = (props): JSX.Element => { @@ -188,7 +201,7 @@ const FeedHeader: React.FC = (props): JSX.Element => { - {categoryData.attributes.name} + {handleTagsView(titleData.attributes.tags)} diff --git a/client/src/styles/components/[feed]/style.less b/client/src/components/pages/[feed]/style.less similarity index 100% rename from client/src/styles/components/[feed]/style.less rename to client/src/components/pages/[feed]/style.less diff --git a/client/src/components/pages/create-feed/Step1/index.tsx b/client/src/components/pages/create-feed/Step1/index.tsx index 782e6b18..72f86eb4 100644 --- a/client/src/components/pages/create-feed/Step1/index.tsx +++ b/client/src/components/pages/create-feed/Step1/index.tsx @@ -1,17 +1,17 @@ // Antd dependencies -import { Form, Button, Input } from 'antd' +import { Form, Button, Input, Select, Typography } from 'antd' // Other dependencies import React, { useContext, useState } from 'react' // Local files -import { CategorySelect } from '@/components/global/CategorySelect' import { PageHelmet } from '@/components/global/PageHelmet' import { Step1Props } from '@/@types/pages' import { ImageUpload } from '@/components/global/ImageUpload' import { ListOfSimilarFeeds } from '@/components/global/ListOfSimilarFeeds' import { StepContext } from '@/services/step.context.service' -import '@/styles/components/StepForm/style.less' +import { searchTagByName } from '@/services/api' +import '../style.less' const formItemLayout = { labelCol: { @@ -24,12 +24,14 @@ const formItemLayout = { const Step1: React.FC = (props): JSX.Element => { const [form] = Form.useForm() + const [tagResult, setTagResult] = useState([]) + const [noTagDataMessage, setNoTagDataMessage] = useState('Enter at least 3 characters to search') const [titleValue, setTitleValue] = useState('') - const { createTitleFormData, readableCategoryValue } = useContext(StepContext) - const { setCreateTitleFormData, stepMovementTo, setReadableCategoryValue } = props + const { createTitleFormData } = useContext(StepContext) + const { setCreateTitleFormData, stepMovementTo, setReadableTagValue } = props - const handleFormValidation = (): void => { - if (!createTitleFormData.categoryId || !form.getFieldValue('title')) return + const handleFormValidation = async (): Promise => { + await form.validateFields() setCreateTitleFormData({ ...createTitleFormData, name: form.getFieldValue('title') @@ -37,12 +39,32 @@ const Step1: React.FC = (props): JSX.Element => { stepMovementTo('create-entry') } - const handleReadableCategoryValue = (id: string | string[], title: React.ReactNode[]): void => { + const handleReadableTagValue = (tags: string[]): void => { setCreateTitleFormData({ ...createTitleFormData, - categoryId: id, + tags, }) - setReadableCategoryValue(title[0]) + setReadableTagValue(tags) + } + + const handleTagSearching = (value: string): void => { + if (value.length < 3) { + setTagResult([]) + setNoTagDataMessage('Enter at least 3 characters to search') + } + + else { + searchTagByName(value).then(({ data }) => { + const result = [] + + data.attributes.tags.map(tag => { + result.push({tag.name}) + }) + + if (result.length !== 0) setTagResult(result) + else setTagResult([{value}]) + }) + } } @@ -73,7 +95,7 @@ const Step1: React.FC = (props): JSX.Element => {
@@ -87,22 +109,30 @@ const Step1: React.FC = (props): JSX.Element => { ({ validator() { - if (!createTitleFormData.categoryId) return Promise.reject('Please select category') + if (!createTitleFormData.tags || createTitleFormData.tags.length < 1) return Promise.reject('Please select atleast one tag') return Promise.resolve() } }) ]} > - + diff --git a/client/src/components/pages/create-feed/Step2/index.tsx b/client/src/components/pages/create-feed/Step2/index.tsx index c572f616..7ff91f5c 100644 --- a/client/src/components/pages/create-feed/Step2/index.tsx +++ b/client/src/components/pages/create-feed/Step2/index.tsx @@ -1,16 +1,17 @@ // Antd dependencies -import { Form, Button, Descriptions, Divider, Modal, Avatar, Rate } from 'antd' +import { Form, Button, Descriptions, Divider, Modal, Avatar, Rate, Typography } from 'antd' import { ExclamationCircleOutlined, LoadingOutlined } from '@ant-design/icons' import TextArea from 'antd/lib/input/TextArea' // Other dependencies import React, { useContext, useState } from 'react' +import stringToColor from 'string-to-color' // Local files import { PageHelmet } from '@/components/global/PageHelmet' import { StepContext } from '@/services/step.context.service' import { Step2Props } from '@/@types/pages' -import '@/styles/components/StepForm/style.less' +import '../style.less' const formItemLayout = { labelCol: { @@ -23,7 +24,7 @@ const formItemLayout = { const Step2 = (props: Step2Props): JSX.Element => { const [form] = Form.useForm() - const { createTitleFormData, readableCategoryValue, firstEntryForm, titleRate } = useContext(StepContext) + const { createTitleFormData, readableTagValue, firstEntryForm, titleRate } = useContext(StepContext) const { stepMovementTo, setFirstEntryForm, setIsRequestReady, setTitleRate } = props const [isRequestStarted, setIsRequestStarted] = useState(false) @@ -79,8 +80,16 @@ const Step2 = (props: Step2Props): JSX.Element => { alt="Title Image" /> - - { readableCategoryValue } + + {readableTagValue.map(tag => { + return ( +
+ 0xffffff / 2) ? '#000' : '#fff', background: (parseInt(stringToColor(tag).replace('#', ''), 16) > 0xffffff / 2) ? '#fff' : '#000', opacity: 0.9 }}> + #{tag} + +
+ ) + })}
{ createTitleFormData.name } diff --git a/client/src/components/pages/create-feed/Step3/index.tsx b/client/src/components/pages/create-feed/Step3/index.tsx index 7828ba6c..8f8550d0 100644 --- a/client/src/components/pages/create-feed/Step3/index.tsx +++ b/client/src/components/pages/create-feed/Step3/index.tsx @@ -1,19 +1,20 @@ // Antd dependencies -import { Button, Result, Descriptions } from 'antd' +import { Button, Result, Descriptions, Typography } from 'antd' // Other dependencies import React, { useContext } from 'react' import { useRouter } from 'next/router' +import stringToColor from 'string-to-color' // Local files import { PageHelmet } from '@/components/global/PageHelmet' import { StepContext } from '@/services/step.context.service' import { Step3Props } from '@/@types/pages' -import '@/styles/components/StepForm/style.less' +import '../style.less' const Step3 = ({ titleSlugForRouting, feedCreatedSuccessfully }: Step3Props): JSX.Element => { const router = useRouter() - const { createTitleFormData, readableCategoryValue, firstEntryForm } = useContext(StepContext) + const { createTitleFormData, readableTagValue, firstEntryForm } = useContext(StepContext) const onFinish = () => router.push('/') const handleOnPostRoute = () => router.push('/[feed]', `/${titleSlugForRouting}`) @@ -21,8 +22,16 @@ const Step3 = ({ titleSlugForRouting, feedCreatedSuccessfully }: Step3Props): JS const information = (
- - { readableCategoryValue } + + {readableTagValue.map(tag => { + return ( +
+ 0xffffff / 2) ? '#000' : '#fff', background: (parseInt(stringToColor(tag).replace('#', ''), 16) > 0xffffff / 2) ? '#fff' : '#000', opacity: 0.9 }}> + #{tag} + +
+ ) + })}
{ createTitleFormData.name } diff --git a/client/src/styles/components/StepForm/style.less b/client/src/components/pages/create-feed/style.less similarity index 100% rename from client/src/styles/components/StepForm/style.less rename to client/src/components/pages/create-feed/style.less diff --git a/client/src/components/pages/feeds/AdditionalBlock/index.tsx b/client/src/components/pages/feeds/AdditionalBlock/index.tsx index dcca2559..a875c7cf 100644 --- a/client/src/components/pages/feeds/AdditionalBlock/index.tsx +++ b/client/src/components/pages/feeds/AdditionalBlock/index.tsx @@ -61,7 +61,7 @@ export const AdditionalBlock = (): JSX.Element => { Feednext © 2020. All rights reserved - + v{packageJson.version} diff --git a/client/src/components/pages/feeds/FlowHeader/index.tsx b/client/src/components/pages/feeds/FlowHeader/index.tsx index 508ae578..e95bd7f3 100644 --- a/client/src/components/pages/feeds/FlowHeader/index.tsx +++ b/client/src/components/pages/feeds/FlowHeader/index.tsx @@ -22,22 +22,14 @@ const FlowHeader: React.FC = (props): JSX.Element => { } const handleFilterReset = (): void => { - props.resetCategoryFilter() + props.beforeFilterReset() + props.resetTagFilter() props.setSortBy(undefined) } return ( - = (props): JSX.Element => { + const [tagResult, setTagResult] = useState([]) + const [selectedValues, setSelectedValues] = useState(props.tagFilter) + const [noDataMessage, setNoDataMessage] = useState('Enter at least 3 characters to search') + + useEffect(() => { + setSelectedValues(props.tagFilter) + }, [props.tagFilter]) + + const handleTagSelect = (value: string): void => { + props.setTagFilter(value) + } + + const handleTagSearching = (value: string): void => { + if (value.length < 3) { + setTagResult([]) + setNoDataMessage('Enter at least 3 characters to search') + } + + else { + searchTagByName(value).then(({ data }) => { + const result = [] + + data.attributes.tags.map(tag => { + result.push({tag.name}) + }) + + if (result.length === 0) setNoDataMessage('Couldn\'t find any tag') + else setTagResult(result) + }) + } + } + + const handleDeSelect = (tag: string) => { + props.beforeTagDeSelect() + const updatedList = selectedValues.filter(value => value !== tag) + props.updateTagFilterList(updatedList.toString()) + } + + const handleOnTagClear = () => { + props.beforeTagDeSelect() + setTagResult([]) + setNoDataMessage('Enter at least 3 characters to search') + props.updateTagFilterList('') + } + + return ( + + Search & Filter Tags + + + ) +} diff --git a/client/src/components/pages/help/helpMenus.tsx b/client/src/components/pages/help/helpMenus.tsx index 620301cc..1f13bf21 100644 --- a/client/src/components/pages/help/helpMenus.tsx +++ b/client/src/components/pages/help/helpMenus.tsx @@ -11,7 +11,7 @@ import guidePng from '@/assets/guide.png' import securityPng from '@/assets/privacyAndSecurity.png' import rulesPng from '@/assets/rulesAndReporting.png' import content from './content.json' -import '@/styles/pages/help/style.less' +import './style.less' const helpMenus = [ { titleReadable: 'F.A.Q', title: 'f.a.q', logo: faqPng }, diff --git a/client/src/styles/pages/help/style.less b/client/src/components/pages/help/style.less similarity index 100% rename from client/src/styles/pages/help/style.less rename to client/src/components/pages/help/style.less diff --git a/client/src/components/pages/messages/ConversationList/index.tsx b/client/src/components/pages/messages/ConversationList/index.tsx index a6837738..7283fc3e 100644 --- a/client/src/components/pages/messages/ConversationList/index.tsx +++ b/client/src/components/pages/messages/ConversationList/index.tsx @@ -13,7 +13,6 @@ import { API_URL } from '@/../config/constants' import PageLoading from '@/components/global/PageLoading' import { ConversationListProps } from '@/@types/pages' import newMessagePng from '@/assets/newMessage.png' -import '@/styles/pages/messages/style.less' export const ConversationList: React.FC = (props): JSX.Element => { const router = useRouter() diff --git a/client/src/components/pages/settings/account-settings/index.tsx b/client/src/components/pages/settings/account-settings/index.tsx index 074d6388..f2aba8e5 100644 --- a/client/src/components/pages/settings/account-settings/index.tsx +++ b/client/src/components/pages/settings/account-settings/index.tsx @@ -10,7 +10,6 @@ import { useDispatch } from 'react-redux' import { uploadProfilePicture, updateUser } from '@/services/api' import { UPDATE_USER } from '@/redux/Actions/User' import { API_URL } from '@/../config/constants' -import '@/styles/pages/settings/style.less' export const AccountSettings = (params: AccountSettingsParams): JSX.Element => { const [imageUri, setImageUri] = useState(`${API_URL}/v1/user/pp?username=${params.user.username}`) diff --git a/client/src/pages/auth/email-confirmation/index.tsx b/client/src/pages/auth/email-confirmation/index.tsx index 63ff0c89..a99e19e4 100644 --- a/client/src/pages/auth/email-confirmation/index.tsx +++ b/client/src/pages/auth/email-confirmation/index.tsx @@ -11,8 +11,8 @@ import { useRouter, NextRouter } from 'next/router' import { PageHelmet } from '@/components/global/PageHelmet' import { verifyUpdatedEmail } from '@/services/api' import NotFoundPage from '@/pages/404' -import '@/styles/pages/auth/email-confirmation/style.less' import AuthLayout from '@/layouts/AuthLayout' +import './style.less' const EmailConfirmation: React.FunctionComponent = () => { const router: NextRouter & { query: { token?: string } } = useRouter() diff --git a/client/src/styles/pages/auth/email-confirmation/style.less b/client/src/pages/auth/email-confirmation/style.less similarity index 100% rename from client/src/styles/pages/auth/email-confirmation/style.less rename to client/src/pages/auth/email-confirmation/style.less diff --git a/client/src/pages/auth/sign-in/account-recover/index.tsx b/client/src/pages/auth/sign-in/account-recover/index.tsx index ed7c2cd5..3ad888ec 100644 --- a/client/src/pages/auth/sign-in/account-recover/index.tsx +++ b/client/src/pages/auth/sign-in/account-recover/index.tsx @@ -11,7 +11,7 @@ import { PageHelmet } from '@/components/global/PageHelmet' import { recoverAccountWithKey } from '@/services/api' import NotFoundPage from '@/pages/404' import AuthLayout from '@/layouts/AuthLayout' -import '@/styles/pages/auth/sign-in/account-recover/style.less' +import './style.less' const AccountRecover: React.FunctionComponent = () => { const router: NextRouter & { diff --git a/client/src/styles/pages/auth/sign-in/account-recover/style.less b/client/src/pages/auth/sign-in/account-recover/style.less similarity index 100% rename from client/src/styles/pages/auth/sign-in/account-recover/style.less rename to client/src/pages/auth/sign-in/account-recover/style.less diff --git a/client/src/pages/auth/sign-in/forgot-password/index.tsx b/client/src/pages/auth/sign-in/forgot-password/index.tsx index 22330586..012a8004 100644 --- a/client/src/pages/auth/sign-in/forgot-password/index.tsx +++ b/client/src/pages/auth/sign-in/forgot-password/index.tsx @@ -9,7 +9,7 @@ import React, { useState } from 'react' import { PageHelmet } from '@/components/global/PageHelmet' import { generateRecoveryKey } from '@/services/api' import AuthLayout from '@/layouts/AuthLayout' -import '@/styles/pages/auth/sign-in/forgot-password/style.less' +import './style.less' const ForgotPassword: React.FunctionComponent = () => { const [requestOnGoing, setRequestOnGoing] = useState(false) diff --git a/client/src/styles/pages/auth/sign-in/forgot-password/style.less b/client/src/pages/auth/sign-in/forgot-password/style.less similarity index 100% rename from client/src/styles/pages/auth/sign-in/forgot-password/style.less rename to client/src/pages/auth/sign-in/forgot-password/style.less diff --git a/client/src/pages/auth/sign-in/index.tsx b/client/src/pages/auth/sign-in/index.tsx index f3da03a1..067de8da 100644 --- a/client/src/pages/auth/sign-in/index.tsx +++ b/client/src/pages/auth/sign-in/index.tsx @@ -13,8 +13,9 @@ import { SIGN_IN } from '@/redux/Actions/User' import { SET_ACCESS_TOKEN } from '@/redux/Actions/Global' import { PageHelmet } from '@/components/global/PageHelmet' import { signIn } from '@/services/api' +import { withTranslation } from '@/../i18n' import AuthLayout from '@/layouts/AuthLayout' -import '@/styles/pages/auth/sign-in/style.less' +import './style.less' export declare interface FormDataType { usernameOrEmail: string @@ -22,7 +23,7 @@ export declare interface FormDataType { remember: boolean } -const Login: React.FunctionComponent = () => { +const Login: React.FunctionComponent = ({ t }) => { const router = useRouter() const [form] = Form.useForm() @@ -73,30 +74,30 @@ const Login: React.FunctionComponent = () => { - } placeholder="Username or Email" /> + } placeholder={t("loginPage:usernameOrEmail")} /> - - } placeholder="Password" /> + + } placeholder={t("loginPage:password")} /> - Remember me + {t("loginPage:rememberMe")} - Forgot Password + {t("loginPage:forgotPassword")} @@ -105,11 +106,11 @@ const Login: React.FunctionComponent = () => { - Create an Account + {t("loginPage:createAccount")} @@ -121,4 +122,4 @@ const Login: React.FunctionComponent = () => { ) } -export default Login +export default withTranslation('loginPage')(Login) diff --git a/client/src/styles/pages/auth/sign-in/style.less b/client/src/pages/auth/sign-in/style.less similarity index 100% rename from client/src/styles/pages/auth/sign-in/style.less rename to client/src/pages/auth/sign-in/style.less diff --git a/client/src/pages/auth/sign-up/account-verification/index.tsx b/client/src/pages/auth/sign-up/account-verification/index.tsx index 896bcfdc..de2ded55 100644 --- a/client/src/pages/auth/sign-up/account-verification/index.tsx +++ b/client/src/pages/auth/sign-up/account-verification/index.tsx @@ -11,7 +11,7 @@ import { PageHelmet } from '@/components/global/PageHelmet' import { verifyAccount } from '@/services/api' import NotFoundPage from '@/pages/404' import AuthLayout from '@/layouts/AuthLayout' -import '@/styles/pages/auth/sign-up/account-verification/style.less' +import './style.less' const AccountVerification: React.FunctionComponent = () => { const router: NextRouter & { query: { token?: string } } = useRouter() diff --git a/client/src/styles/pages/auth/sign-up/account-verification/style.less b/client/src/pages/auth/sign-up/account-verification/style.less similarity index 100% rename from client/src/styles/pages/auth/sign-up/account-verification/style.less rename to client/src/pages/auth/sign-up/account-verification/style.less diff --git a/client/src/pages/auth/sign-up/index.tsx b/client/src/pages/auth/sign-up/index.tsx index 9ae11fc0..2ef93e7d 100644 --- a/client/src/pages/auth/sign-up/index.tsx +++ b/client/src/pages/auth/sign-up/index.tsx @@ -11,8 +11,9 @@ import { signUp } from '@/services/api' import { PageHelmet } from '@/components/global/PageHelmet' import RegisterResult from '@/components/pages/sign-up/result' import { Aggrements } from '@/components/global/Aggrements' +import { withTranslation } from '@/../i18n' import AuthLayout from '@/layouts/AuthLayout' -import '@/styles/pages/auth/sign-up/style.less' +import './style.less' export declare interface FormDataType { fullName: string @@ -21,7 +22,7 @@ export declare interface FormDataType { password: string } -const Register = () => { +const Register: React.FunctionComponent = ({ t }) => { const [requestOnGoing, setRequestOnGoing] = useState(false) const [signedAccount, setSignedAccount] = useState(null) const [aggrementModalVisibility, setAggrementModalVisibilit] = useState(null) @@ -46,7 +47,7 @@ const Register = () => { const handleSubmitButtonView = () => ( ) @@ -72,34 +73,34 @@ const Register = () => { - } placeholder="Full Name" /> + } placeholder={t("registerPage:fullName")} /> - } placeholder="Username" /> + } placeholder={t("registerPage:username")} /> - } placeholder="Email" /> + } placeholder={t("registerPage:email")} /> { rules={[ { required: true, - message: 'Please input your password!', + message: t("registerPage:validationErrorPassword"), }, ]} hasFeedback > - } placeholder="Password" /> + } placeholder={t("registerPage:password")} /> { rules={[ { required: true, - message: 'Please confirm your password!', + message: t("registerPage:validationErrorConfirmPassword"), }, ({ getFieldValue }) => ({ validator(rule, value) { if (!value || getFieldValue('password') === value) { return Promise.resolve() } - return Promise.reject('The two passwords that you entered do not match!') + return Promise.reject(t("registerPage:validationErrorPasswordMatch")) }, }), ]} > - } placeholder="Confirm Password" /> + } placeholder={t("registerPage:confirmPassword")} /> { rules={[ { validator: (_, value) => - value ? Promise.resolve() : Promise.reject('You must accept the privacy policy and terms & conditions'), + value ? Promise.resolve() : Promise.reject(t("registerPage:validationErrorTermsAndPolicy")), }, ]} > - I have read the - {' '} {' '} - and + , {' '} + {' '} + {t("registerPage:readAndUnderstood")} {handleSubmitButtonView()} - Already have an Account? + {t("registerPage:alreadyHaveAnAccount")} @@ -185,4 +186,4 @@ const Register = () => { ) } -export default Register +export default withTranslation('registerPage')(Register) diff --git a/client/src/styles/pages/auth/sign-up/style.less b/client/src/pages/auth/sign-up/style.less similarity index 100% rename from client/src/styles/pages/auth/sign-up/style.less rename to client/src/pages/auth/sign-up/style.less diff --git a/client/src/pages/entry/[id]/index.tsx b/client/src/pages/entry/[id]/index.tsx index 6bf3a0e6..c88cdea9 100644 --- a/client/src/pages/entry/[id]/index.tsx +++ b/client/src/pages/entry/[id]/index.tsx @@ -5,31 +5,44 @@ import { ArrowUpOutlined } from '@ant-design/icons' // Other dependencies import React, { useState } from 'react' import { useRouter } from 'next/router' +import stringToColor from 'string-to-color' // Local files -import { API_URL, Guest } from '@/../config/constants' +import { API_URL } from '@/../config/constants' import { TitleResponseData, EntryResponseData } from '@/@types/api' import { PageHelmet } from '@/components/global/PageHelmet' import { getEntryPageInitialValues } from '@/services/initializations/[entry]' import { NextPage } from 'next' import { EntryPageInitials } from '@/@types/initializations' import { AppLayout } from '@/layouts/AppLayout' +import { Roles } from '@/enums' import NotFoundPage from '../../404' const Entry: NextPage = (props): JSX.Element => { const router = useRouter() const [title, setTitle] = useState(props.title) - const [categoryName, setCategoryName] = useState(props.categoryName) const [averageTitleRate, setAverageTitleRate] = useState(props.averageTitleRate) const [entryData, setEntryData] = useState(props.entryData) if (!title) return + const handleTagsView = (tags: string[]) => { + return tags.map(tag => { + return ( +
+ 0xffffff / 2) ? '#000' : '#fff', background: (parseInt(stringToColor(tag).replace('#', ''), 16) > 0xffffff / 2) ? '#fff' : '#000', opacity: 0.9 }}> + #{tag} + +
+ ) + }) + } + const handleHeaderTitleSection = (): JSX.Element => ( <> - {categoryName} + {handleTagsView(title.attributes.tags)} = (props): JSX.Element => { ) return ( - + { } return ( - + { return ( - + { @@ -77,7 +78,7 @@ const Compose: React.FC = (): JSX.Element => { const handleOnSelect = (username: string): void => setMessageForm({ ...messageForm, to: username }) return ( - + { const [currentConversations, setCurrentConversations] = useState<{ @@ -40,7 +40,7 @@ const Messages = (): JSX.Element => { } return ( - + { const user = useSelector((state: any) => state.user?.attributes.user) const accessToken = useSelector((state: any) => state.global.accessToken) return ( - + .ant-tabs-nav .ant-tabs-nav-more, .ant-tabs > div > .ant-tabs-nav .ant-tabs-nav-more { - display: none; -} - -canvas { - display: block; -} - -body { - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -ul, -ol { - list-style: none; -} - -:global(.ant-col-xxl-18) { - max-width: 1350px; -} - -#nprogress .bar { - background: #6ec49a !important; -} - -.navBarlogo { - height: 40px; -} - -.ant-menu-submenu { - display: none !important; -} - -.ant-layout-header { - cursor: default; - background-color: @navbar-background; - color: @navbar-font-color; -} - -.ant-layout-header > ul { - background-color: @navbar-background; - color: @navbar-font-color; -} - -@media (max-width: @screen-xs) { - .ant-table { - width: 100%; - overflow-x: auto; - &-thead > tr, - &-tbody > tr { - > th, - > td { - white-space: pre; - > span { - display: block; - } - } - } - } -} - -// Compatible with IE11 -@media screen and(-ms-high-contrast: active), (-ms-high-contrast: none) { - body > .ant-layout { - min-height: 100vh; - } -} diff --git a/client/src/styles/pages/create-feed/style.less b/client/src/styles/pages/create-feed/style.less deleted file mode 100644 index 9cf414b8..00000000 --- a/client/src/styles/pages/create-feed/style.less +++ /dev/null @@ -1,90 +0,0 @@ -@import '~antd/es/style/themes/default.less'; - -.card { - margin-bottom: 24px; -} - -.heading { - margin: 0 0 16px; - font-size: 14px; - line-height: 22px; -} - -.steps:global(.ant-steps) { - max-width: 750px; - margin: 16px auto; -} - -.errorIcon { - margin-right: 24px; - color: @error-color; - cursor: pointer; - span.anticon { - margin-right: 4px; - } -} - -.errorPopover { - :global { - .ant-popover-inner-content { - min-width: 256px; - max-height: 290px; - padding: 0; - overflow: auto; - } - } -} - -.errorListItem { - padding: 8px 16px; - list-style: none; - border-bottom: 1px solid @border-color-split; - cursor: pointer; - transition: all 0.3s; - &:hover { - background: @primary-1; - } - &:last-child { - border: 0; - } - .errorIcon { - float: left; - margin-top: 4px; - margin-right: 12px; - padding-bottom: 22px; - color: @error-color; - } - .errorField { - margin-top: 2px; - color: @text-color-secondary; - font-size: 12px; - } -} - -.editable { - td { - padding-top: 13px !important; - padding-bottom: 12.5px !important; - } -} - -// custom footer for fixed footer toolbar -.advancedForm + div { - padding-bottom: 64px; -} - -.advancedForm { - :global { - .ant-form .ant-row:last-child .ant-form-item { - margin-bottom: 24px; - } - .ant-table td { - transition: none !important; - } - } -} - -.optional { - color: @text-color-secondary; - font-style: normal; -}