Skip to content

Commit a29ef05

Browse files
authored
✨(front) add icon to button to configure a domain (#1054)
Added an icon to help understanding of the configuration button/tag
1 parent 40c39bd commit a29ef05

File tree

4 files changed

+54
-20
lines changed

4 files changed

+54
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to
1010

1111
### Added
1212

13+
- ✨(front) add icon to button to configure a domain
1314
- ✨(invitations) allow delete invitations mails domains access by an admin
1415
- ✨(front) delete invitations mails domains access
1516
- ✨(front) add show invitations mails domains access #1040

src/frontend/apps/desk/src/components/Tag.tsx

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import { Tooltip } from '@openfun/cunningham-react';
22
import { useTranslation } from 'react-i18next';
33

4-
import { Box } from '@/components';
4+
import { Box, Icon } from '@/components';
55
import { useCunninghamTheme } from '@/cunningham';
66

77
interface TagContentProps {
88
status: 'pending' | 'enabled' | 'disabled' | 'failed' | 'action_required';
99
showTooltip?: boolean;
1010
tooltipType?: 'domain' | 'mail';
1111
placement?: 'top' | 'bottom';
12+
showIcon?: boolean;
1213
}
1314

14-
const TagContent = ({ status }: TagContentProps) => {
15+
const TagContent = ({ status, showIcon }: TagContentProps) => {
1516
const { colorsTokens } = useCunninghamTheme();
1617
const { t } = useTranslation();
1718

@@ -33,17 +34,35 @@ const TagContent = ({ status }: TagContentProps) => {
3334

3435
return (
3536
<Box
37+
$display="flex"
38+
$direction="row"
39+
$gap="4px"
3640
$background={backgroundColor[status]}
3741
$color={textColor[status]}
3842
$radius="4px"
3943
$css={`
4044
padding: 4px 8px;
4145
font-weight: 600;
42-
cursor: default;
4346
text-transform: capitalize;
4447
`}
4548
>
4649
{t(status).replace('_', ' ')}
50+
{showIcon &&
51+
(status === 'enabled' ? (
52+
<Icon
53+
$size="small"
54+
$weight="bold"
55+
iconName="check"
56+
$color="inherit"
57+
/>
58+
) : (
59+
<Icon
60+
$size="small"
61+
$weight="bold"
62+
iconName="arrow_forward"
63+
$color="inherit"
64+
/>
65+
))}
4766
</Box>
4867
);
4968
};
@@ -80,10 +99,10 @@ export const Tag = ({ ...props }: TagContentProps) => {
8099
return props.showTooltip ? (
81100
<Tooltip content={tooltipContent} placement={props.placement || 'top'}>
82101
<Box>
83-
<TagContent status={props.status} />
102+
<TagContent status={props.status} showIcon={props.showIcon} />
84103
</Box>
85104
</Tooltip>
86105
) : (
87-
<TagContent status={props.status} />
106+
<TagContent status={props.status} showIcon={props.showIcon} />
88107
);
89108
};

src/frontend/apps/desk/src/features/mail-domains/domains/components/MailDomainView.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,22 +89,22 @@ export const MailDomainView = ({
8989
{mailDomain.name}
9090
</Text>
9191

92-
{(mailDomain?.status === 'pending' ||
93-
mailDomain?.status === 'action_required' ||
94-
mailDomain?.status) && (
92+
{mailDomain?.status && (
9593
<button
9694
data-testid="actions_required"
9795
onClick={handleShowModal}
9896
style={{
9997
backgroundColor: 'transparent',
10098
border: 'none',
99+
cursor: 'pointer',
101100
}}
102101
>
103102
<Tag
104103
showTooltip={true}
105104
status={mailDomain.status}
106105
tooltipType="domain"
107106
placement="bottom"
107+
showIcon={true}
108108
></Tag>
109109
</button>
110110
)}

src/frontend/apps/desk/src/features/mail-domains/domains/components/ModalRequiredActionDomain.tsx

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,27 @@ export const ModalRequiredActionDomain = ({
4747

4848
const steps = [
4949
{
50-
title: t('Required actions on domain'),
50+
title:
51+
mailDomain.status !== 'enabled'
52+
? t('Required actions on domain')
53+
: t('Domain configuration'),
5154
content: (
5255
<Text>
53-
<p>
54-
{t(
55-
'The domain is currently in action required status. Please take the necessary actions to resolve those following issues.',
56-
)}
57-
</p>
58-
<h3>{t('Actions required detail')}</h3>
59-
<pre>
60-
{mailDomain.action_required_details &&
61-
Object.entries(mailDomain.action_required_details).map(
56+
{mailDomain.status !== 'enabled' ? (
57+
<>
58+
<p>
59+
{t(
60+
'The domain is currently in action required status. Please take the necessary actions to resolve those following issues.',
61+
)}
62+
</p>
63+
<h3>{t('Actions required detail')}</h3>
64+
</>
65+
) : (
66+
<p>{t('The domain is currently enabled.')}</p>
67+
)}
68+
{mailDomain.action_required_details && (
69+
<pre>
70+
{Object.entries(mailDomain.action_required_details).map(
6271
([check, value], index) => (
6372
<ul key={`action-required-list-${index}`}>
6473
<li key={`action-required-${index}`}>
@@ -67,10 +76,15 @@ export const ModalRequiredActionDomain = ({
6776
</ul>
6877
),
6978
)}
70-
</pre>
79+
</pre>
80+
)}
7181
{mailDomain.expected_config && (
7282
<Box $margin={{ bottom: 'medium' }}>
73-
<h3>{t('DNS Configuration Required:')}</h3>
83+
<h3>
84+
{mailDomain.status === 'action_required'
85+
? t('DNS Configuration Required:')
86+
: t('DNS Configuration:')}
87+
</h3>
7488
<pre>
7589
<div
7690
style={{

0 commit comments

Comments
 (0)