feat(lms): add student certificates page and sidebar nav (#696)
* feat(lms): add student certificates page and sidebar nav Add a Certificates item to the student LMS sidebar that lists courses where the student has earned a certificate. Each course card includes a View Certificate action linking to the existing per-course certificate page. * refactor: reuse isOrgOnFreePlan helper from org store * chore(i18n): add certificates translations for all locales ---------
This commit is contained in:
@@ -71,6 +71,16 @@ const getActivePlan = (org: AccountOrg) => {
|
||||
return org.plans.find((p) => p.isActive);
|
||||
};
|
||||
|
||||
export function isOrgOnFreePlan(org: AccountOrg | null | undefined) {
|
||||
if (!org?.id || PUBLIC_IS_SELFHOSTED === 'true') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const plan = getActivePlan(org);
|
||||
|
||||
return !plan || plan.planName === PLAN.BASIC;
|
||||
}
|
||||
|
||||
export const currentOrgPlan = derived(currentOrg, ($currentOrg) => getActivePlan($currentOrg));
|
||||
|
||||
export const currentOrgPath = derived(currentOrg, ($currentOrg) =>
|
||||
@@ -126,13 +136,7 @@ export function getOrgPublicUrl(org: OrgPublicOrigin, pathname = '/'): string {
|
||||
|
||||
export const currentOrgDomain = derived(currentOrg, ($currentOrg) => getOrgPublicOrigin($currentOrg));
|
||||
|
||||
export const isFreePlan = derived(currentOrg, ($currentOrg) => {
|
||||
if (!$currentOrg.id || PUBLIC_IS_SELFHOSTED === 'true') return false;
|
||||
|
||||
const plan = getActivePlan($currentOrg);
|
||||
|
||||
return !plan || plan.planName === PLAN.BASIC;
|
||||
});
|
||||
export const isFreePlan = derived(currentOrg, ($currentOrg) => isOrgOnFreePlan($currentOrg));
|
||||
|
||||
export const isEnterprisePlan = derived(currentOrg, ($currentOrg) => {
|
||||
if (PUBLIC_IS_SELFHOSTED === 'true') return true;
|
||||
|
||||
Reference in New Issue
Block a user