Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(console): optimize onboarding #6837

Merged
merged 4 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function SocialDemoCallback() {
<div className={styles.container}>
<Card className={styles.card}>
{theme === Theme.Light ? <Congrats /> : <CongratsDark />}
<div className={styles.title}>{t('cloud.socialCallback.title')}</div>
<div className={styles.message}>{t('cloud.socialCallback.description')}</div>
<div className={styles.title}>{t('cloud.social_callback.title')}</div>
<div className={styles.message}>{t('cloud.social_callback.description')}</div>
</Card>
</div>
);
Expand Down
22 changes: 14 additions & 8 deletions packages/console/src/components/ActionBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@ import ProgressBar from '../ProgressBar';

import styles from './index.module.scss';

type Props = {
readonly step: number;
readonly totalSteps: number;
readonly children: ReactNode;
};
type Props =
| {
readonly step: number;
readonly totalSteps: number;
readonly children: ReactNode;
}
| {
readonly children: ReactNode;
};

function ActionBar({ step, totalSteps, children }: Props) {
function ActionBar(props: Props) {
return (
<div className={styles.container}>
<ProgressBar currentStep={step} totalSteps={totalSteps} />
<div className={styles.actions}>{children}</div>
{'step' in props && 'totalSteps' in props && (
<ProgressBar currentStep={props.step} totalSteps={props.totalSteps} />
)}
<div className={styles.actions}>{props.children}</div>
</div>
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/console/src/components/CreateTenantModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import CreateTenantHeaderIcon from '@/assets/icons/create-tenant-header.svg?reac
import { useCloudApi } from '@/cloud/hooks/use-cloud-api';
import { type TenantResponse } from '@/cloud/types/router';
import Region, { RegionName } from '@/components/Region';
import { availableRegions } from '@/consts';
import Button from '@/ds-components/Button';
import DangerousRaw from '@/ds-components/DangerousRaw';
import FormField from '@/ds-components/FormField';
Expand Down Expand Up @@ -124,8 +125,7 @@ function CreateTenantModal({ isOpen, onClose }: Props) {
rules={{ required: true }}
render={({ field: { onChange, value, name } }) => (
<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. */}
{[RegionName.EU, RegionName.US, RegionName.AU].map((region) => (
{availableRegions.map((region) => (
<Radio
key={region}
title={
Expand Down
7 changes: 7 additions & 0 deletions packages/console/src/consts/tenants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,10 @@ const getAdminTenantEndpoint = () => {
export const adminTenantEndpoint = getAdminTenantEndpoint();

export const mainTitle = isCloud ? 'Logto Cloud' : 'Logto Console';

// Manually maintaining the list of regions to avoid unexpected changes. We may consider using an API in the future.
export const availableRegions = Object.freeze([
RegionName.EU,
RegionName.US,
RegionName.AU,
] as const);
2 changes: 1 addition & 1 deletion packages/console/src/contexts/AppDataProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type AppData = {

export const AppDataContext = createContext<AppData>({});

export const useTenantEndpoint = (tenantId: string) => {
const useTenantEndpoint = (tenantId: string) => {
return useSWRImmutable(`api/.well-known/endpoints/${tenantId}`, async (pathname) => {
const { user } = await ky.get(new URL(pathname, adminTenantEndpoint)).json<{ user: string }>();
return new URL(user);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function DemoConnectorNotice() {

return (
<InlineNotification className={styles.notice}>
{t('cloud.sie.connectors.notice')}
{t('cloud.social_callback.notice')}
</InlineNotification>
);
}
Expand Down
36 changes: 0 additions & 36 deletions packages/console/src/onboarding/hooks/use-tenant-api.ts

This file was deleted.

Loading
Loading