'use client' import React from 'react' import { LandingSection } from '@components/Dashboard/Pages/Org/OrgEditLanding/landing_types' import CourseThumbnail from '@components/Objects/Thumbnails/CourseThumbnail' import useSWR from 'swr' import { getOrgCourses } from '@services/courses/courses' import { useLHSession } from '@components/Contexts/LHSessionContext' import CourseThumbnailLanding from '@components/Objects/Thumbnails/CourseThumbnailLanding' interface LandingCustomProps { landing: { sections: LandingSection[] enabled: boolean } orgslug: string } function LandingCustom({ landing, orgslug }: LandingCustomProps) { const session = useLHSession() as any const access_token = session?.data?.tokens?.access_token // Fetch all courses for the organization const { data: allCourses } = useSWR( orgslug ? [orgslug, access_token] : null, ([slug, token]) => getOrgCourses(slug, null, token) ) const renderSection = (section: LandingSection) => { switch (section.type) { case 'hero': return (
{person.description}