diff --git a/src/frontend/apps/calendars/.env b/src/frontend/apps/calendars/.env index 8f22306..7ef3cda 100644 --- a/src/frontend/apps/calendars/.env +++ b/src/frontend/apps/calendars/.env @@ -1 +1,2 @@ -NEXT_PUBLIC_API_ORIGIN= \ No newline at end of file +NEXT_PUBLIC_API_ORIGIN= +NEXT_PUBLIC_VISIO_BASE_URL=https://visio.suite.anct.gouv.fr \ No newline at end of file diff --git a/src/frontend/apps/calendars/.env.development b/src/frontend/apps/calendars/.env.development index 73c257c..d53e487 100644 --- a/src/frontend/apps/calendars/.env.development +++ b/src/frontend/apps/calendars/.env.development @@ -1 +1,2 @@ NEXT_PUBLIC_API_ORIGIN=http://localhost:8921 +NEXT_PUBLIC_VISIO_BASE_URL=https://visio.suite.anct.gouv.fr diff --git a/src/frontend/apps/calendars/src/features/calendar/components/scheduler/EventModal.tsx b/src/frontend/apps/calendars/src/features/calendar/components/scheduler/EventModal.tsx index b4632f0..f76c970 100644 --- a/src/frontend/apps/calendars/src/features/calendar/components/scheduler/EventModal.tsx +++ b/src/frontend/apps/calendars/src/features/calendar/components/scheduler/EventModal.tsx @@ -119,13 +119,19 @@ export const EventModal = ({ } }; + const visioBaseUrl = process.env.NEXT_PUBLIC_VISIO_BASE_URL; + const pills = useMemo( () => [ - { - id: "videoConference" as const, - icon: "videocam", - label: t("calendar.event.sections.addVideoConference"), - }, + ...(visioBaseUrl + ? [ + { + id: "videoConference" as const, + icon: "videocam", + label: t("calendar.event.sections.addVideoConference"), + }, + ] + : []), { id: "location" as const, icon: "place", @@ -147,7 +153,7 @@ export const EventModal = ({ label: t("calendar.event.attendees"), }, ], - [t], + [t, visioBaseUrl], ); return ( diff --git a/src/frontend/apps/calendars/src/features/calendar/components/scheduler/event-modal-sections/VideoConferenceSection.tsx b/src/frontend/apps/calendars/src/features/calendar/components/scheduler/event-modal-sections/VideoConferenceSection.tsx index abb2e6c..fc4883c 100644 --- a/src/frontend/apps/calendars/src/features/calendar/components/scheduler/event-modal-sections/VideoConferenceSection.tsx +++ b/src/frontend/apps/calendars/src/features/calendar/components/scheduler/event-modal-sections/VideoConferenceSection.tsx @@ -1,7 +1,7 @@ -import { useState } from "react"; import { useTranslation } from "react-i18next"; import { Button } from "@gouvfr-lasuite/cunningham-react"; import { SectionRow } from "./SectionRow"; +import { generateVisioRoomId } from "./generateVisioRoomId"; interface VideoConferenceSectionProps { url: string; @@ -19,14 +19,12 @@ export const VideoConferenceSection = ({ onToggle, }: VideoConferenceSectionProps) => { const { t } = useTranslation(); - const [isCreating, setIsCreating] = useState(false); const handleCreateVisio = () => { - // Inert for now - will integrate with La Suite API in the future - setIsCreating(true); - setTimeout(() => { - setIsCreating(false); - }, 500); + const baseUrl = process.env.NEXT_PUBLIC_VISIO_BASE_URL; + if (!baseUrl) return; + const roomId = generateVisioRoomId(); + onChange(`${baseUrl}/${roomId}`); }; const handleRemove = () => { @@ -42,15 +40,35 @@ export const VideoConferenceSection = ({ isExpanded={isExpanded} onToggle={onToggle} > - + {url ? ( +