From 09ef28c5078af4ade7e2fe5979e26326a63ca96c Mon Sep 17 00:00:00 2001 From: mamadoudicko Date: Mon, 23 Oct 2023 11:09:12 +0200 Subject: [PATCH] feat: fetch demo video from CMS --- .../Sections/DemoSection/DemoSection.tsx | 16 +++++++++++- frontend/lib/api/cms/config.ts | 1 + frontend/lib/api/cms/demoVideo.ts | 25 +++++++++++++++++++ frontend/lib/api/cms/useCmsApi.ts | 2 ++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 frontend/lib/api/cms/demoVideo.ts diff --git a/frontend/app/(home)/components/Sections/DemoSection/DemoSection.tsx b/frontend/app/(home)/components/Sections/DemoSection/DemoSection.tsx index 847d5291ca67..002b05be7172 100644 --- a/frontend/app/(home)/components/Sections/DemoSection/DemoSection.tsx +++ b/frontend/app/(home)/components/Sections/DemoSection/DemoSection.tsx @@ -1,19 +1,33 @@ +import { useQuery } from "@tanstack/react-query"; import Link from "next/link"; import { useTranslation } from "react-i18next"; import { LuChevronRight } from "react-icons/lu"; +import { DEMO_VIDEO_DATA_KEY } from "@/lib/api/cms/config"; +import { useCmsApi } from "@/lib/api/cms/useCmsApi"; import Button from "@/lib/components/ui/Button"; +import Spinner from "@/lib/components/ui/Spinner"; import { VideoPlayer } from "./components/VideoPlayer"; export const DemoSection = (): JSX.Element => { const { t } = useTranslation("home", { keyPrefix: "demo" }); + const { getDemoVideoUrl } = useCmsApi(); + + const { data: demoVideoUrl } = useQuery({ + queryKey: [DEMO_VIDEO_DATA_KEY], + queryFn: getDemoVideoUrl, + }); return (

{t("title")}

- + {demoVideoUrl !== undefined ? ( + + ) : ( + + )}