fix(dashboard): align hero enroll CTA with pricing section (#810)
The hero Enroll button was disabled unless metadata.allowNewStudent was explicitly true, while the pricing CTA treated unset values as open (matching the enroll page and API). This left the hero button inert on courses where enrollment was allowed but the flag was not set. Also sync pricing CTA disabled state, use activeOrg for paid enroll on public org-site pages, and keep hero/pricing disabled flags aligned via alignHeroCtaWithPricing. Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: Rotimi Best <[email protected]>
This commit is contained in:
co-authored by
Cursor Agent
Rotimi Best
parent
64112dfc4f
commit
0abdfe2102
@@ -49,7 +49,7 @@
|
||||
return slug ? resolve(`/course/${slug}/enroll`, {}) : '#';
|
||||
});
|
||||
|
||||
const enrollmentsOpen = $derived(get(courseData, 'metadata.allowNewStudent') === true);
|
||||
const enrollmentsOpen = $derived(get(courseData, 'metadata.allowNewStudent') !== false);
|
||||
const enrollDisabled = $derived(editMode || !enrollmentsOpen);
|
||||
|
||||
const discount = $derived(get(courseData, 'metadata.discount', 0));
|
||||
@@ -60,7 +60,7 @@
|
||||
function handlePaidEnrollClick(event: MouseEvent) {
|
||||
event.preventDefault();
|
||||
|
||||
if (editMode || !$currentOrg.siteName) {
|
||||
if (editMode || !activeOrg.siteName) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -250,6 +250,7 @@ export function buildCourseLandingPageProps(
|
||||
ctaLabel: pricingCtaLabel,
|
||||
ctaHref: paidEnrollClick ? undefined : options.enrollHref,
|
||||
ctaOnclick: paidEnrollClick,
|
||||
ctaDisabled: options.enrollDisabled,
|
||||
reward: metadata?.reward?.show ? { show: true, description: metadata.reward.description ?? '' } : undefined
|
||||
},
|
||||
footer: landing.footer
|
||||
|
||||
@@ -10,7 +10,7 @@ export function alignHeroCtaWithPricing(
|
||||
label: pricing.ctaLabel,
|
||||
href: pricing.ctaOnclick ? undefined : (pricing.ctaHref ?? '#pricing'),
|
||||
onclick: pricing.ctaOnclick,
|
||||
disabled: hero.primaryAction.disabled
|
||||
disabled: pricing.ctaDisabled ?? hero.primaryAction.disabled
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
size="lg"
|
||||
href={pricing.ctaOnclick ? undefined : (pricing.ctaHref ?? '#enroll')}
|
||||
onclick={pricing.ctaOnclick}
|
||||
disabled={pricing.ctaDisabled ?? false}
|
||||
class={t.pricingCta}
|
||||
>
|
||||
{pricing.ctaLabel}
|
||||
|
||||
@@ -229,6 +229,7 @@ export type CoursePricing = {
|
||||
ctaLabel: string;
|
||||
ctaHref?: string;
|
||||
ctaOnclick?: (event: MouseEvent) => void;
|
||||
ctaDisabled?: boolean;
|
||||
features?: string[];
|
||||
reward?: {
|
||||
show: boolean;
|
||||
|
||||
Reference in New Issue
Block a user