Skip to content

Commit

Permalink
FI-2202: Add reactgfm to ReactMarkdown components (#421)
Browse files Browse the repository at this point in the history
* add reactgfm to markdown

* remove comment

---------

Co-authored-by: Alyssa Wang <[email protected]>
  • Loading branch information
AlyssaWang and AlyssaWang authored Jan 31, 2024
1 parent b178d40 commit d0dbe97
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 9 deletions.
3 changes: 2 additions & 1 deletion client/src/components/InputsModal/InputsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import InputTextArea from './InputTextArea';
import InputTextField from './InputTextField';
import CustomTooltip from '../_common/CustomTooltip';
import useStyles from './styles';
import remarkGfm from 'remark-gfm';

export interface InputsModalProps {
runnableType: RunnableType;
Expand Down Expand Up @@ -327,7 +328,7 @@ const InputsModal: FC<InputsModalProps> = ({
<DialogContent>
<main>
<DialogContentText component="div" style={{ wordBreak: 'break-word' }}>
<ReactMarkdown>
<ReactMarkdown remarkPlugins={[remarkGfm]}>
{instructions +
(inputType === 'Field'
? ''
Expand Down
1 change: 0 additions & 1 deletion client/src/components/Skeletons/AppSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { FC } from 'react';
import { Box } from '@mui/material';
import lightTheme from '~/styles/theme';
// import { AppBar, Box, Skeleton, Toolbar } from '@mui/material';
import { useAppStore } from '~/store/app';
import useStyles from '~/components/TestSuite/styles';
import DrawerSkeleton from '~/components/Skeletons/DrawerSkeleton';
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/SuiteOptionsPage/SuiteOptionsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import lightTheme from '~/styles/theme';
import SelectionPanel from '~/components/_common/SelectionPanel/SelectionPanel';
import useStyles from './styles';
import { basePath } from '~/api/infernoApiService';
import remarkGfm from 'remark-gfm';

export interface SuiteOptionsPageProps {
testSuite?: TestSuite;
Expand Down Expand Up @@ -163,7 +164,7 @@ const SuiteOptionsPage: FC<SuiteOptionsPageProps> = ({ testSuite }) => {
wordBreak: 'break-word',
}}
>
<ReactMarkdown>
<ReactMarkdown remarkPlugins={[remarkGfm]}>
{testSuite?.suite_summary || testSuite?.description || ''}
</ReactMarkdown>
</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Message, TestSuite } from '~/models/testSuiteModels';
import CustomTab from '~/components/_common/CustomTab';
import TabPanel from '../TestSuiteDetails/TestListItem/TabPanel';
import useStyles from './styles';
import remarkGfm from 'remark-gfm';

interface ConfigDetailsPanelProps {
testSuite: TestSuite;
Expand All @@ -24,7 +25,7 @@ const ConfigMessagesDetailsPanel: FC<ConfigDetailsPanelProps> = ({ testSuite: ru
{messages.length > 0 ? (
messages.map((message, index) => (
<Card key={index} variant="outlined" sx={{ px: 2, my: 2, overflow: 'auto' }}>
<ReactMarkdown>{message.message}</ReactMarkdown>
<ReactMarkdown remarkPlugins={[remarkGfm]}>{message.message}</ReactMarkdown>
</Card>
))
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import { TestGroup } from '~/models/testSuiteModels';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';

interface NestedDescriptionPanelProps {
testGroup: TestGroup;
Expand Down Expand Up @@ -56,7 +57,10 @@ const NestedDescriptionPanel: FC<NestedDescriptionPanelProps> = ({ testGroup })
title={descriptionMouseHover ? '' : `${testGroup.id}-description-detail`}
className={classes.accordionDetailContainer}
>
<ReactMarkdown className={`${classes.accordionDetail} ${classes.nestedDescription}`}>
<ReactMarkdown
remarkPlugins={[remarkGfm]}
className={`${classes.accordionDetail} ${classes.nestedDescription}`}
>
{testGroup.description as string}
</ReactMarkdown>
</AccordionDetails>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import useStyles from './styles';
import { Table, TableBody, TableRow, TableCell, Typography, TableHead, Box } from '@mui/material';
import { TestInput, TestOutput } from '~/models/testSuiteModels';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';

interface InputOutputListProps {
inputOutputs: TestInput[] | TestOutput[];
Expand Down Expand Up @@ -43,7 +44,7 @@ const InputOutputList: FC<InputOutputListProps> = ({
</Typography>
</TableCell>
<TableCell className={classes.inputOutputsValue}>
<ReactMarkdown className={classes.wordWrap}>
<ReactMarkdown remarkPlugins={[remarkGfm]} className={classes.wordWrap}>
{(inputOutputs?.value as string) || ''}
</ReactMarkdown>
</TableCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ReactMarkdown from 'react-markdown';

import MessageType from './MessageType';
import { sortByMessageType } from './helper';
import remarkGfm from 'remark-gfm';

interface MessageListProps {
messages: Message[];
Expand Down Expand Up @@ -34,7 +35,7 @@ const MessageList: FC<MessageListProps> = ({ messages }) => {
<MessageType type={message.type} />
</TableCell>
<TableCell className={classes.messageMessage}>
<ReactMarkdown>{message.message}</ReactMarkdown>
<ReactMarkdown remarkPlugins={[remarkGfm]}>{message.message}</ReactMarkdown>
</TableCell>
</TableRow>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import type { TabProps } from './TestRunDetail';
import { MessageCounts, countMessageTypes } from './helper';
import CustomTooltip from '~/components/_common/CustomTooltip';
import useStyles from './styles';
import remarkGfm from 'remark-gfm';

interface TestListItemProps {
test: Test;
Expand Down Expand Up @@ -84,7 +85,7 @@ const TestListItem: FC<TestListItemProps> = ({
primary={testLabel}
secondary={
test.result?.result_message && (
<ReactMarkdown className={classes.resultMessageMarkdown}>
<ReactMarkdown remarkPlugins={[remarkGfm]} className={classes.resultMessageMarkdown}>
{test.result.result_message}
</ReactMarkdown>
)
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/_common/ActionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '@mui/material';
import React, { FC } from 'react';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';

export interface ActionModalProps {
modalVisible: boolean;
Expand All @@ -21,7 +22,7 @@ const ActionModal: FC<ActionModalProps> = ({ modalVisible, message, cancelTestRu
<DialogTitle>User Action Required</DialogTitle>
<DialogContent>
<DialogContentText component="div">
<ReactMarkdown>{message || ''}</ReactMarkdown>
<ReactMarkdown remarkPlugins={[remarkGfm]}>{message || ''}</ReactMarkdown>
</DialogContentText>
</DialogContent>
<DialogActions>
Expand Down

0 comments on commit d0dbe97

Please sign in to comment.