0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-17 22:04:19 -05:00

refactor(console): improve tenant selector loading state (#4317)

This commit is contained in:
Xiao Yijun 2023-08-11 16:16:04 +08:00 committed by GitHub
parent 77d274a3c3
commit c2b379ee30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 23 deletions

View file

@ -1,8 +0,0 @@
@use '@/scss/underscore' as _;
.skeleton {
@include _.shimmering-animation;
width: 48px;
height: 16px;
border-radius: 6px;
}

View file

@ -1,7 +0,0 @@
import * as styles from './index.module.scss';
function Skeleton() {
return <div className={styles.skeleton} />;
}
export default Skeleton;

View file

@ -8,8 +8,6 @@ import useSubscriptionPlan from '@/hooks/use-subscription-plan';
import useSubscriptionUsage from '@/hooks/use-subscription-usage';
import { getLatestUnpaidInvoice } from '@/utils/subscription';
import Skeleton from './Skeleton';
type Props = {
tenantId: string;
className?: string;
@ -30,7 +28,7 @@ function TenantStatusTag({ tenantId, className }: Props) {
);
if (isLoadingUsage || isLoadingInvoice || isLoadingSubscription) {
return <Skeleton />;
return null;
}
/**

View file

@ -43,10 +43,11 @@
margin-top: _.unit(0.5);
font: var(--font-body-3);
color: var(--color-text-secondary);
// Keep the height of the item consistent when the plan name is loading
min-height: 16px;
}
}
.checkIcon {
width: 20px;
height: 20px;

View file

@ -8,7 +8,6 @@ import useSubscriptionPlan from '@/hooks/use-subscription-plan';
import TenantEnvTag from '../TenantEnvTag';
import Skeleton from './Skeleton';
import TenantStatusTag from './TenantStatusTag';
import * as styles from './index.module.scss';
@ -30,9 +29,7 @@ function TenantDropdownItem({ tenantData, isSelected, onClick }: Props) {
<TenantEnvTag tag={tag} />
<TenantStatusTag tenantId={id} className={styles.statusTag} />
</div>
<div className={styles.planName}>
{tenantPlan ? <PlanName name={tenantPlan.name} /> : <Skeleton />}
</div>
<div className={styles.planName}>{tenantPlan && <PlanName name={tenantPlan.name} />}</div>
</div>
<Tick className={classNames(styles.checkIcon, isSelected && styles.visible)} />
</DropdownItem>