From b6ec06862bd900c6ab7de3640bffc84faaf13362 Mon Sep 17 00:00:00 2001 From: LuizFNJ Date: Sat, 18 Jan 2025 13:59:14 +0100 Subject: [PATCH 1/2] migrate topics components to mui material --- src/components/topics/TagDisplay.style.tsx | 4 ++-- src/components/topics/TagDisplay.tsx | 2 +- src/components/topics/TagsList.tsx | 24 +++++++++++----------- src/components/topics/TopicForm.tsx | 8 ++++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/components/topics/TagDisplay.style.tsx b/src/components/topics/TagDisplay.style.tsx index 3df858da5..4257cae3c 100644 --- a/src/components/topics/TagDisplay.style.tsx +++ b/src/components/topics/TagDisplay.style.tsx @@ -1,7 +1,7 @@ -import { Col } from "antd"; +import { Grid } from "@mui/material"; import styled from "styled-components"; -const TagDisplayStyled = styled(Col)` +const TagDisplayStyled = styled(Grid)` margin: 16px 16px 12px 16px; margin-bottom: 12px; display: flex; diff --git a/src/components/topics/TagDisplay.tsx b/src/components/topics/TagDisplay.tsx index c394ebb84..05b57f646 100644 --- a/src/components/topics/TagDisplay.tsx +++ b/src/components/topics/TagDisplay.tsx @@ -17,7 +17,7 @@ const TagDisplay = ({ handleClose, tags, setShowTopicsForm }: ITagDisplay) => { const [isLoggedIn] = useAtom(isUserLoggedIn); return ( - + { }; return ( - + {tags.length <= 0 && {t("topics:noTopics")}} {tags && tags.map((tag) => ( - handleClose(tag?.value || tag)} + onClick={() => handleTagClick(tag?.label || tag)} + onDelete={editable ? () => handleClose(tag?.value || tag) : undefined} + deleteIcon={} style={{ + backgroundColor: colors.secondary, + color: colors.white, borderRadius: 32, padding: "4px 10px 2px", marginTop: 4, marginBottom: 4, cursor: "pointer", }} - onClick={() => handleTagClick(tag?.label || tag)} - > - {(tag?.label || tag).toUpperCase()} - + /> ))} - + ); }; diff --git a/src/components/topics/TopicForm.tsx b/src/components/topics/TopicForm.tsx index 7fca6d006..de7df3604 100644 --- a/src/components/topics/TopicForm.tsx +++ b/src/components/topics/TopicForm.tsx @@ -1,4 +1,4 @@ -import { Col } from "antd"; +import { Grid } from "@mui/material"; import React, { useState } from "react"; import { Controller, useForm } from "react-hook-form"; import FormControl from "@mui/joy/FormControl"; @@ -94,7 +94,7 @@ const TopicForm = ({ return (
- + ( - + {t("topics:addTopicsButton")} - + From 5de5cacb5b50369ffe1db60120aa50f4c500c86c Mon Sep 17 00:00:00 2001 From: LuizFNJ Date: Sat, 18 Jan 2025 14:02:15 +0100 Subject: [PATCH 2/2] Migrate various components on the page --- src/components/AletheiaCaptcha.tsx | 5 ++-- .../form/DynamicReviewTaskForm.tsx | 8 +++---- .../Collaborative/Components/Editor.style.tsx | 4 ++-- .../Collaborative/Components/Editor.tsx | 24 ++++++++++--------- src/components/Form/DynamicForm.tsx | 8 +++---- .../Toolbar/ReviewTaskAdminToolBar.tsx | 15 ++++++------ 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/components/AletheiaCaptcha.tsx b/src/components/AletheiaCaptcha.tsx index f9e956563..9545d80ec 100644 --- a/src/components/AletheiaCaptcha.tsx +++ b/src/components/AletheiaCaptcha.tsx @@ -2,7 +2,8 @@ import { useTranslation } from "next-i18next"; import React, { forwardRef, useImperativeHandle, useState } from "react"; import ReCAPTCHA from "react-google-recaptcha"; import { useAppSelector } from "../store/store"; -import Text from "antd/lib/typography/Text"; +import Typography from "@mui/material/Typography"; +import colors from "../styles/colors"; const recaptchaRef = React.createRef(); interface CaptchaProps { @@ -43,7 +44,7 @@ const AletheiaCaptcha = forwardRef(({ onChange }: CaptchaProps, ref) => { onExpired={onExpiredCaptcha} /> {showRequired && ( - {t("common:requiredFieldError")} + {t("common:requiredFieldError")} )} ); diff --git a/src/components/ClaimReview/form/DynamicReviewTaskForm.tsx b/src/components/ClaimReview/form/DynamicReviewTaskForm.tsx index b43b12e9c..de48e9716 100644 --- a/src/components/ClaimReview/form/DynamicReviewTaskForm.tsx +++ b/src/components/ClaimReview/form/DynamicReviewTaskForm.tsx @@ -12,8 +12,8 @@ import { VisualEditorContext } from "../../Collaborative/VisualEditorProvider"; import DynamicForm from "../../Form/DynamicForm"; import { ReviewTaskEvents } from "../../../machines/reviewTask/enums"; import { ReviewTaskMachineContext } from "../../../machines/reviewTask/ReviewTaskMachineProvider"; -import { Grid } from "@mui/material" -import Text from "antd/lib/typography/Text"; +import { Grid, Typography } from "@mui/material" +import colors from "../../../styles/colors"; import { isUserLoggedIn, currentUserId, @@ -230,9 +230,9 @@ const DynamicReviewTaskForm = ({ data_hash, personality, target }) => { />
{reviewerError && ( - + {t("reviewTask:invalidReviewerMessage")} - + )}
{events?.length > 0 && showButtons && ( diff --git a/src/components/Collaborative/Components/Editor.style.tsx b/src/components/Collaborative/Components/Editor.style.tsx index c5ab80fb8..487394856 100644 --- a/src/components/Collaborative/Components/Editor.style.tsx +++ b/src/components/Collaborative/Components/Editor.style.tsx @@ -37,8 +37,8 @@ const EditorStyle = styled.div` .toolbar-item:hover::after { content: ""; - border: 1px solid ${colors.primary}; - width: 4px; + background-color: ${colors.primary}; + width: 3px; height: 40px; } diff --git a/src/components/Collaborative/Components/Editor.tsx b/src/components/Collaborative/Components/Editor.tsx index 8aa20ba34..e4f4e433d 100644 --- a/src/components/Collaborative/Components/Editor.tsx +++ b/src/components/Collaborative/Components/Editor.tsx @@ -1,11 +1,13 @@ import React, { useCallback, useContext } from "react"; import { useHelpers, useCommands } from "@remirror/react"; -import SummarizeIcon from "@mui/icons-material/Summarize"; -import QuestionMarkIcon from "@mui/icons-material/QuestionMark"; -import ReportProblemIcon from "@mui/icons-material/ReportProblem"; -import FactCheckIcon from "@mui/icons-material/FactCheck"; -import { Button } from "antd"; +import { + Summarize, + QuestionMark, + ReportProblem, + FactCheck +} from "@mui/icons-material"; +import { IconButton } from "@mui/material"; import EditorStyle from "./Editor.style"; import useCardPresence from "../hooks/useCardPresence"; import { ReviewTaskMachineContext } from "../../../machines/reviewTask/ReviewTaskMachineProvider"; @@ -59,7 +61,7 @@ const Editor = ({ onClick: () => handleInsertNode(getContentHtml("data-summary-id")), disabled: editable || summaryDisabled, "data-cy": "testClaimReviewsummarizeAdd", - icon: , + icon: , }, ]; @@ -70,21 +72,21 @@ const Editor = ({ handleInsertNode(getContentHtml("data-verification-id")), disabled: editable || verificationDisabled, "data-cy": "testClaimReviewverificationAdd", - icon: , + icon: , }, { onClick: () => handleInsertNode(getContentHtml("data-report-id")), disabled: editable || reportDisabled, "data-cy": "testClaimReviewreportAdd", - icon: , + icon: , }, { onClick: () => handleInsertNode(getContentHtml("data-question-id")), disabled: editable, "data-cy": "testClaimReviewquestionsAdd", - icon: , + icon: , } ); } @@ -98,14 +100,14 @@ const Editor = ({
{actions ? ( actions.map(({ icon, ...props }) => ( - + )) ) : ( <> diff --git a/src/components/Form/DynamicForm.tsx b/src/components/Form/DynamicForm.tsx index 87b2332cd..4b6c45e98 100644 --- a/src/components/Form/DynamicForm.tsx +++ b/src/components/Form/DynamicForm.tsx @@ -1,9 +1,7 @@ -import { Grid } from "@mui/material"; - +import { Grid, Typography } from "@mui/material" import { Controller } from "react-hook-form"; import DynamicInput from "./DynamicInput"; import React from "react"; -import Text from "antd/lib/typography/Text"; import colors from "../../styles/colors"; import { useTranslation } from "next-i18next"; @@ -73,9 +71,9 @@ const DynamicForm = ({ )} /> {errors[fieldName] && ( - + {t(errors[fieldName].message)} - + )} diff --git a/src/components/Toolbar/ReviewTaskAdminToolBar.tsx b/src/components/Toolbar/ReviewTaskAdminToolBar.tsx index e1ad94878..88d81d0f3 100644 --- a/src/components/Toolbar/ReviewTaskAdminToolBar.tsx +++ b/src/components/Toolbar/ReviewTaskAdminToolBar.tsx @@ -1,5 +1,4 @@ -import { Button, Col, Row } from "antd"; -import { Toolbar } from "@mui/material"; +import { Grid, IconButton, Toolbar } from "@mui/material"; import React, { useContext } from "react"; import ManageAccountsIcon from "@mui/icons-material/ManageAccounts"; import AdminToolBarStyle from "./AdminToolBar.style"; @@ -23,8 +22,8 @@ const ReviewTaskAdminToolBar = () => { }; return ( - - + + { >
- +
- -
+ + ); };