0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00

feat(console): add update endpoint notice for custom domain (#3992)

This commit is contained in:
Xiao Yijun 2023-06-09 10:19:42 +08:00 committed by GitHub
parent eb4a5da9d2
commit 0511055d23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 10 deletions

View file

@ -19,6 +19,7 @@ type Props = {
href?: string;
onClick?: () => void;
variant?: 'plain' | 'shadow';
hasIcon?: boolean;
className?: string;
};
@ -29,6 +30,7 @@ function InlineNotification({
onClick,
severity = 'info',
variant = 'plain',
hasIcon = true,
className,
}: Props) {
return (
@ -40,11 +42,13 @@ function InlineNotification({
className
)}
>
<div className={styles.icon}>
{(severity === 'info' || severity === 'alert') && <Info />}
{severity === 'success' && <Success />}
{severity === 'error' && <Error />}
</div>
{hasIcon && (
<div className={styles.icon}>
{(severity === 'info' || severity === 'alert') && <Info />}
{severity === 'success' && <Success />}
{severity === 'error' && <Error />}
</div>
)}
<div className={styles.content}>{children}</div>
{action && href && (
<TextLink to={href}>

View file

@ -4,3 +4,7 @@
border: 1px solid var(--color-divider);
border-radius: 12px;
}
.notice {
margin-top: _.unit(3);
}

View file

@ -1,4 +1,8 @@
import { type Domain, DomainStatus } from '@logto/schemas';
import { Trans, useTranslation } from 'react-i18next';
import InlineNotification from '@/components/InlineNotification';
import TextLink from '@/components/TextLink';
import ActivationProcess from './ActivationProcess';
import CustomDomainHeader from './CustomDomainHeader';
@ -10,13 +14,32 @@ type Props = {
};
function CustomDomain({ customDomain, onDeleteCustomDomain }: Props) {
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
return (
<div className={styles.container}>
<CustomDomainHeader customDomain={customDomain} onDeleteCustomDomain={onDeleteCustomDomain} />
{customDomain.status !== DomainStatus.Active && (
<ActivationProcess customDomain={customDomain} />
<>
<div className={styles.container}>
<CustomDomainHeader
customDomain={customDomain}
onDeleteCustomDomain={onDeleteCustomDomain}
/>
{customDomain.status !== DomainStatus.Active && (
<ActivationProcess customDomain={customDomain} />
)}
</div>
{customDomain.status === DomainStatus.Active && (
<InlineNotification className={styles.notice} severity="success" hasIcon={false}>
<Trans
components={{
// TODO LOG-6298 @xiaoyijun update this link when related docs are ready.
a: <TextLink to="#" />,
}}
>
{t('domain.update_endpoint_notice', { link: t('general.learn_more') })}
</Trans>
</InlineNotification>
)}
</div>
</>
);
}