diff --git a/src/app/(website)/inscripcion-cmyk/page.tsx b/src/app/(website)/inscripcion-cmyk/page.tsx index 2455f65e..975999d4 100644 --- a/src/app/(website)/inscripcion-cmyk/page.tsx +++ b/src/app/(website)/inscripcion-cmyk/page.tsx @@ -4,6 +4,7 @@ import { getSettings } from '@/lib/api.server'; import { getMetadata } from '@/lib/seo'; import Image from 'next/image'; import Link from 'next/link'; +import { Suspense } from 'react'; export const generateMetadata = () => getMetadata({ title: 'CMYK' }); @@ -73,10 +74,12 @@ export default async function CMYKInscriptionPage() { - + + + ); } diff --git a/src/components/CMYKForm/index.tsx b/src/components/CMYKForm/index.tsx index 29367cb1..0da9550d 100644 --- a/src/components/CMYKForm/index.tsx +++ b/src/components/CMYKForm/index.tsx @@ -41,9 +41,9 @@ export default function CMYKForm({ const { data: session, status } = useSession(); const loading = status === 'loading'; - const searchParams = useSearchParams()!; + const searchParams = useSearchParams(); - const type = searchParams.get('type'); + const type = searchParams?.get('type'); const typeSelected = useMemo(() => { const lastType = formsTypes[0].type; diff --git a/src/components/MentorList/index.tsx b/src/components/MentorList/index.tsx index 27ec0467..8fbc81fe 100644 --- a/src/components/MentorList/index.tsx +++ b/src/components/MentorList/index.tsx @@ -10,6 +10,12 @@ import MentorCard from '../MentorCard'; import SimpleModal from '../SimpleModal'; import { useWarnings } from './useWarnings'; +const mentorshipChannels = [ + '756023543304814664', + '756023931433123900', + '761337525654126592', +] as const; + interface MentorListProps { mentors: Mentor[]; topics: Topic[]; @@ -25,20 +31,16 @@ export default function MentorList({ const { data: session } = useSession(); const { warnings, mentorships } = useWarnings(session?.user.id); - const searchParams = useSearchParams()!; - const speciality = searchParams.get('especialidad') ?? ''; + const searchParams = useSearchParams(); + const speciality = searchParams?.get('especialidad') ?? ''; + const filteredByTopic: Mentor[] = mentors.filter((mentor) => mentor.topics.some((topic) => topic._ref === speciality), ); + const filteredMentors = speciality ? filteredByTopic : mentors; const mentorHasEvents = (mentor: Mentor) => { - const mentorshipChannels = [ - '756023543304814664', - '756023931433123900', - '761337525654126592', - ] as const; - return events?.find( (event) => event.creator_id === mentor._id && diff --git a/src/components/Profiles/index.tsx b/src/components/Profiles/index.tsx index a70e47ad..bf515fcc 100644 --- a/src/components/Profiles/index.tsx +++ b/src/components/Profiles/index.tsx @@ -3,7 +3,13 @@ import ProfileList from '@/components/ProfileList'; import FilterForm from '@/components/ProfilesFilterForm'; import { Profile, Role, Seniority, Technology } from '@/lib/types'; -import React, { SetStateAction, useEffect, useRef, useState } from 'react'; +import React, { + SetStateAction, + Suspense, + useEffect, + useRef, + useState, +} from 'react'; import PaginationBar from './PaginationBar'; import { useProfiles } from './useProfiles'; @@ -50,13 +56,15 @@ const Profiles: React.FC = ({ return (
- + + +
= ({ }) => { const router = useRouter(); - const searchParams = useSearchParams()!; - const activesQuery = searchParams.get('activos'); + const searchParams = useSearchParams(); + const activesQuery = searchParams?.get('activos'); const onSubmit: React.FormEventHandler = (e) => { e.preventDefault();