import AuthenticatedClientElement from "@components/Security/AuthenticatedClientElement"; import TypeOfContentTitle from "@components/StyledElements/Titles/TypeOfContentTitle"; import GeneralWrapperStyled from "@components/StyledElements/Wrappers/GeneralWrapper"; import { getUriWithOrg } from "@services/config/config"; import { getOrgCollectionsWithAuthHeader } from "@services/courses/collections"; import { getOrganizationContextInfo } from "@services/organizations/orgs"; import { Metadata } from "next"; import { cookies } from "next/headers"; import Link from "next/link"; import { getAccessTokenFromRefreshTokenCookie } from "@services/auth/auth"; import CollectionThumbnail from "@components/Objects/Other/CollectionThumbnail"; import NewCollectionButton from "@components/StyledElements/Buttons/NewCollectionButton"; type MetadataProps = { params: { orgslug: string, courseid: string }; searchParams: { [key: string]: string | string[] | undefined }; }; export async function generateMetadata( { params }: MetadataProps, ): Promise { // Get Org context information const org = await getOrganizationContextInfo(params.orgslug, { revalidate: 1800, tags: ['organizations'] }); // SEO return { title: `Collections — ${org.name}`, description: `Collections of courses from ${org.name}`, robots: { index: true, follow: true, nocache: true, googleBot: { index: true, follow: true, "max-image-preview": "large", } }, openGraph: { title: `Collections — ${org.name}`, description: `Collections of courses from ${org.name}`, type: 'website', }, }; } const CollectionsPage = async (params: any) => { const cookieStore = cookies(); const access_token = await getAccessTokenFromRefreshTokenCookie(cookieStore) const orgslug = params.params.orgslug; const org = await getOrganizationContextInfo(orgslug, { revalidate: 1800, tags: ['organizations'] }); const org_id = org.org_id; const collections = await getOrgCollectionsWithAuthHeader(org_id, access_token ? access_token : null, { revalidate: 0, tags: ['collections'] }); return (
{collections.map((collection: any) => (
))} {collections.length == 0 &&

No collections yet

Create a collection to group courses together

}
); } export default CollectionsPage