Skip to content

Commit

Permalink
Merge branch 'main' into AS-976-store-last-prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelchris authored Feb 7, 2025
2 parents 91e7673 + 50206fb commit df567c5
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
37 changes: 36 additions & 1 deletion packages/shared/src/components/onboarding/OnboardingPlusStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -75,6 +77,37 @@ const PlusBillingCycleSwitch = ({
);
};

const switchSkeletonItems = Array.from({ length: 2 }, (_, i) => i);
const PlusSkeleton = (): ReactElement => (
<div className="flex flex-col items-center">
<div className="mx-auto my-6 inline-flex gap-1 rounded-12 border border-border-subtlest-tertiary p-1 tablet:my-8">
<ElementPlaceholder className="mx-auto inline-block h-10 w-80 rounded-10" />
</div>
<div className="mx-auto grid grid-cols-1 place-content-center items-start gap-6 tablet:grid-cols-2">
{switchSkeletonItems.map((index) => (
<div
key={index}
className={classNames(
'mx-auto w-[21rem] max-w-full rounded-16 border border-border-subtlest-tertiary bg-surface-float p-4',
index === 0 ? 'min-h-80' : 'min-h-96',
)}
>
<ElementPlaceholder className="mb-4 h-6 w-10 rounded-4" />
<ElementPlaceholder className="mb-1 h-8 w-10 rounded-4" />
<ElementPlaceholder className="h-3 w-20 rounded-4" />
<ElementPlaceholder className="my-4 h-10 w-full rounded-16" />
<div className="flex flex-col gap-2">
<ListItemPlaceholder padding="p-0 gap-2.5" textClassName="h-3" />
{index === 1 && (
<ListItemPlaceholder padding="p-0 gap-2.5" textClassName="h-3" />
)}
</div>
</div>
))}
</div>
</div>
);

export const OnboardingPlusStep = ({
onClickNext,
}: OnboardingStepProps): ReactElement => {
Expand Down Expand Up @@ -108,7 +141,7 @@ export const OnboardingPlusStep = ({
strategy.
</Typography>
</header>
{!!items?.length && (
{items.length ? (
<>
<PlusBillingCycleSwitch
productOptions={items}
Expand All @@ -121,6 +154,8 @@ export const OnboardingPlusStep = ({
onClickNext={onClickNext}
/>
</>
) : (
<PlusSkeleton />
)}
</section>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/components/plus/PlusDesktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]',
}}
/>
Expand Down
21 changes: 21 additions & 0 deletions packages/shared/src/components/plus/PlusInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand All @@ -30,6 +31,25 @@ type PlusInfoProps = {
onContinue?: () => void;
};

const skeletonItems = Array.from({ length: 3 }, (_, i) => i);
const RadioGroupSkeleton = () => (
<div>
{skeletonItems.map((index) => (
<div
key={index}
className={classNames(
'flex min-h-12 items-center justify-between gap-2 rounded-10 !p-2',
index === 0 &&
'-m-px border border-border-subtlest-primary bg-surface-float',
)}
>
<ElementPlaceholder className="h-4 w-2/3" />
<ElementPlaceholder className="h-4 w-1/5" />
</div>
))}
</div>
);

export const PlusInfo = ({
productOptions,
selectedOption,
Expand Down Expand Up @@ -77,6 +97,7 @@ export const PlusInfo = ({
Billing cycle
</Typography>
<div className="min-h-[6.125rem] rounded-10 border border-border-subtlest-tertiary">
{productOptions.length === 0 && <RadioGroupSkeleton />}
{productOptions.map((option) => {
const { label, value, price, currencyCode, extraLabel } = option;
const checked = selectedOption === value;
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/hooks/auth/useOnboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const useOnboarding = (): UseOnboarding => {

return {
shouldShowAuthBanner,
isOnboardingReady: isAuthReady && (isActionsFetched || !user),
isOnboardingReady: isActionsFetched && isAuthReady,
hasCompletedEditTags,
hasCompletedContentTypes,
completeStep: (action: ActionType) => completeAction(action),
Expand Down

0 comments on commit df567c5

Please sign in to comment.