Skip to content

Commit

Permalink
added helptext for rejected/failed templates
Browse files Browse the repository at this point in the history
  • Loading branch information
akanshaaa19 committed Nov 26, 2024
1 parent 5a3b2b6 commit adf4da2
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 4 deletions.
17 changes: 17 additions & 0 deletions src/assets/images/infoLight.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion src/components/UI/HelpIcon/HelpIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import styles from './HelpIcon.module.css';
import InfoIcon from 'assets/images/info.svg?react';
import LightInfoIcon from 'assets/images/infoLight.svg?react';
import { Tooltip } from '@mui/material';
import { HelpDataProps } from 'common/HelpData';

export interface HelpIconProps {
helpData?: HelpDataProps;
darkIcon?: boolean;
}

export const HelpIcon = ({
helpData = {
heading: '',
link: '',
},
darkIcon = true,
}: HelpIconProps) => {
return (
<Tooltip
Expand Down Expand Up @@ -44,7 +47,7 @@ export const HelpIcon = ({
arrow
>
<span data-testid="help-icon" className={styles.InfoIconContainer}>
<InfoIcon className={styles.InfoIcon} />
{darkIcon ? <InfoIcon className={styles.InfoIcon} /> : <LightInfoIcon className={styles.InfoIcon} />}
</span>
</Tooltip>
);
Expand Down
6 changes: 6 additions & 0 deletions src/containers/Template/List/Template.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
}

.AlignCenter span {
display: flex;
align-items: flex-start;
}

.Status svg {
Expand Down
34 changes: 32 additions & 2 deletions src/containers/Template/List/Template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import CopyAllOutlined from 'assets/images/icons/Flow/Copy.svg?react';
import { ProviderContext } from 'context/session';
import { copyToClipboardMethod, exportCsvFile, getFileExtension } from 'common/utils';
import { AutoComplete } from 'components/UI/Form/AutoComplete/AutoComplete';
import HelpIcon from 'components/UI/HelpIcon/HelpIcon';
import { Loading } from 'components/UI/Layout/Loading/Loading';
import { setNotification } from 'common/notification';
import { BULK_APPLY_SAMPLE_LINK } from 'config';
Expand Down Expand Up @@ -59,6 +60,10 @@ const getCategory = (category: string) => {
return <p className={styles.TableText}>{capitalizeFirstLetter(categoryName)}</p>;
};

const failedInfo = "The template has failed the review process at Gupshup's end.";
const rejectedInfo =
'The template has failed to be reviewed due to violations of the approval criteria. This status requires revising and resubmitting the template.';

export interface TemplateProps {
title: string;
listItem: string;
Expand Down Expand Up @@ -159,8 +164,33 @@ export const Template = ({
case 'REJECTED':
statusValue = (
<div className={styles.AlignCenter}>
<RejectedIcon />
{t('Rejected')}
<span>
<RejectedIcon />
{t('Rejected')}
</span>
<HelpIcon
darkIcon={false}
helpData={{
heading: rejectedInfo,
}}
/>
</div>
);
break;

Check warning on line 179 in src/containers/Template/List/Template.tsx

View check run for this annotation

Codecov / codecov/patch

src/containers/Template/List/Template.tsx#L179

Added line #L179 was not covered by tests

case 'FAILED':
statusValue = (

Check warning on line 182 in src/containers/Template/List/Template.tsx

View check run for this annotation

Codecov / codecov/patch

src/containers/Template/List/Template.tsx#L182

Added line #L182 was not covered by tests
<div className={styles.AlignCenter}>
<span>
<RejectedIcon />
{t('Failed')}
</span>
<HelpIcon
darkIcon={false}
helpData={{
heading: failedInfo,
}}
/>
</div>
);
break;
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -530,5 +530,6 @@
"Add Files": "Add Files",
"Add files to file search": "Add files to file search",
"First name is required.": "First Name is required.",
"Last name is required.": "Last name is required."
"Last name is required.": "Last name is required.",
"Failed": "Failed"
}

0 comments on commit adf4da2

Please sign in to comment.