chore: ai, public course and other ui improvements
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import * as z from 'zod';
|
||||
|
||||
/**
|
||||
* Creator-configured callout shown on public course lesson pages.
|
||||
* Rendered inline at the bottom of every item body, and as the full replacement
|
||||
* for locked items.
|
||||
*/
|
||||
export const ZCourseCallout = z.object({
|
||||
title: z.string().min(1).max(120),
|
||||
description: z.string().min(1).max(500),
|
||||
buttonLabel: z.string().min(1).max(40),
|
||||
buttonUrl: z.string().url()
|
||||
});
|
||||
export type TCourseCallout = z.infer<typeof ZCourseCallout>;
|
||||
|
||||
/**
|
||||
* Accepts the callout object, or `null` to clear it.
|
||||
*/
|
||||
export const ZCourseCalloutInput = ZCourseCallout.nullable();
|
||||
export type TCourseCalloutInput = z.infer<typeof ZCourseCalloutInput>;
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as z from 'zod';
|
||||
|
||||
import { ALLOWED_CONTENT_TYPES, ALLOWED_DOCUMENT_TYPES } from '../constants';
|
||||
import { ZCourseCalloutInput } from './callout';
|
||||
|
||||
export const ZCourseClone = z.object({
|
||||
title: z.string().min(1),
|
||||
@@ -227,7 +228,7 @@ export type TComplianceSettings = z.infer<typeof ZComplianceSettings>;
|
||||
export const ZCourseCreateBase = z.object({
|
||||
title: z.string().min(1),
|
||||
description: z.string().min(1),
|
||||
type: z.enum(['LIVE_CLASS', 'SELF_PACED', 'COMPLIANCE']),
|
||||
type: z.enum(['LIVE_CLASS', 'SELF_PACED', 'COMPLIANCE', 'PUBLIC']),
|
||||
organizationId: z.string().min(1),
|
||||
compliance: ZComplianceSettings.optional()
|
||||
});
|
||||
@@ -333,7 +334,7 @@ export type TCertificationSettings = z.infer<typeof ZCertificationSettings>;
|
||||
export const ZCourseUpdateBase = z.object({
|
||||
title: z.string().min(1).optional(),
|
||||
description: z.string().min(1).optional(),
|
||||
type: z.enum(['LIVE_CLASS', 'SELF_PACED', 'COMPLIANCE']).optional(),
|
||||
type: z.enum(['LIVE_CLASS', 'SELF_PACED', 'COMPLIANCE', 'PUBLIC']).optional(),
|
||||
logo: z.string().optional(),
|
||||
slug: z.string().optional(),
|
||||
isPublished: z.boolean().optional(),
|
||||
@@ -343,7 +344,8 @@ export const ZCourseUpdateBase = z.object({
|
||||
currency: z.enum(['NGN', 'USD']).optional(),
|
||||
certificate: ZCertificationSettings.optional(),
|
||||
tagIds: z.array(z.uuid()).max(100).optional(),
|
||||
compliance: ZComplianceSettings.optional()
|
||||
compliance: ZComplianceSettings.optional(),
|
||||
callout: ZCourseCalloutInput.optional()
|
||||
});
|
||||
|
||||
export const ZCourseUpdate = ZCourseUpdateBase.refine(
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
*/
|
||||
|
||||
export * from './course';
|
||||
export * from './callout';
|
||||
export * from './compliance';
|
||||
export * from './public-course';
|
||||
export * from './section';
|
||||
export * from './invite';
|
||||
export { ZCourseGetParam, type TCourseGetParam } from './course';
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import * as z from 'zod';
|
||||
|
||||
import { ZSlug } from '../shared/slug';
|
||||
|
||||
/**
|
||||
* Route params + query schemas for the anonymous, SEO-indexable public course
|
||||
* surface under `(org-site)/course/[courseSlug]`.
|
||||
*/
|
||||
|
||||
export const ZPublicCourseBySlugParam = z.object({
|
||||
courseSlug: ZSlug
|
||||
});
|
||||
export type TPublicCourseBySlugParam = z.infer<typeof ZPublicCourseBySlugParam>;
|
||||
|
||||
export const ZPublicCourseItemParam = z.object({
|
||||
courseSlug: ZSlug,
|
||||
itemSlug: ZSlug
|
||||
});
|
||||
export type TPublicCourseItemParam = z.infer<typeof ZPublicCourseItemParam>;
|
||||
Reference in New Issue
Block a user