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:
parent
77d274a3c3
commit
c2b379ee30
5 changed files with 4 additions and 23 deletions
|
@ -1,8 +0,0 @@
|
||||||
@use '@/scss/underscore' as _;
|
|
||||||
|
|
||||||
.skeleton {
|
|
||||||
@include _.shimmering-animation;
|
|
||||||
width: 48px;
|
|
||||||
height: 16px;
|
|
||||||
border-radius: 6px;
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
import * as styles from './index.module.scss';
|
|
||||||
|
|
||||||
function Skeleton() {
|
|
||||||
return <div className={styles.skeleton} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Skeleton;
|
|
|
@ -8,8 +8,6 @@ import useSubscriptionPlan from '@/hooks/use-subscription-plan';
|
||||||
import useSubscriptionUsage from '@/hooks/use-subscription-usage';
|
import useSubscriptionUsage from '@/hooks/use-subscription-usage';
|
||||||
import { getLatestUnpaidInvoice } from '@/utils/subscription';
|
import { getLatestUnpaidInvoice } from '@/utils/subscription';
|
||||||
|
|
||||||
import Skeleton from './Skeleton';
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
tenantId: string;
|
tenantId: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
@ -30,7 +28,7 @@ function TenantStatusTag({ tenantId, className }: Props) {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isLoadingUsage || isLoadingInvoice || isLoadingSubscription) {
|
if (isLoadingUsage || isLoadingInvoice || isLoadingSubscription) {
|
||||||
return <Skeleton />;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,10 +43,11 @@
|
||||||
margin-top: _.unit(0.5);
|
margin-top: _.unit(0.5);
|
||||||
font: var(--font-body-3);
|
font: var(--font-body-3);
|
||||||
color: var(--color-text-secondary);
|
color: var(--color-text-secondary);
|
||||||
|
// Keep the height of the item consistent when the plan name is loading
|
||||||
|
min-height: 16px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.checkIcon {
|
.checkIcon {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
|
|
@ -8,7 +8,6 @@ import useSubscriptionPlan from '@/hooks/use-subscription-plan';
|
||||||
|
|
||||||
import TenantEnvTag from '../TenantEnvTag';
|
import TenantEnvTag from '../TenantEnvTag';
|
||||||
|
|
||||||
import Skeleton from './Skeleton';
|
|
||||||
import TenantStatusTag from './TenantStatusTag';
|
import TenantStatusTag from './TenantStatusTag';
|
||||||
import * as styles from './index.module.scss';
|
import * as styles from './index.module.scss';
|
||||||
|
|
||||||
|
@ -30,9 +29,7 @@ function TenantDropdownItem({ tenantData, isSelected, onClick }: Props) {
|
||||||
<TenantEnvTag tag={tag} />
|
<TenantEnvTag tag={tag} />
|
||||||
<TenantStatusTag tenantId={id} className={styles.statusTag} />
|
<TenantStatusTag tenantId={id} className={styles.statusTag} />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.planName}>
|
<div className={styles.planName}>{tenantPlan && <PlanName name={tenantPlan.name} />}</div>
|
||||||
{tenantPlan ? <PlanName name={tenantPlan.name} /> : <Skeleton />}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<Tick className={classNames(styles.checkIcon, isSelected && styles.visible)} />
|
<Tick className={classNames(styles.checkIcon, isSelected && styles.visible)} />
|
||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
|
|
Loading…
Add table
Reference in a new issue