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

View file

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

View file

@ -1,4 +1,8 @@
import { type Domain, DomainStatus } from '@logto/schemas'; 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 ActivationProcess from './ActivationProcess';
import CustomDomainHeader from './CustomDomainHeader'; import CustomDomainHeader from './CustomDomainHeader';
@ -10,13 +14,32 @@ type Props = {
}; };
function CustomDomain({ customDomain, onDeleteCustomDomain }: Props) { function CustomDomain({ customDomain, onDeleteCustomDomain }: Props) {
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
return ( return (
<>
<div className={styles.container}> <div className={styles.container}>
<CustomDomainHeader customDomain={customDomain} onDeleteCustomDomain={onDeleteCustomDomain} /> <CustomDomainHeader
customDomain={customDomain}
onDeleteCustomDomain={onDeleteCustomDomain}
/>
{customDomain.status !== DomainStatus.Active && ( {customDomain.status !== DomainStatus.Active && (
<ActivationProcess customDomain={customDomain} /> <ActivationProcess customDomain={customDomain} />
)} )}
</div> </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>
)}
</>
); );
} }