Skip to content

Commit

Permalink
Migrate various components on the page
Browse files Browse the repository at this point in the history
  • Loading branch information
LuizFNJ committed Jan 18, 2025
1 parent b6ec068 commit c092f6e
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 31 deletions.
5 changes: 3 additions & 2 deletions src/components/AletheiaCaptcha.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReCAPTCHA>();

interface CaptchaProps {
Expand Down Expand Up @@ -43,7 +44,7 @@ const AletheiaCaptcha = forwardRef(({ onChange }: CaptchaProps, ref) => {
onExpired={onExpiredCaptcha}
/>
{showRequired && (
<Text type="danger">{t("common:requiredFieldError")}</Text>
<Typography variant="h1" style={{ color: colors.error, fontSize: 16 }} >{t("common:requiredFieldError")}</Typography>
)}
</div>
);
Expand Down
8 changes: 4 additions & 4 deletions src/components/ClaimReview/form/DynamicReviewTaskForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -230,9 +230,9 @@ const DynamicReviewTaskForm = ({ data_hash, personality, target }) => {
/>
<div style={{ paddingBottom: 20, marginLeft: 20 }}>
{reviewerError && (
<Text type="danger" data-cy="testReviewerError">
<Typography variant="body1" style={{ color: colors.error, fontSize: 16 }} data-cy="testReviewerError">
{t("reviewTask:invalidReviewerMessage")}
</Text>
</Typography>
)}
</div>
{events?.length > 0 && showButtons && (
Expand Down
4 changes: 2 additions & 2 deletions src/components/Collaborative/Components/Editor.style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
24 changes: 13 additions & 11 deletions src/components/Collaborative/Components/Editor.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -59,7 +61,7 @@ const Editor = ({
onClick: () => handleInsertNode(getContentHtml("data-summary-id")),
disabled: editable || summaryDisabled,
"data-cy": "testClaimReviewsummarizeAdd",
icon: <SummarizeIcon className="toolbar-item-icon" />,
icon: <Summarize className="toolbar-item-icon" />,
},
];

Expand All @@ -70,21 +72,21 @@ const Editor = ({
handleInsertNode(getContentHtml("data-verification-id")),
disabled: editable || verificationDisabled,
"data-cy": "testClaimReviewverificationAdd",
icon: <FactCheckIcon className="toolbar-item-icon" />,
icon: <FactCheck className="toolbar-item-icon" />,
},
{
onClick: () =>
handleInsertNode(getContentHtml("data-report-id")),
disabled: editable || reportDisabled,
"data-cy": "testClaimReviewreportAdd",
icon: <ReportProblemIcon className="toolbar-item-icon" />,
icon: <ReportProblem className="toolbar-item-icon" />,
},
{
onClick: () =>
handleInsertNode(getContentHtml("data-question-id")),
disabled: editable,
"data-cy": "testClaimReviewquestionsAdd",
icon: <QuestionMarkIcon className="toolbar-item-icon" />,
icon: <QuestionMark className="toolbar-item-icon" />,
}
);
}
Expand All @@ -98,14 +100,14 @@ const Editor = ({
<div className="toolbar">
{actions ? (
actions.map(({ icon, ...props }) => (
<Button
<IconButton
key={props["data-cy"]}
className="toolbar-item"
style={{ outline: "none", border: "none" }}
{...props}
>
{icon}
</Button>
</IconButton>
))
) : (
<></>
Expand Down
8 changes: 3 additions & 5 deletions src/components/Form/DynamicForm.tsx
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -73,9 +71,9 @@ const DynamicForm = ({
)}
/>
{errors[fieldName] && (
<Text type="danger" style={{ marginLeft: 20 }}>
<Typography variant="body1" style={{ marginLeft: 20, color: colors.error, fontSize: 16 }}>
{t(errors[fieldName].message)}
</Text>
</Typography>
)}
</Grid>
</Grid>
Expand Down
14 changes: 7 additions & 7 deletions src/components/Toolbar/ReviewTaskAdminToolBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Col, Row } from "antd";
import { Grid, IconButton } from "@mui/material";
import { Toolbar } from "@mui/material";
import React, { useContext } from "react";
import ManageAccountsIcon from "@mui/icons-material/ManageAccounts";
Expand All @@ -23,23 +23,23 @@ const ReviewTaskAdminToolBar = () => {
};

return (
<Row justify="center" style={{ background: colors.lightNeutral }}>
<Col xs={22} lg={18}>
<Grid container justifyContent="center" style={{ background: colors.lightNeutral }}>
<Grid item xs={11} lg={9}>
<AdminToolBarStyle
namespace={nameSpace}
position="static"
style={{ boxShadow: "none", background: colors.lightNeutral }}
>
<Toolbar className="toolbar">
<div className="toolbar-item">
<Button onClick={handleReassignUser}>
<IconButton onClick={handleReassignUser}>
<ManageAccountsIcon />
</Button>
</IconButton>
</div>
</Toolbar>
</AdminToolBarStyle>
</Col>
</Row>
</Grid>
</Grid>
);
};

Expand Down

0 comments on commit c092f6e

Please sign in to comment.