diff --git a/apps/web/app/orgs/[orgslug]/(withmenu)/page.tsx b/apps/web/app/orgs/[orgslug]/(withmenu)/page.tsx index 294614ce..ef1780aa 100644 --- a/apps/web/app/orgs/[orgslug]/(withmenu)/page.tsx +++ b/apps/web/app/orgs/[orgslug]/(withmenu)/page.tsx @@ -16,6 +16,8 @@ import { getOrgCollections } from '@services/courses/collections' import { getServerSession } from 'next-auth' import { nextAuthOptions } from 'app/auth/options' import { getOrgThumbnailMediaDirectory } from '@services/media/media' +import LandingClassic from '@components/Landings/LandingClassic' +import LandingCustom from '@components/Landings/LandingCustom' type MetadataProps = { params: { orgslug: string } @@ -71,7 +73,7 @@ const OrgHomePage = async (params: any) => { access_token ? access_token : null ) const org = await getOrganizationContextInfo(orgslug, { - revalidate: 1800, + revalidate: 0, tags: ['organizations'], }) const org_id = org.id @@ -81,141 +83,24 @@ const OrgHomePage = async (params: any) => { { revalidate: 0, tags: ['courses'] } ) + // Check if custom landing is enabled + const hasCustomLanding = org.config?.config?.landing?.enabled + return (
- - {/* Collections */} -
-
- - - - - - -
-
- {collections.map((collection: any) => ( -
- -
- ))} - {collections.length === 0 && ( -
-
-
- - - - -
-

- No collections yet -

-

- -

-
-
- )} -
-
- - {/* Courses */} -
-
- - - - - - -
-
- {courses.map((course: any) => ( -
- -
- ))} - {courses.length === 0 && ( -
-
-
- - - - -
-

- No courses yet -

-

- -

-
-
- )} -
-
-
+ {hasCustomLanding ? ( + + ) : ( + + )}
) } diff --git a/apps/web/components/Landings/LandingClassic.tsx b/apps/web/components/Landings/LandingClassic.tsx new file mode 100644 index 00000000..6038991d --- /dev/null +++ b/apps/web/components/Landings/LandingClassic.tsx @@ -0,0 +1,160 @@ +import React from 'react' +import GeneralWrapperStyled from '@components/Objects/StyledElements/Wrappers/GeneralWrapper' +import TypeOfContentTitle from '@components/Objects/StyledElements/Titles/TypeOfContentTitle' +import CourseThumbnail from '@components/Objects/Thumbnails/CourseThumbnail' +import CollectionThumbnail from '@components/Objects/Thumbnails/CollectionThumbnail' +import AuthenticatedClientElement from '@components/Security/AuthenticatedClientElement' +import NewCourseButton from '@components/Objects/StyledElements/Buttons/NewCourseButton' +import NewCollectionButton from '@components/Objects/StyledElements/Buttons/NewCollectionButton' +import ContentPlaceHolderIfUserIsNotAdmin from '@components/Objects/ContentPlaceHolder' +import Link from 'next/link' +import { getUriWithOrg } from '@services/config/config' + +interface LandingClassicProps { + courses: any[] + collections: any[] + orgslug: string + org_id: string +} + +function LandingClassic({ courses, collections, orgslug, org_id }: LandingClassicProps) { + return ( +
+ + {/* Collections */} +
+
+ + + + + + +
+
+ {collections.map((collection: any) => ( +
+ +
+ ))} + {collections.length === 0 && ( +
+
+
+ + + + +
+

+ No collections yet +

+

+ +

+
+
+ )} +
+
+ + {/* Courses */} +
+
+ + + + + + +
+
+ {courses.map((course: any) => ( +
+ +
+ ))} + {courses.length === 0 && ( +
+
+
+ + + + +
+

+ No courses yet +

+

+ +

+
+
+ )} +
+
+
+
+ ) +} + +export default LandingClassic \ No newline at end of file diff --git a/apps/web/components/Landings/LandingCustom.tsx b/apps/web/components/Landings/LandingCustom.tsx new file mode 100644 index 00000000..b401536b --- /dev/null +++ b/apps/web/components/Landings/LandingCustom.tsx @@ -0,0 +1,164 @@ +import React from 'react' +import { LandingSection } from '@components/Dashboard/Pages/Org/OrgEditLanding/landing_types' + +interface LandingCustomProps { + landing: { + sections: LandingSection[] + enabled: boolean + } + orgslug: string +} + +function LandingCustom({ landing, orgslug }: LandingCustomProps) { + const renderSection = (section: LandingSection) => { + switch (section.type) { + case 'hero': + return ( +
+
+

+ {section.heading.text} +

+

+ {section.subheading.text} +

+
+ {section.buttons.map((button, index) => ( + + {button.text} + + ))} +
+
+
+ ) + case 'text-and-image': + return ( +
+
+
+

{section.title}

+

{section.text}

+
+ {section.buttons.map((button, index) => ( + + {button.text} + + ))} +
+
+
+ {section.image.alt} +
+
+
+ ) + case 'logos': + return ( +
+
+ {section.logos.map((logo, index) => ( + {logo.alt} + ))} +
+
+ ) + case 'people': + return ( +
+

{section.title}

+
+ {section.people.map((person, index) => ( +
+ {person.name} +

{person.name}

+

{person.description}

+
+ ))} +
+
+ ) + case 'featured-courses': + return ( +
+

{section.title}

+
+ {section.courses.map((course, index) => ( +
+ {/* Course card content - you'll need to fetch course details */} +

Course ID: {course.course_uuid}

+
+ ))} +
+
+ ) + default: + return null + } + } + + return ( +
+ {landing.sections.map((section) => renderSection(section))} +
+ ) +} + +export default LandingCustom \ No newline at end of file