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:
Rotimi Best
2026-07-31 14:53:01 +01:00
committed by GitHub
co-authored by Cursor Agent Rotimi Best
parent 64112dfc4f
commit 0abdfe2102
5 changed files with 6 additions and 3 deletions
@@ -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