From 52eb2f0b6a9a0105465570750d07220cfeebf1a6 Mon Sep 17 00:00:00 2001 From: Luca Pagliaro Date: Fri, 7 Feb 2025 13:45:06 +0100 Subject: [PATCH 1/2] feat: add plus skeleton in onboarding (#4161) * feat: add plus skeleton in onboarding * perf: add external variable for Array.from * feat: add skeleton in PlusInfo radio group * feat: add skeleton for iframe * refactor: removed isLoading const --- .../onboarding/OnboardingPlusStep.tsx | 37 ++++++++++++++++++- .../src/components/plus/PlusDesktop.tsx | 2 +- .../shared/src/components/plus/PlusInfo.tsx | 21 +++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/packages/shared/src/components/onboarding/OnboardingPlusStep.tsx b/packages/shared/src/components/onboarding/OnboardingPlusStep.tsx index 9dacbd252c..a04fc2d313 100644 --- a/packages/shared/src/components/onboarding/OnboardingPlusStep.tsx +++ b/packages/shared/src/components/onboarding/OnboardingPlusStep.tsx @@ -12,6 +12,8 @@ import { } from '../typography/Typography'; import { Button, ButtonSize, ButtonVariant } from '../buttons/Button'; import { PlusComparingCards } from '../plus/PlusComparingCards'; +import { ElementPlaceholder } from '../ElementPlaceholder'; +import { ListItemPlaceholder } from '../widgets/ListItemPlaceholder'; interface OnboardingStepProps { onClickNext: () => void; @@ -75,6 +77,37 @@ const PlusBillingCycleSwitch = ({ ); }; +const switchSkeletonItems = Array.from({ length: 2 }, (_, i) => i); +const PlusSkeleton = (): ReactElement => ( +
+
+ +
+
+ {switchSkeletonItems.map((index) => ( +
+ + + + +
+ + {index === 1 && ( + + )} +
+
+ ))} +
+
+); + export const OnboardingPlusStep = ({ onClickNext, }: OnboardingStepProps): ReactElement => { @@ -108,7 +141,7 @@ export const OnboardingPlusStep = ({ strategy. - {!!items?.length && ( + {items.length ? ( <> + ) : ( + )} ); diff --git a/packages/shared/src/components/plus/PlusDesktop.tsx b/packages/shared/src/components/plus/PlusDesktop.tsx index 045533aba3..a56ce4cca7 100644 --- a/packages/shared/src/components/plus/PlusDesktop.tsx +++ b/packages/shared/src/components/plus/PlusDesktop.tsx @@ -58,7 +58,7 @@ export const PlusDesktop = ({ checkoutRef={ref} className={{ container: - 'min-h-40 w-[28.5rem] rounded-16 border border-border-subtlest-tertiary bg-background-default p-5', + 'min-h-40 w-[28.5rem] rounded-16 border border-border-subtlest-tertiary bg-background-default p-5 empty:min-h-[50vh] empty:bg-surface-float', element: 'h-[35rem]', }} /> diff --git a/packages/shared/src/components/plus/PlusInfo.tsx b/packages/shared/src/components/plus/PlusInfo.tsx index 4e70c8ca7e..de1586c8f1 100644 --- a/packages/shared/src/components/plus/PlusInfo.tsx +++ b/packages/shared/src/components/plus/PlusInfo.tsx @@ -22,6 +22,7 @@ import { import { usePlusSubscription } from '../../hooks/usePlusSubscription'; import { LogEvent } from '../../lib/log'; import type { CommonPlusPageProps } from './common'; +import { ElementPlaceholder } from '../ElementPlaceholder'; type PlusInfoProps = { productOptions: ProductOption[]; @@ -30,6 +31,25 @@ type PlusInfoProps = { onContinue?: () => void; }; +const skeletonItems = Array.from({ length: 3 }, (_, i) => i); +const RadioGroupSkeleton = () => ( +
+ {skeletonItems.map((index) => ( +
+ + +
+ ))} +
+); + export const PlusInfo = ({ productOptions, selectedOption, @@ -77,6 +97,7 @@ export const PlusInfo = ({ Billing cycle
+ {productOptions.length === 0 && } {productOptions.map((option) => { const { label, value, price, currencyCode, extraLabel } = option; const checked = selectedOption === value; From 50206fb3c6a839c815ee32ad4c231c7a4e7347d7 Mon Sep 17 00:00:00 2001 From: Chris Bongers Date: Fri, 7 Feb 2025 15:00:19 +0200 Subject: [PATCH 2/2] fix: this breaks annonymous pages now, urgent (#4164) --- packages/shared/src/hooks/auth/useOnboarding.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared/src/hooks/auth/useOnboarding.tsx b/packages/shared/src/hooks/auth/useOnboarding.tsx index 95642ed147..26d2e34570 100644 --- a/packages/shared/src/hooks/auth/useOnboarding.tsx +++ b/packages/shared/src/hooks/auth/useOnboarding.tsx @@ -33,7 +33,7 @@ export const useOnboarding = (): UseOnboarding => { return { shouldShowAuthBanner, - isOnboardingReady: isAuthReady && (isActionsFetched || !user), + isOnboardingReady: isActionsFetched && isAuthReady, hasCompletedEditTags, hasCompletedContentTypes, completeStep: (action: ActionType) => completeAction(action),