0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

Merge pull request #6594 from logto-io/gao-au-region

feat(console): au region
This commit is contained in:
Gao Sun 2024-09-19 10:30:07 +08:00 committed by GitHub
commit 8e5127f90b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 384 additions and 51 deletions

View file

@ -52,7 +52,7 @@
"access": "public" "access": "public"
}, },
"devDependencies": { "devDependencies": {
"@logto/cloud": "0.2.5-582d792", "@logto/cloud": "0.2.5-1661979",
"@silverhand/eslint-config": "6.0.1", "@silverhand/eslint-config": "6.0.1",
"@silverhand/ts-config": "6.0.0", "@silverhand/ts-config": "6.0.0",
"@types/node": "^20.11.20", "@types/node": "^20.11.20",

View file

@ -27,7 +27,7 @@
"devDependencies": { "devDependencies": {
"@fontsource/roboto-mono": "^5.0.0", "@fontsource/roboto-mono": "^5.0.0",
"@jest/types": "^29.5.0", "@jest/types": "^29.5.0",
"@logto/cloud": "0.2.5-91ab76c", "@logto/cloud": "0.2.5-1661979",
"@logto/connector-kit": "workspace:^4.0.0", "@logto/connector-kit": "workspace:^4.0.0",
"@logto/core-kit": "workspace:^2.5.0", "@logto/core-kit": "workspace:^2.5.0",
"@logto/elements": "workspace:^0.0.1", "@logto/elements": "workspace:^0.0.1",

View file

@ -10,6 +10,7 @@ import CreateTenantHeaderIcon from '@/assets/icons/create-tenant-header.svg?reac
import { useCloudApi } from '@/cloud/hooks/use-cloud-api'; import { useCloudApi } from '@/cloud/hooks/use-cloud-api';
import { type TenantResponse } from '@/cloud/types/router'; import { type TenantResponse } from '@/cloud/types/router';
import Region, { RegionName } from '@/components/Region'; import Region, { RegionName } from '@/components/Region';
import { isDevFeaturesEnabled } from '@/consts/env';
import Button from '@/ds-components/Button'; import Button from '@/ds-components/Button';
import DangerousRaw from '@/ds-components/DangerousRaw'; import DangerousRaw from '@/ds-components/DangerousRaw';
import FormField from '@/ds-components/FormField'; import FormField from '@/ds-components/FormField';
@ -18,6 +19,7 @@ import RadioGroup, { Radio } from '@/ds-components/RadioGroup';
import TextInput from '@/ds-components/TextInput'; import TextInput from '@/ds-components/TextInput';
import useTheme from '@/hooks/use-theme'; import useTheme from '@/hooks/use-theme';
import modalStyles from '@/scss/modal.module.scss'; import modalStyles from '@/scss/modal.module.scss';
import { trySubmitSafe } from '@/utils/form';
import EnvTagOptionContent from './EnvTagOptionContent'; import EnvTagOptionContent from './EnvTagOptionContent';
import SelectTenantPlanModal from './SelectTenantPlanModal'; import SelectTenantPlanModal from './SelectTenantPlanModal';
@ -56,16 +58,18 @@ function CreateTenantModal({ isOpen, onClose }: Props) {
}; };
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
const onCreateClick = handleSubmit(async (data: CreateTenantData) => { const onCreateClick = handleSubmit(
const { tag } = data; trySubmitSafe(async (data: CreateTenantData) => {
if (tag === TenantTag.Development) { const { tag } = data;
await createTenant(data); if (tag === TenantTag.Development) {
toast.success(t('tenants.create_modal.tenant_created')); await createTenant(data);
return; toast.success(t('tenants.create_modal.tenant_created'));
} return;
}
setTenantData(data); setTenantData(data);
}); })
);
return ( return (
<Modal <Modal
@ -122,18 +126,21 @@ function CreateTenantModal({ isOpen, onClose }: Props) {
render={({ field: { onChange, value, name } }) => ( render={({ field: { onChange, value, name } }) => (
<RadioGroup type="small" name={name} value={value} onChange={onChange}> <RadioGroup type="small" name={name} value={value} onChange={onChange}>
{/* Manually maintaining the list of regions to avoid unexpected changes. We may consider using an API in the future. */} {/* Manually maintaining the list of regions to avoid unexpected changes. We may consider using an API in the future. */}
{[RegionName.EU, RegionName.US].map((region) => ( {[RegionName.EU, RegionName.US, RegionName.AU].map(
<Radio (region) =>
key={region} (isDevFeaturesEnabled || region !== RegionName.AU) && (
title={ <Radio
<DangerousRaw> key={region}
<Region regionName={region} /> title={
</DangerousRaw> <DangerousRaw>
} <Region regionName={region} />
value={region} </DangerousRaw>
isDisabled={isSubmitting} }
/> value={region}
))} isDisabled={isSubmitting}
/>
)
)}
</RadioGroup> </RadioGroup>
)} )}
/> />

View file

@ -0,0 +1,23 @@
<svg width="19" height="12" viewBox="0 0 19 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1692_21495)">
<path d="M0.333984 0H18.334V12H0.333984V0Z" fill="#00008B" />
<path
d="M1.38867 0L4.81992 2.2625L8.23711 0H9.33398V0.775L5.95898 3.0125L9.33398 5.2375V6H8.20898L4.83398 3.7625L1.47305 6H0.333984V5.25L3.69492 3.025L0.333984 0.8V0H1.38867Z"
fill="white" />
<path
d="M6.29648 3.5125L9.33398 5.5V6L5.52305 3.5125H6.29648ZM3.70898 3.7625L3.79336 4.2L1.09336 6H0.333984L3.70898 3.7625ZM9.33398 0V0.0375L5.83242 2.3875L5.86055 1.8375L8.63086 0H9.33398ZM0.333984 0L3.69492 2.2H2.85117L0.333984 0.525V0Z"
fill="#FF0000" />
<path d="M3.72305 0V6H5.97305V0H3.72305ZM0.333984 2V4H9.33398V2H0.333984Z" fill="white" />
<path d="M0.333984 2.4125V3.6125H9.33398V2.4125H0.333984ZM4.17305 0V6H5.52305V0H4.17305Z"
fill="#FF0000" />
<path
d="M14.7162 9.91746L14.2037 9.98246L14.2587 10.495L13.8887 10.135L13.5212 10.4975L13.5712 9.98496L13.0587 9.92496L13.4912 9.64496L13.2187 9.20746L13.7087 9.36996L13.8812 8.88246L14.0587 9.36746L14.5462 9.19996L14.2787 9.63996L14.7162 9.91746ZM14.6237 6.98746L14.6912 6.66246L14.4462 6.43746L14.7762 6.39996L14.9137 6.09746L15.0512 6.39996L15.3812 6.43746L15.1362 6.66246L15.2037 6.98746L14.9137 6.82246L14.6237 6.98746ZM12.0212 5.48746L11.5137 5.54246L11.5587 6.04996L11.1987 5.68746L10.8287 6.03996L10.8887 5.53246L10.3837 5.46496L10.8162 5.19496L10.5537 4.75746L11.0362 4.92746L11.2162 4.44996L11.3837 4.93246L11.8687 4.77496L11.5962 5.20746L12.0237 5.48746H12.0212ZM17.1162 4.66746L16.5937 4.73496L16.6512 5.25746L16.2737 4.88996L15.8987 5.25996L15.9512 4.73496L15.4287 4.67496L15.8712 4.38746L15.5937 3.93996L16.0937 4.10746L16.2687 3.61246L16.4487 4.10746L16.9462 3.93496L16.6712 4.38496L17.1162 4.66746ZM14.7137 2.57996L14.1962 2.63746L14.2437 3.15746L13.8762 2.78746L13.4987 3.14746L13.5587 2.62996L13.0412 2.55996L13.4837 2.28496L13.2162 1.83746L13.7087 2.00996L13.8912 1.52246L14.0612 2.01496L14.5562 1.85246L14.2787 2.29246L14.7137 2.57996ZM6.79125 9.64246L5.64625 9.77746L5.76125 10.925L4.94125 10.115L4.11625 10.92L4.23875 9.77246L3.09375 9.62746L4.06625 9.00746L3.46625 8.02246L4.55625 8.39746L4.95125 7.31246L5.33875 8.39996L6.43125 8.03246L5.82375 9.01246L6.79375 9.63996L6.79125 9.64246Z"
fill="white" />
</g>
<defs>
<clipPath id="clip0_1692_21495">
<rect x="0.333984" width="18" height="12" rx="1" fill="white" />
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -0,0 +1,131 @@
<svg width="19" height="12" viewBox="0 0 19 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1692_21196)">
<path d="M18.5 0H0.5V12H18.5V0Z" fill="#003399" />
<path d="M9.50195 1.33203L9.29594 1.96607L9.61296 2.06907L9.50195 1.33203Z" fill="#FFCC00" />
<path d="M9.50195 1.33203L9.70796 1.96607L9.39095 2.06907L9.50195 1.33203Z" fill="#FFCC00" />
<path d="M10.1357 1.79395L9.46908 1.79395L9.46908 2.12728L10.1357 1.79395Z" fill="#FFCC00" />
<path d="M10.1357 1.79395L9.5964 2.1858L9.40047 1.91613L10.1357 1.79395Z" fill="#FFCC00" />
<path d="M9.89355 2.53809L9.68754 1.90405L9.37052 2.00705L9.89355 2.53809Z" fill="#FFCC00" />
<path d="M9.89355 2.53809L9.35421 2.14623L9.55014 1.87656L9.89355 2.53809Z" fill="#FFCC00" />
<path d="M8.86816 1.79395L9.53483 1.79395L9.53483 2.12728L8.86816 1.79395Z" fill="#FFCC00" />
<path d="M8.86816 1.79395L9.40751 2.1858L9.60344 1.91613L8.86816 1.79395Z" fill="#FFCC00" />
<path d="M9.11035 2.53809L9.31636 1.90405L9.63338 2.00705L9.11035 2.53809Z" fill="#FFCC00" />
<path d="M9.11035 2.53809L9.6497 2.14623L9.45377 1.87656L9.11035 2.53809Z" fill="#FFCC00" />
<path d="M9.50195 9.33203L9.29594 9.96607L9.61296 10.0691L9.50195 9.33203Z" fill="#FFCC00" />
<path d="M9.50195 9.33203L9.70796 9.96607L9.39095 10.0691L9.50195 9.33203Z" fill="#FFCC00" />
<path d="M10.1357 9.79395L9.46908 9.79395L9.46908 10.1273L10.1357 9.79395Z" fill="#FFCC00" />
<path d="M10.1357 9.79395L9.5964 10.1858L9.40047 9.91613L10.1357 9.79395Z" fill="#FFCC00" />
<path d="M9.89355 10.5381L9.68754 9.90405L9.37052 10.0071L9.89355 10.5381Z" fill="#FFCC00" />
<path d="M9.89355 10.5381L9.35421 10.1462L9.55014 9.87656L9.89355 10.5381Z" fill="#FFCC00" />
<path d="M8.86816 9.79395L9.53483 9.79395L9.53483 10.1273L8.86816 9.79395Z" fill="#FFCC00" />
<path d="M8.86816 9.79395L9.40751 10.1858L9.60344 9.91613L8.86816 9.79395Z" fill="#FFCC00" />
<path d="M9.11035 10.5381L9.31636 9.90405L9.63338 10.0071L9.11035 10.5381Z" fill="#FFCC00" />
<path d="M9.11035 10.5381L9.6497 10.1462L9.45377 9.87656L9.11035 10.5381Z" fill="#FFCC00" />
<path d="M5.50195 5.33203L5.29594 5.96607L5.61296 6.06907L5.50195 5.33203Z" fill="#FFCC00" />
<path d="M5.50195 5.33203L5.70796 5.96607L5.39095 6.06907L5.50195 5.33203Z" fill="#FFCC00" />
<path d="M6.13574 5.79395L5.46908 5.79395L5.46908 6.12728L6.13574 5.79395Z" fill="#FFCC00" />
<path d="M6.13574 5.79395L5.5964 6.1858L5.40047 5.91613L6.13574 5.79395Z" fill="#FFCC00" />
<path d="M5.89355 6.53809L5.68754 5.90405L5.37052 6.00705L5.89355 6.53809Z" fill="#FFCC00" />
<path d="M5.89355 6.53809L5.35421 6.14623L5.55014 5.87656L5.89355 6.53809Z" fill="#FFCC00" />
<path d="M4.86816 5.79395L5.53483 5.79395L5.53483 6.12728L4.86816 5.79395Z" fill="#FFCC00" />
<path d="M4.86816 5.79395L5.40751 6.1858L5.60344 5.91613L4.86816 5.79395Z" fill="#FFCC00" />
<path d="M5.11035 6.53809L5.31636 5.90405L5.63338 6.00705L5.11035 6.53809Z" fill="#FFCC00" />
<path d="M5.11035 6.53809L5.6497 6.14623L5.45377 5.87656L5.11035 6.53809Z" fill="#FFCC00" />
<path d="M7.10938 3.07422L7.64872 2.68236L7.45279 2.41269L7.10938 3.07422Z" fill="#FFCC00" />
<path d="M7.10938 3.07422L7.31539 2.44018L7.63241 2.54319L7.10938 3.07422Z" fill="#FFCC00" />
<path d="M6.86719 2.32812L7.40653 2.71998L7.60246 2.45031L6.86719 2.32812Z" fill="#FFCC00" />
<path d="M6.86719 2.32812L7.53385 2.32812L7.53385 2.66146L6.86719 2.32812Z" fill="#FFCC00" />
<path d="M7.50195 1.86816L7.29594 2.5022L7.61296 2.60521L7.50195 1.86816Z" fill="#FFCC00" />
<path d="M7.50195 1.86816L7.70796 2.5022L7.39095 2.60521L7.50195 1.86816Z" fill="#FFCC00" />
<path d="M7.89258 3.07422L7.35323 2.68236L7.54916 2.41269L7.89258 3.07422Z" fill="#FFCC00" />
<path d="M7.89258 3.07422L7.68657 2.44018L7.36955 2.54319L7.89258 3.07422Z" fill="#FFCC00" />
<path d="M8.13574 2.33008L7.5964 2.72193L7.40047 2.45226L8.13574 2.33008Z" fill="#FFCC00" />
<path d="M8.13574 2.33008L7.46908 2.33008L7.46908 2.66341L8.13574 2.33008Z" fill="#FFCC00" />
<path d="M6.42969 4.53906L6.22368 3.90502L5.90666 4.00803L6.42969 4.53906Z" fill="#FFCC00" />
<path d="M6.42969 4.53906L5.89034 4.14721L6.08627 3.87753L6.42969 4.53906Z" fill="#FFCC00" />
<path d="M5.64648 4.53809L6.18583 4.14623L5.9899 3.87656L5.64648 4.53809Z" fill="#FFCC00" />
<path d="M5.64648 4.53809L5.8525 3.90405L6.16951 4.00705L5.64648 4.53809Z" fill="#FFCC00" />
<path d="M5.40332 3.79199L5.94267 4.18385L6.13859 3.91418L5.40332 3.79199Z" fill="#FFCC00" />
<path d="M5.40332 3.79199H6.06999V4.12533L5.40332 3.79199Z" fill="#FFCC00" />
<path d="M6.6709 3.79395L6.13155 4.1858L5.93563 3.91613L6.6709 3.79395Z" fill="#FFCC00" />
<path d="M6.6709 3.79395L6.00423 3.79395L6.00423 4.12728L6.6709 3.79395Z" fill="#FFCC00" />
<path d="M6.03711 3.33301L6.24312 3.96705L5.9261 4.07005L6.03711 3.33301Z" fill="#FFCC00" />
<path d="M6.03711 3.33301L5.8311 3.96705L6.14812 4.07005L6.03711 3.33301Z" fill="#FFCC00" />
<path d="M6.67285 7.79395L6.00619 7.79395L6.00619 8.12728L6.67285 7.79395Z" fill="#FFCC00" />
<path d="M6.67285 7.79395L6.13351 8.1858L5.93758 7.91613L6.67285 7.79395Z" fill="#FFCC00" />
<path d="M6.42969 8.53906L6.22368 7.90502L5.90666 8.00803L6.42969 8.53906Z" fill="#FFCC00" />
<path d="M6.42969 8.53906L5.89034 8.14721L6.08627 7.87753L6.42969 8.53906Z" fill="#FFCC00" />
<path d="M5.64648 8.53906L6.18583 8.14721L5.9899 7.87753L5.64648 8.53906Z" fill="#FFCC00" />
<path d="M5.64648 8.53906L5.8525 7.90502L6.16951 8.00803L5.64648 8.53906Z" fill="#FFCC00" />
<path d="M6.03906 7.33398L6.24507 7.96802L5.92805 8.07103L6.03906 7.33398Z" fill="#FFCC00" />
<path d="M6.03906 7.33398L5.83305 7.96802L6.15007 8.07103L6.03906 7.33398Z" fill="#FFCC00" />
<path d="M5.4043 7.79395L6.07096 7.79395L6.07096 8.12728L5.4043 7.79395Z" fill="#FFCC00" />
<path d="M5.4043 7.79395L5.94364 8.1858L6.13957 7.91613L5.4043 7.79395Z" fill="#FFCC00" />
<path d="M8.13477 9.25781L7.4681 9.25781L7.4681 9.59115L8.13477 9.25781Z" fill="#FFCC00" />
<path d="M8.13477 9.25781L7.59542 9.64967L7.39949 9.38L8.13477 9.25781Z" fill="#FFCC00" />
<path d="M7.89355 10.002L7.68754 9.36792L7.37052 9.47092L7.89355 10.002Z" fill="#FFCC00" />
<path d="M7.89355 10.002L7.35421 9.6101L7.55014 9.34042L7.89355 10.002Z" fill="#FFCC00" />
<path d="M7.10938 10.0029L7.64872 9.61107L7.45279 9.3414L7.10938 10.0029Z" fill="#FFCC00" />
<path d="M7.10938 10.0029L7.31539 9.36889L7.6324 9.4719L7.10938 10.0029Z" fill="#FFCC00" />
<path d="M7.5 8.79688L7.70601 9.43091L7.38899 9.53392L7.5 8.79688Z" fill="#FFCC00" />
<path d="M7.5 8.79688L7.29399 9.43091L7.61101 9.53392L7.5 8.79688Z" fill="#FFCC00" />
<path d="M6.86621 9.25684L7.53288 9.25684L7.53288 9.59017L6.86621 9.25684Z" fill="#FFCC00" />
<path d="M6.86621 9.25684L7.40556 9.64869L7.60148 9.37902L6.86621 9.25684Z" fill="#FFCC00" />
<path d="M13.5 5.33203L13.706 5.96607L13.389 6.06907L13.5 5.33203Z" fill="#FFCC00" />
<path d="M13.5 5.33203L13.294 5.96607L13.611 6.06907L13.5 5.33203Z" fill="#FFCC00" />
<path d="M12.8662 5.79395L13.5329 5.79395L13.5329 6.12728L12.8662 5.79395Z" fill="#FFCC00" />
<path d="M12.8662 5.79395L13.4056 6.1858L13.6015 5.91613L12.8662 5.79395Z" fill="#FFCC00" />
<path d="M13.1084 6.53809L13.3144 5.90405L13.6314 6.00705L13.1084 6.53809Z" fill="#FFCC00" />
<path d="M13.1084 6.53809L13.6477 6.14623L13.4518 5.87656L13.1084 6.53809Z" fill="#FFCC00" />
<path d="M14.1338 5.79395L13.4671 5.79395L13.4671 6.12728L14.1338 5.79395Z" fill="#FFCC00" />
<path d="M14.1338 5.79395L13.5944 6.1858L13.3985 5.91613L14.1338 5.79395Z" fill="#FFCC00" />
<path d="M13.8916 6.53809L13.6856 5.90405L13.3686 6.00705L13.8916 6.53809Z" fill="#FFCC00" />
<path d="M13.8916 6.53809L13.3523 6.14623L13.5482 5.87656L13.8916 6.53809Z" fill="#FFCC00" />
<path d="M11.8936 3.07422L11.3542 2.68236L11.5501 2.41269L11.8936 3.07422Z" fill="#FFCC00" />
<path d="M11.8936 3.07422L11.6875 2.44018L11.3705 2.54319L11.8936 3.07422Z" fill="#FFCC00" />
<path d="M12.1357 2.3291L11.5964 2.72096L11.4005 2.45129L12.1357 2.3291Z" fill="#FFCC00" />
<path d="M12.1357 2.3291L11.4691 2.3291L11.4691 2.66243L12.1357 2.3291Z" fill="#FFCC00" />
<path d="M11.501 1.86914L11.707 2.50318L11.39 2.60618L11.501 1.86914Z" fill="#FFCC00" />
<path d="M11.501 1.86914L11.295 2.50318L11.612 2.60618L11.501 1.86914Z" fill="#FFCC00" />
<path d="M11.1094 3.07422L11.6487 2.68236L11.4528 2.41269L11.1094 3.07422Z" fill="#FFCC00" />
<path d="M11.1094 3.07422L11.3154 2.44018L11.6324 2.54319L11.1094 3.07422Z" fill="#FFCC00" />
<path d="M10.8682 2.33008L11.4075 2.72193L11.6034 2.45226L10.8682 2.33008Z" fill="#FFCC00" />
<path d="M10.8682 2.33008L11.5348 2.33008L11.5348 2.66341L10.8682 2.33008Z" fill="#FFCC00" />
<path d="M12.5723 4.53809L12.7783 3.90405L13.0953 4.00705L12.5723 4.53809Z" fill="#FFCC00" />
<path d="M12.5723 4.53809L13.1116 4.14623L12.9157 3.87656L12.5723 4.53809Z" fill="#FFCC00" />
<path d="M13.3574 4.53809L12.8181 4.14623L13.014 3.87656L13.3574 4.53809Z" fill="#FFCC00" />
<path d="M13.3574 4.53809L13.1514 3.90405L12.8344 4.00705L13.3574 4.53809Z" fill="#FFCC00" />
<path d="M13.5996 3.79199L13.0603 4.18385L12.8643 3.91418L13.5996 3.79199Z" fill="#FFCC00" />
<path d="M13.5996 3.79199L12.9329 3.79199L12.9329 4.12533L13.5996 3.79199Z" fill="#FFCC00" />
<path d="M12.3301 3.79297L12.8694 4.18483L13.0654 3.91515L12.3301 3.79297Z" fill="#FFCC00" />
<path d="M12.3301 3.79297L12.9967 3.79297L12.9967 4.1263L12.3301 3.79297Z" fill="#FFCC00" />
<path d="M12.9648 3.33301L12.7588 3.96705L13.0759 4.07005L12.9648 3.33301Z" fill="#FFCC00" />
<path d="M12.9648 3.33301L13.1709 3.96705L12.8538 4.07005L12.9648 3.33301Z" fill="#FFCC00" />
<path d="M12.3301 7.79395L12.9967 7.79395L12.9967 8.12728L12.3301 7.79395Z" fill="#FFCC00" />
<path d="M12.3301 7.79395L12.8694 8.1858L13.0654 7.91613L12.3301 7.79395Z" fill="#FFCC00" />
<path d="M12.5732 8.53906L12.7793 7.90502L13.0963 8.00803L12.5732 8.53906Z" fill="#FFCC00" />
<path d="M12.5732 8.53906L13.1126 8.14721L12.9167 7.87753L12.5732 8.53906Z" fill="#FFCC00" />
<path d="M13.3574 8.53906L12.8181 8.14721L13.014 7.87753L13.3574 8.53906Z" fill="#FFCC00" />
<path d="M13.3574 8.53906L13.1514 7.90502L12.8344 8.00803L13.3574 8.53906Z" fill="#FFCC00" />
<path d="M12.9648 7.33203L12.7588 7.96607L13.0759 8.06907L12.9648 7.33203Z" fill="#FFCC00" />
<path d="M12.9648 7.33203L13.1709 7.96607L12.8538 8.06907L12.9648 7.33203Z" fill="#FFCC00" />
<path d="M13.5977 7.79297L12.931 7.79297L12.931 8.1263L13.5977 7.79297Z" fill="#FFCC00" />
<path d="M13.5977 7.79297L13.0583 8.18483L12.8624 7.91515L13.5977 7.79297Z" fill="#FFCC00" />
<path d="M10.8672 9.25684L11.5339 9.25684L11.5339 9.59017L10.8672 9.25684Z" fill="#FFCC00" />
<path d="M10.8672 9.25684L11.4065 9.64869L11.6025 9.37902L10.8672 9.25684Z" fill="#FFCC00" />
<path d="M11.1094 10.0029L11.3154 9.36889L11.6324 9.4719L11.1094 10.0029Z" fill="#FFCC00" />
<path d="M11.1094 10.0029L11.6487 9.61107L11.4528 9.3414L11.1094 10.0029Z" fill="#FFCC00" />
<path d="M11.8926 10.0029L11.3532 9.61107L11.5492 9.3414L11.8926 10.0029Z" fill="#FFCC00" />
<path d="M11.8926 10.0029L11.6866 9.36889L11.3695 9.4719L11.8926 10.0029Z" fill="#FFCC00" />
<path d="M11.501 8.79688L11.295 9.43091L11.612 9.53392L11.501 8.79688Z" fill="#FFCC00" />
<path d="M11.501 8.79688L11.707 9.43091L11.39 9.53392L11.501 8.79688Z" fill="#FFCC00" />
<path d="M12.1357 9.25781L11.4691 9.25781L11.4691 9.59115L12.1357 9.25781Z" fill="#FFCC00" />
<path d="M12.1357 9.25781L11.5964 9.64967L11.4005 9.38L12.1357 9.25781Z" fill="#FFCC00" />
</g>
<defs>
<clipPath id="clip0_1692_21196">
<rect x="0.5" width="18" height="12" rx="1" fill="white" />
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,161 @@
<svg width="19" height="12" viewBox="0 0 19 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1692_20889)">
<path d="M23.467 0H0.666992V12H23.467V0Z" fill="#B22234" />
<path
d="M0.666992 1.38392H23.467ZM23.467 3.23008H0.666992ZM0.666992 5.07623H23.467ZM23.467 6.92239H0.666992ZM0.666992 8.76854H23.467ZM23.467 10.6147H0.666992Z"
fill="black" />
<path fill-rule="evenodd" clip-rule="evenodd"
d="M23.467 1.93777H0.666992V0.830078H23.467V1.93777ZM0.666992 2.67623H23.467V3.78392H0.666992V2.67623ZM23.467 5.63008H0.666992V4.52239H23.467V5.63008ZM0.666992 6.36854H23.467V7.47623H0.666992V6.36854ZM23.467 9.32239H0.666992V8.21469H23.467V9.32239ZM0.666992 10.0608H23.467V11.1685H0.666992V10.0608Z"
fill="white" />
<path d="M9.78699 0H0.666992V6.46154H9.78699V0Z" fill="#3C3B6E" />
<path
d="M1.4244 0.274414L1.64143 0.942359L1.07324 0.529546H1.77556L1.20737 0.942359L1.4244 0.274414Z"
fill="white" />
<path
d="M1.4244 1.56641L1.64143 2.23435L1.07324 1.82154H1.77556L1.20737 2.23435L1.4244 1.56641Z"
fill="white" />
<path
d="M1.4244 2.85938L1.64143 3.52732L1.07324 3.11451H1.77556L1.20737 3.52732L1.4244 2.85938Z"
fill="white" />
<path d="M1.4244 4.15137L1.64143 4.81931L1.07324 4.4065H1.77556L1.20737 4.81931L1.4244 4.15137Z"
fill="white" />
<path
d="M1.42538 5.44434L1.64241 6.11228L1.07422 5.69947H1.77654L1.20835 6.11228L1.42538 5.44434Z"
fill="white" />
<path
d="M2.18514 0.921875L2.40217 1.58982L1.83398 1.17701H2.5363L1.96812 1.58982L2.18514 0.921875Z"
fill="white" />
<path
d="M2.18514 2.21484L2.40217 2.88279L1.83398 2.46998H2.5363L1.96812 2.88279L2.18514 2.21484Z"
fill="white" />
<path d="M2.18514 3.50586L2.40217 4.1738L1.83398 3.76099H2.5363L1.96812 4.1738L2.18514 3.50586Z"
fill="white" />
<path
d="M2.18514 4.79883L2.40217 5.46677L1.83398 5.05396H2.5363L1.96812 5.46677L2.18514 4.79883Z"
fill="white" />
<path
d="M2.94589 0.274414L3.16291 0.942359L2.59473 0.529546H3.29705L2.72886 0.942359L2.94589 0.274414Z"
fill="white" />
<path
d="M2.94589 1.56641L3.16291 2.23435L2.59473 1.82154H3.29705L2.72886 2.23435L2.94589 1.56641Z"
fill="white" />
<path
d="M2.94589 2.85938L3.16291 3.52732L2.59473 3.11451H3.29705L2.72886 3.52732L2.94589 2.85938Z"
fill="white" />
<path
d="M2.94589 4.15137L3.16291 4.81931L2.59473 4.4065H3.29705L2.72886 4.81931L2.94589 4.15137Z"
fill="white" />
<path
d="M2.94589 5.44434L3.16291 6.11228L2.59473 5.69947H3.29705L2.72886 6.11228L2.94589 5.44434Z"
fill="white" />
<path
d="M3.70663 0.921875L3.92366 1.58982L3.35547 1.17701H4.05779L3.4896 1.58982L3.70663 0.921875Z"
fill="white" />
<path
d="M3.70663 2.21484L3.92366 2.88279L3.35547 2.46998H4.05779L3.4896 2.88279L3.70663 2.21484Z"
fill="white" />
<path d="M3.70663 3.50586L3.92366 4.1738L3.35547 3.76099H4.05779L3.4896 4.1738L3.70663 3.50586Z"
fill="white" />
<path
d="M3.70663 4.79883L3.92366 5.46677L3.35547 5.05396H4.05779L3.4896 5.46677L3.70663 4.79883Z"
fill="white" />
<path
d="M4.46835 0.274414L4.68538 0.942359L4.11719 0.529546H4.81951L4.25132 0.942359L4.46835 0.274414Z"
fill="white" />
<path
d="M4.46835 1.56641L4.68538 2.23435L4.11719 1.82154H4.81951L4.25132 2.23435L4.46835 1.56641Z"
fill="white" />
<path
d="M4.46835 2.85938L4.68538 3.52732L4.11719 3.11451H4.81951L4.25132 3.52732L4.46835 2.85938Z"
fill="white" />
<path
d="M4.46835 4.15137L4.68538 4.81931L4.11719 4.4065H4.81951L4.25132 4.81931L4.46835 4.15137Z"
fill="white" />
<path
d="M4.46835 5.44434L4.68538 6.11228L4.11719 5.69947H4.81951L4.25132 6.11228L4.46835 5.44434Z"
fill="white" />
<path
d="M5.22811 0.921875L5.44514 1.58982L4.87695 1.17701H5.57927L5.01108 1.58982L5.22811 0.921875Z"
fill="white" />
<path
d="M5.22811 2.21484L5.44514 2.88279L4.87695 2.46998H5.57927L5.01108 2.88279L5.22811 2.21484Z"
fill="white" />
<path
d="M5.22811 3.50586L5.44514 4.1738L4.87695 3.76099H5.57927L5.01108 4.1738L5.22811 3.50586Z"
fill="white" />
<path
d="M5.22811 4.79883L5.44514 5.46677L4.87695 5.05396H5.57927L5.01108 5.46677L5.22811 4.79883Z"
fill="white" />
<path
d="M5.98788 0.274414L6.20491 0.942359L5.63672 0.529546H6.33904L5.77085 0.942359L5.98788 0.274414Z"
fill="white" />
<path
d="M5.98788 1.56641L6.20491 2.23435L5.63672 1.82154H6.33904L5.77085 2.23435L5.98788 1.56641Z"
fill="white" />
<path
d="M5.98788 2.85938L6.20491 3.52732L5.63672 3.11451H6.33904L5.77085 3.52732L5.98788 2.85938Z"
fill="white" />
<path
d="M5.98788 4.15137L6.20491 4.81931L5.63672 4.4065H6.33904L5.77085 4.81931L5.98788 4.15137Z"
fill="white" />
<path
d="M5.98788 5.44434L6.20491 6.11228L5.63672 5.69947H6.33904L5.77085 6.11228L5.98788 5.44434Z"
fill="white" />
<path
d="M6.74764 0.921875L6.96467 1.58982L6.39648 1.17701H7.0988L6.53062 1.58982L6.74764 0.921875Z"
fill="white" />
<path
d="M6.74764 2.21484L6.96467 2.88279L6.39648 2.46998H7.0988L6.53062 2.88279L6.74764 2.21484Z"
fill="white" />
<path d="M6.74764 3.50586L6.96467 4.1738L6.39648 3.76099H7.0988L6.53062 4.1738L6.74764 3.50586Z"
fill="white" />
<path
d="M6.74764 4.79883L6.96467 5.46677L6.39648 5.05396H7.0988L6.53062 5.46677L6.74764 4.79883Z"
fill="white" />
<path
d="M7.50546 0.275391L7.72248 0.943335L7.1543 0.530523H7.85662L7.28843 0.943335L7.50546 0.275391Z"
fill="white" />
<path d="M7.50546 1.56836L7.72248 2.2363L7.1543 1.82349H7.85662L7.28843 2.2363L7.50546 1.56836Z"
fill="white" />
<path
d="M7.50546 2.85938L7.72248 3.52732L7.1543 3.11451H7.85662L7.28843 3.52732L7.50546 2.85938Z"
fill="white" />
<path
d="M7.50546 4.15234L7.72248 4.82029L7.1543 4.40748H7.85662L7.28843 4.82029L7.50546 4.15234Z"
fill="white" />
<path
d="M7.50546 5.44531L7.72248 6.11326L7.1543 5.70044H7.85662L7.28843 6.11326L7.50546 5.44531Z"
fill="white" />
<path
d="M8.26717 0.921875L8.4842 1.58982L7.91602 1.17701H8.61833L8.05015 1.58982L8.26717 0.921875Z"
fill="white" />
<path
d="M8.26717 2.21484L8.4842 2.88279L7.91602 2.46998H8.61833L8.05015 2.88279L8.26717 2.21484Z"
fill="white" />
<path d="M8.26717 3.50586L8.4842 4.1738L7.91602 3.76099H8.61833L8.05015 4.1738L8.26717 3.50586Z"
fill="white" />
<path
d="M8.26717 4.79883L8.4842 5.46677L7.91602 5.05396H8.61833L8.05015 5.46677L8.26717 4.79883Z"
fill="white" />
<path
d="M9.02694 0.275391L9.24397 0.943335L8.67578 0.530523H9.3781L8.80991 0.943335L9.02694 0.275391Z"
fill="white" />
<path d="M9.02694 1.56836L9.24397 2.2363L8.67578 1.82349H9.3781L8.80991 2.2363L9.02694 1.56836Z"
fill="white" />
<path
d="M9.02694 2.85938L9.24397 3.52732L8.67578 3.11451H9.3781L8.80991 3.52732L9.02694 2.85938Z"
fill="white" />
<path
d="M9.02694 4.15234L9.24397 4.82029L8.67578 4.40748H9.3781L8.80991 4.82029L9.02694 4.15234Z"
fill="white" />
<path
d="M9.02694 5.44531L9.24397 6.11326L8.67578 5.70044H9.3781L8.80991 6.11326L9.02694 5.44531Z"
fill="white" />
</g>
<defs>
<clipPath id="clip0_1692_20889">
<rect x="0.666992" width="18" height="12" rx="1" fill="white" />
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 7.4 KiB

View file

@ -1,6 +1,10 @@
@use '@/scss/underscore' as _; @use '@/scss/underscore' as _;
.regionText { .wrapper {
display: flex;
align-items: center;
justify-content: center;
gap: _.unit(2);
font: var(--font-label-2); font: var(--font-label-2);
.comingSoon { .comingSoon {

View file

@ -1,19 +1,31 @@
import classNames from 'classnames'; import classNames from 'classnames';
import { type ComponentType } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import auFlag from './assets/au.svg?react';
import euFlag from './assets/eu.svg?react';
import usFlag from './assets/us.svg?react';
import styles from './index.module.scss'; import styles from './index.module.scss';
// TODO: This is a copy from `@logto/cloud-models`, make a SSoT for this later // TODO: This is a copy from `@logto/cloud-models`, make a SSoT for this later
export enum RegionName { export enum RegionName {
EU = 'EU', EU = 'EU',
US = 'US', US = 'US',
AU = 'AU',
} }
const regionFlagMap = Object.freeze({ const regionDisplayNameMap = Object.freeze({
[RegionName.EU]: '🇪🇺', [RegionName.EU]: 'Europe',
[RegionName.US]: '🇺🇸', [RegionName.US]: 'West US',
[RegionName.AU]: 'Australia',
} satisfies Record<RegionName, string>); } satisfies Record<RegionName, string>);
const regionFlagMap = Object.freeze({
[RegionName.EU]: euFlag,
[RegionName.US]: usFlag,
[RegionName.AU]: auFlag,
} satisfies Record<RegionName, ComponentType>);
type Props = { type Props = {
readonly regionName: RegionName; readonly regionName: RegionName;
readonly isComingSoon?: boolean; readonly isComingSoon?: boolean;
@ -22,10 +34,12 @@ type Props = {
function Region({ isComingSoon = false, regionName, className }: Props) { function Region({ isComingSoon = false, regionName, className }: Props) {
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
const Flag = regionFlagMap[regionName];
return ( return (
<span className={classNames(styles.regionText, className)}> <span className={classNames(styles.wrapper, className)}>
{regionFlagMap[regionName]} {regionName} <Flag />
<span>{regionDisplayNameMap[regionName]}</span>
{isComingSoon && <span className={styles.comingSoon}>{`(${t('general.coming_soon')})`}</span>} {isComingSoon && <span className={styles.comingSoon}>{`(${t('general.coming_soon')})`}</span>}
</span> </span>
); );

View file

@ -1,3 +1,4 @@
import { ResponseError } from '@withtyped/client';
import { HTTPError, TimeoutError } from 'ky'; import { HTTPError, TimeoutError } from 'ky';
import { type FieldValues, type SubmitHandler } from 'react-hook-form'; import { type FieldValues, type SubmitHandler } from 'react-hook-form';
import { toast } from 'react-hot-toast'; import { toast } from 'react-hot-toast';
@ -16,7 +17,10 @@ export const trySubmitSafe =
try { try {
await handler(formData, event); await handler(formData, event);
} catch (error) { } catch (error) {
if (error instanceof HTTPError && error.response.status !== 401) { if (
(error instanceof HTTPError || error instanceof ResponseError) &&
error.response.status !== 401
) {
// Returned directly, since the error has been handled by the `use-api` hook. // Returned directly, since the error has been handled by the `use-api` hook.
return; return;
} }

View file

@ -97,7 +97,7 @@
"zod": "^3.23.8" "zod": "^3.23.8"
}, },
"devDependencies": { "devDependencies": {
"@logto/cloud": "0.2.5-91ab76c", "@logto/cloud": "0.2.5-1661979",
"@silverhand/eslint-config": "6.0.1", "@silverhand/eslint-config": "6.0.1",
"@silverhand/ts-config": "6.0.0", "@silverhand/ts-config": "6.0.0",
"@types/adm-zip": "^0.5.5", "@types/adm-zip": "^0.5.5",

View file

@ -1269,8 +1269,8 @@ importers:
version: 3.23.8 version: 3.23.8
devDependencies: devDependencies:
'@logto/cloud': '@logto/cloud':
specifier: 0.2.5-582d792 specifier: 0.2.5-1661979
version: 0.2.5-582d792(zod@3.23.8) version: 0.2.5-1661979(zod@3.23.8)
'@silverhand/eslint-config': '@silverhand/eslint-config':
specifier: 6.0.1 specifier: 6.0.1
version: 6.0.1(eslint@8.57.0)(prettier@3.0.0)(typescript@5.5.3) version: 6.0.1(eslint@8.57.0)(prettier@3.0.0)(typescript@5.5.3)
@ -2568,8 +2568,8 @@ importers:
specifier: ^29.5.0 specifier: ^29.5.0
version: 29.5.0 version: 29.5.0
'@logto/cloud': '@logto/cloud':
specifier: 0.2.5-91ab76c specifier: 0.2.5-1661979
version: 0.2.5-91ab76c(zod@3.23.8) version: 0.2.5-1661979(zod@3.23.8)
'@logto/connector-kit': '@logto/connector-kit':
specifier: workspace:^4.0.0 specifier: workspace:^4.0.0
version: link:../toolkit/connector-kit version: link:../toolkit/connector-kit
@ -3064,8 +3064,8 @@ importers:
version: 3.23.8 version: 3.23.8
devDependencies: devDependencies:
'@logto/cloud': '@logto/cloud':
specifier: 0.2.5-91ab76c specifier: 0.2.5-1661979
version: 0.2.5-91ab76c(zod@3.23.8) version: 0.2.5-1661979(zod@3.23.8)
'@silverhand/eslint-config': '@silverhand/eslint-config':
specifier: 6.0.1 specifier: 6.0.1
version: 6.0.1(eslint@8.57.0)(prettier@3.0.0)(typescript@5.5.3) version: 6.0.1(eslint@8.57.0)(prettier@3.0.0)(typescript@5.5.3)
@ -5571,12 +5571,8 @@ packages:
'@logto/client@2.7.2': '@logto/client@2.7.2':
resolution: {integrity: sha512-jsmuDl9QpXfR3uLEMPE67tvYoL5XcjJi+4yGqucYPjd4GH6SUHp3N9skk8C/OyygnKDPLY+ttwD0LaIbpGvn+Q==} resolution: {integrity: sha512-jsmuDl9QpXfR3uLEMPE67tvYoL5XcjJi+4yGqucYPjd4GH6SUHp3N9skk8C/OyygnKDPLY+ttwD0LaIbpGvn+Q==}
'@logto/cloud@0.2.5-582d792': '@logto/cloud@0.2.5-1661979':
resolution: {integrity: sha512-0fIZzqwyjQguTS0a5+XbgVZlGEB/MXIf6pbuBDkHh6JHlMTJ/XH041rWX+e+nMk5N7/Xk2XXS+d2RJUWumnmpw==} resolution: {integrity: sha512-CiH6VxaR281cZLWQyI54XUiwSXEnW9rxci6ptz73rS4OWYfIweOWzP3Z30OVLiOslznBfTLuBML8eVelxpG1iQ==}
engines: {node: ^20.9.0}
'@logto/cloud@0.2.5-91ab76c':
resolution: {integrity: sha512-t/ZVrFICVxtqw6zh6/OJ+0VYt+fl+waNz77CdAJkhxC91KFMfojm4hWNrx1qTNSTUzg+gc/2p8cbKC9cH1ngeA==}
engines: {node: ^20.9.0} engines: {node: ^20.9.0}
'@logto/js@4.1.4': '@logto/js@4.1.4':
@ -15244,14 +15240,7 @@ snapshots:
camelcase-keys: 7.0.2 camelcase-keys: 7.0.2
jose: 5.6.3 jose: 5.6.3
'@logto/cloud@0.2.5-582d792(zod@3.23.8)': '@logto/cloud@0.2.5-1661979(zod@3.23.8)':
dependencies:
'@silverhand/essentials': 2.9.1
'@withtyped/server': 0.14.0(zod@3.23.8)
transitivePeerDependencies:
- zod
'@logto/cloud@0.2.5-91ab76c(zod@3.23.8)':
dependencies: dependencies:
'@silverhand/essentials': 2.9.1 '@silverhand/essentials': 2.9.1
'@withtyped/server': 0.14.0(zod@3.23.8) '@withtyped/server': 0.14.0(zod@3.23.8)