(front) add icon to button to configure a domain (#1054)

Added an icon to help understanding of the configuration button/tag
This commit is contained in:
elvoisin
2026-02-11 16:39:42 +01:00
committed by GitHub
parent 40c39bd9ba
commit a29ef05d8b
4 changed files with 54 additions and 20 deletions

View File

@@ -10,6 +10,7 @@ and this project adheres to
### Added ### Added
- ✨(front) add icon to button to configure a domain
- ✨(invitations) allow delete invitations mails domains access by an admin - ✨(invitations) allow delete invitations mails domains access by an admin
- ✨(front) delete invitations mails domains access - ✨(front) delete invitations mails domains access
- ✨(front) add show invitations mails domains access #1040 - ✨(front) add show invitations mails domains access #1040

View File

@@ -1,7 +1,7 @@
import { Tooltip } from '@openfun/cunningham-react'; import { Tooltip } from '@openfun/cunningham-react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Box } from '@/components'; import { Box, Icon } from '@/components';
import { useCunninghamTheme } from '@/cunningham'; import { useCunninghamTheme } from '@/cunningham';
interface TagContentProps { interface TagContentProps {
@@ -9,9 +9,10 @@ interface TagContentProps {
showTooltip?: boolean; showTooltip?: boolean;
tooltipType?: 'domain' | 'mail'; tooltipType?: 'domain' | 'mail';
placement?: 'top' | 'bottom'; placement?: 'top' | 'bottom';
showIcon?: boolean;
} }
const TagContent = ({ status }: TagContentProps) => { const TagContent = ({ status, showIcon }: TagContentProps) => {
const { colorsTokens } = useCunninghamTheme(); const { colorsTokens } = useCunninghamTheme();
const { t } = useTranslation(); const { t } = useTranslation();
@@ -33,17 +34,35 @@ const TagContent = ({ status }: TagContentProps) => {
return ( return (
<Box <Box
$display="flex"
$direction="row"
$gap="4px"
$background={backgroundColor[status]} $background={backgroundColor[status]}
$color={textColor[status]} $color={textColor[status]}
$radius="4px" $radius="4px"
$css={` $css={`
padding: 4px 8px; padding: 4px 8px;
font-weight: 600; font-weight: 600;
cursor: default;
text-transform: capitalize; text-transform: capitalize;
`} `}
> >
{t(status).replace('_', ' ')} {t(status).replace('_', ' ')}
{showIcon &&
(status === 'enabled' ? (
<Icon
$size="small"
$weight="bold"
iconName="check"
$color="inherit"
/>
) : (
<Icon
$size="small"
$weight="bold"
iconName="arrow_forward"
$color="inherit"
/>
))}
</Box> </Box>
); );
}; };
@@ -80,10 +99,10 @@ export const Tag = ({ ...props }: TagContentProps) => {
return props.showTooltip ? ( return props.showTooltip ? (
<Tooltip content={tooltipContent} placement={props.placement || 'top'}> <Tooltip content={tooltipContent} placement={props.placement || 'top'}>
<Box> <Box>
<TagContent status={props.status} /> <TagContent status={props.status} showIcon={props.showIcon} />
</Box> </Box>
</Tooltip> </Tooltip>
) : ( ) : (
<TagContent status={props.status} /> <TagContent status={props.status} showIcon={props.showIcon} />
); );
}; };

View File

@@ -89,15 +89,14 @@ export const MailDomainView = ({
{mailDomain.name} {mailDomain.name}
</Text> </Text>
{(mailDomain?.status === 'pending' || {mailDomain?.status && (
mailDomain?.status === 'action_required' ||
mailDomain?.status) && (
<button <button
data-testid="actions_required" data-testid="actions_required"
onClick={handleShowModal} onClick={handleShowModal}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
border: 'none', border: 'none',
cursor: 'pointer',
}} }}
> >
<Tag <Tag
@@ -105,6 +104,7 @@ export const MailDomainView = ({
status={mailDomain.status} status={mailDomain.status}
tooltipType="domain" tooltipType="domain"
placement="bottom" placement="bottom"
showIcon={true}
></Tag> ></Tag>
</button> </button>
)} )}

View File

@@ -47,18 +47,27 @@ export const ModalRequiredActionDomain = ({
const steps = [ const steps = [
{ {
title: t('Required actions on domain'), title:
mailDomain.status !== 'enabled'
? t('Required actions on domain')
: t('Domain configuration'),
content: ( content: (
<Text> <Text>
{mailDomain.status !== 'enabled' ? (
<>
<p> <p>
{t( {t(
'The domain is currently in action required status. Please take the necessary actions to resolve those following issues.', 'The domain is currently in action required status. Please take the necessary actions to resolve those following issues.',
)} )}
</p> </p>
<h3>{t('Actions required detail')}</h3> <h3>{t('Actions required detail')}</h3>
</>
) : (
<p>{t('The domain is currently enabled.')}</p>
)}
{mailDomain.action_required_details && (
<pre> <pre>
{mailDomain.action_required_details && {Object.entries(mailDomain.action_required_details).map(
Object.entries(mailDomain.action_required_details).map(
([check, value], index) => ( ([check, value], index) => (
<ul key={`action-required-list-${index}`}> <ul key={`action-required-list-${index}`}>
<li key={`action-required-${index}`}> <li key={`action-required-${index}`}>
@@ -68,9 +77,14 @@ export const ModalRequiredActionDomain = ({
), ),
)} )}
</pre> </pre>
)}
{mailDomain.expected_config && ( {mailDomain.expected_config && (
<Box $margin={{ bottom: 'medium' }}> <Box $margin={{ bottom: 'medium' }}>
<h3>{t('DNS Configuration Required:')}</h3> <h3>
{mailDomain.status === 'action_required'
? t('DNS Configuration Required:')
: t('DNS Configuration:')}
</h3>
<pre> <pre>
<div <div
style={{ style={{