vision refactor
This commit is contained in:
parent
0ef38dc5dd
commit
ea4d685db4
@ -79,10 +79,8 @@ export default function VisionPage() {
|
||||
start: string;
|
||||
end: string;
|
||||
allDay: boolean;
|
||||
location: string;
|
||||
description: string;
|
||||
recurrence: "none" | "daily" | "weekly" | "monthly";
|
||||
isVideoConference: boolean;
|
||||
}>({
|
||||
type: "",
|
||||
entityId: "",
|
||||
@ -91,10 +89,8 @@ export default function VisionPage() {
|
||||
start: "",
|
||||
end: "",
|
||||
allDay: false,
|
||||
location: "",
|
||||
description: "",
|
||||
recurrence: "none",
|
||||
isVideoConference: false,
|
||||
});
|
||||
|
||||
// Redirect if not authenticated
|
||||
@ -269,6 +265,7 @@ export default function VisionPage() {
|
||||
}
|
||||
|
||||
// Otherwise, generate URL from type and id using shared function
|
||||
if (!type) return; // Type must be "group" or "mission"
|
||||
const url = generateJitsiUrl(type, id);
|
||||
|
||||
setSelectedConference({ type, id, name });
|
||||
@ -334,10 +331,8 @@ export default function VisionPage() {
|
||||
start: startDate.toISOString().slice(0, 16),
|
||||
end: endDate.toISOString().slice(0, 16),
|
||||
allDay: false,
|
||||
location: "",
|
||||
description: "",
|
||||
recurrence: "none",
|
||||
isVideoConference: false,
|
||||
});
|
||||
setShowMeetingDialog(true);
|
||||
};
|
||||
@ -433,8 +428,8 @@ export default function VisionPage() {
|
||||
}
|
||||
}
|
||||
|
||||
// Determine location: use Jitsi URL if video conference is enabled, otherwise use manual location
|
||||
const locationToSave = meetingForm.isVideoConference ? getJitsiUrl() : (meetingForm.location || null);
|
||||
// All meetings in Vision page are video conferences, so always generate Jitsi URL
|
||||
const jitsiUrlToSave = getJitsiUrl();
|
||||
|
||||
// Create all events via API
|
||||
const eventPromises = eventsToCreate.map(async ({ start, end }) => {
|
||||
@ -449,7 +444,7 @@ export default function VisionPage() {
|
||||
start: start.toISOString(),
|
||||
end: end.toISOString(),
|
||||
allDay: meetingForm.allDay,
|
||||
location: locationToSave,
|
||||
location: jitsiUrlToSave,
|
||||
calendarId: targetCalendar.id,
|
||||
}),
|
||||
});
|
||||
@ -480,10 +475,8 @@ export default function VisionPage() {
|
||||
start: "",
|
||||
end: "",
|
||||
allDay: false,
|
||||
location: "",
|
||||
description: "",
|
||||
recurrence: "none",
|
||||
isVideoConference: false,
|
||||
});
|
||||
toast({
|
||||
title: "Succès",
|
||||
@ -1107,57 +1100,6 @@ export default function VisionPage() {
|
||||
<Label htmlFor="allDay" className="text-gray-800">Toute la journée</Label>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<div className="flex items-center space-x-2 mb-2">
|
||||
<Checkbox
|
||||
id="isVideoConference"
|
||||
checked={meetingForm.isVideoConference}
|
||||
onCheckedChange={(checked) => {
|
||||
const isChecked = checked as boolean;
|
||||
setMeetingForm({
|
||||
...meetingForm,
|
||||
isVideoConference: isChecked,
|
||||
// If enabling video conference, generate Jitsi URL
|
||||
// If disabling, clear location
|
||||
location: isChecked ? getJitsiUrl() : ""
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Label
|
||||
htmlFor="isVideoConference"
|
||||
className="text-base font-semibold text-gray-800 cursor-pointer"
|
||||
>
|
||||
Visioconférence
|
||||
</Label>
|
||||
</div>
|
||||
{meetingForm.isVideoConference ? (
|
||||
<div className="space-y-1">
|
||||
<Input
|
||||
id="meeting-location"
|
||||
value={getJitsiUrl()}
|
||||
disabled
|
||||
className="bg-gray-100 text-gray-600 cursor-not-allowed"
|
||||
placeholder="Lien Jitsi généré automatiquement"
|
||||
/>
|
||||
<p className="text-xs text-gray-500">
|
||||
Le lien Jitsi sera généré automatiquement pour cette réunion
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-1">
|
||||
<Label htmlFor="meeting-location" className="text-gray-800">Lieu</Label>
|
||||
<Input
|
||||
id="meeting-location"
|
||||
value={meetingForm.location}
|
||||
onChange={(e) =>
|
||||
setMeetingForm({ ...meetingForm, location: e.target.value })
|
||||
}
|
||||
placeholder="Ajouter un lieu"
|
||||
className="bg-white text-gray-900"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="text-gray-800">Description</Label>
|
||||
@ -1211,10 +1153,8 @@ export default function VisionPage() {
|
||||
start: "",
|
||||
end: "",
|
||||
allDay: false,
|
||||
location: "",
|
||||
description: "",
|
||||
recurrence: "none",
|
||||
isVideoConference: false,
|
||||
});
|
||||
}}
|
||||
className="bg-white hover:bg-gray-50 text-gray-900 border-gray-200"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user