fix(dashboard): course landing page editor section and currency bugs (#768)

* fix(dashboard): course landing page editor section and currency bugs

- Raise currency select z-index so the dropdown is clickable in the
  full-screen editor shell
- Show dashed top/bottom borders and section title on hover and when
  active in EditableLandingSection
- Map hero/header section keys in the course editor preview context

Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com>

* fix(ui): format course landing page pricing with Intl currency

Use getCourseCurrencyFormatter (matching dashboard getCurrencyFormatter)
so NGN and USD prices render as proper locale currency strings instead of
raw numbers with a currency code suffix.

Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com>

* fix(ui): prefix group class for landing section hover badge

Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com>

* fix(ui): remove unused formatCourseCurrency helper

Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com>

* refactor: move currency formatter to @cio/utils

Shared course price formatting belongs in @cio/utils, not the UI
package. Dashboard re-exports the helper to keep existing imports.

Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com>

---------
This commit is contained in:
Rotimi Best
2026-07-19 12:09:38 +01:00
committed by GitHub
co-authored by Rotimi Best
parent 6c3a982daf
commit 0822f5f5a3
7 changed files with 43 additions and 38 deletions
@@ -48,7 +48,7 @@
<Select.Trigger class="w-full">
<p>{course.currency === 'NGN' ? 'NGN' : 'USD'}</p>
</Select.Trigger>
<Select.Content>
<Select.Content class="z-menu-elevated">
<Select.Item value="NGN">NGN</Select.Item>
<Select.Item value="USD">USD</Select.Item>
</Select.Content>
@@ -1,8 +1,2 @@
export default (currency: string | undefined) => {
const locale = currency == 'NGN' ? 'en-NG' : 'en-US';
return new Intl.NumberFormat(locale, {
style: 'currency',
currency: currency,
minimumFractionDigits: 2
});
};
export { getCurrencyFormatter } from '@cio/utils/functions';
export { getCurrencyFormatter as default } from '@cio/utils/functions';
@@ -44,10 +44,13 @@
};
setLandingPageEditContext({
selectedKey: () => selectedSectionKey,
selectKey: (key) => (selectedSectionKey = key),
labelFor: (key) => t.get(`course.navItem.landing_page.editor.title.${key}` as never) || key,
iconFor: (key) => sectionIcons[key] ?? HeaderIcon
selectedKey: () => (selectedSectionKey === 'header' ? 'hero' : selectedSectionKey),
selectKey: (key) => (selectedSectionKey = key === 'hero' ? 'header' : key),
labelFor: (key) => {
const sectionKey = key === 'hero' ? 'header' : key;
return t.get(`course.navItem.landing_page.editor.title.${sectionKey}` as never) || key;
},
iconFor: (key) => sectionIcons[key === 'hero' ? 'header' : key] ?? HeaderIcon
});
function syncCourseStore(_courseData: Course) {