feat: add virtual location input #121
This commit is contained in:
@@ -188,6 +188,9 @@ export function EventModal({
|
||||
const [location, setLocation] = useState(
|
||||
event?.locations ? Object.values(event.locations)[0]?.name || "" : ""
|
||||
);
|
||||
const [virtualLocation, setVirtualLocation] = useState(
|
||||
event?.virtualLocations ? Object.values(event.virtualLocations)[0]?.uri || "" : ""
|
||||
);
|
||||
const [startDate, setStartDate] = useState(formatDateInput(getInitialStart()));
|
||||
const [startTime, setStartTime] = useState(formatTimeInput(getInitialStart()));
|
||||
const [endDate, setEndDate] = useState(formatDateInput(getInitialEnd()));
|
||||
@@ -313,6 +316,20 @@ export function EventModal({
|
||||
data.locations = null;
|
||||
}
|
||||
|
||||
if (virtualLocation.trim()) {
|
||||
data.virtualLocations = {
|
||||
vl1: {
|
||||
"@type": "VirtualLocation",
|
||||
name: null,
|
||||
description: null,
|
||||
uri: virtualLocation.trim(),
|
||||
features: null,
|
||||
},
|
||||
};
|
||||
} else if (event && event.virtualLocations && Object.keys(event.virtualLocations).length > 0) {
|
||||
data.virtualLocations = null;
|
||||
}
|
||||
|
||||
if (recurrence !== "none") {
|
||||
data.recurrenceRules = [{
|
||||
"@type": "RecurrenceRule",
|
||||
@@ -372,7 +389,7 @@ export function EventModal({
|
||||
} finally {
|
||||
setIsSaving(false);
|
||||
}
|
||||
}, [title, description, location, startDate, startTime, endDate, endTime, allDay, calendarId, recurrence, alert, attendees, sendInvitations, currentUserEmails, existingParticipants, event, onSave, isSaving]);
|
||||
}, [title, description, location, virtualLocation, startDate, startTime, endDate, endTime, allDay, calendarId, recurrence, alert, attendees, sendInvitations, currentUserEmails, existingParticipants, event, onSave, isSaving]);
|
||||
|
||||
const handleRsvp = useCallback((status: CalendarParticipant['participationStatus']) => {
|
||||
if (!event || !userParticipantId || !onRsvp) return;
|
||||
@@ -401,6 +418,7 @@ export function EventModal({
|
||||
privacy: event.privacy,
|
||||
};
|
||||
if (event.locations) data.locations = structuredClone(event.locations);
|
||||
if (event.virtualLocations) data.virtualLocations = structuredClone(event.virtualLocations);
|
||||
if (event.recurrenceRules) data.recurrenceRules = structuredClone(event.recurrenceRules);
|
||||
if (event.alerts) data.alerts = structuredClone(event.alerts);
|
||||
if (event.participants) data.participants = structuredClone(event.participants);
|
||||
@@ -778,6 +796,22 @@ export function EventModal({
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="text-sm font-medium mb-1 block">
|
||||
<span className="flex items-center gap-1.5">
|
||||
<Video className="w-4 h-4" />
|
||||
{t("form.meeting_link")}
|
||||
</span>
|
||||
</label>
|
||||
<Input
|
||||
type="url"
|
||||
value={virtualLocation}
|
||||
onChange={(e) => setVirtualLocation(e.target.value)}
|
||||
placeholder="https://meet.example.com/..."
|
||||
maxLength={2000}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="text-sm font-medium mb-1 block">
|
||||
<span className="flex items-center gap-1.5">
|
||||
|
||||
@@ -1894,6 +1894,7 @@
|
||||
"title": "Titel",
|
||||
"description": "Beschreibung",
|
||||
"location": "Ort",
|
||||
"meeting_link": "Meeting-Link",
|
||||
"start_date": "Startdatum",
|
||||
"end_date": "Enddatum",
|
||||
"start_time": "Startzeit",
|
||||
|
||||
@@ -1894,6 +1894,7 @@
|
||||
"title": "Title",
|
||||
"description": "Description",
|
||||
"location": "Location",
|
||||
"meeting_link": "Meeting link",
|
||||
"start_date": "Start date",
|
||||
"end_date": "End date",
|
||||
"start_time": "Start time",
|
||||
|
||||
@@ -1894,6 +1894,7 @@
|
||||
"title": "Título",
|
||||
"description": "Descripción",
|
||||
"location": "Ubicación",
|
||||
"meeting_link": "Enlace de reunión",
|
||||
"start_date": "Fecha de inicio",
|
||||
"end_date": "Fecha de fin",
|
||||
"start_time": "Hora de inicio",
|
||||
|
||||
@@ -1894,6 +1894,7 @@
|
||||
"title": "Titre",
|
||||
"description": "Description",
|
||||
"location": "Lieu",
|
||||
"meeting_link": "Lien de réunion",
|
||||
"start_date": "Date de début",
|
||||
"end_date": "Date de fin",
|
||||
"start_time": "Heure de début",
|
||||
|
||||
@@ -1894,6 +1894,7 @@
|
||||
"title": "Titolo",
|
||||
"description": "Descrizione",
|
||||
"location": "Luogo",
|
||||
"meeting_link": "Link riunione",
|
||||
"start_date": "Data di inizio",
|
||||
"end_date": "Data di fine",
|
||||
"start_time": "Ora di inizio",
|
||||
|
||||
@@ -1894,6 +1894,7 @@
|
||||
"title": "タイトル",
|
||||
"description": "説明",
|
||||
"location": "場所",
|
||||
"meeting_link": "会議リンク",
|
||||
"start_date": "開始日",
|
||||
"end_date": "終了日",
|
||||
"start_time": "開始時刻",
|
||||
|
||||
@@ -1894,6 +1894,7 @@
|
||||
"title": "Titel",
|
||||
"description": "Beschrijving",
|
||||
"location": "Locatie",
|
||||
"meeting_link": "Vergaderlink",
|
||||
"start_date": "Startdatum",
|
||||
"end_date": "Einddatum",
|
||||
"start_time": "Starttijd",
|
||||
|
||||
@@ -1894,6 +1894,7 @@
|
||||
"title": "Título",
|
||||
"description": "Descrição",
|
||||
"location": "Local",
|
||||
"meeting_link": "Link da reunião",
|
||||
"start_date": "Data de início",
|
||||
"end_date": "Data de término",
|
||||
"start_time": "Hora de início",
|
||||
|
||||
@@ -1894,6 +1894,7 @@
|
||||
"title": "Название",
|
||||
"description": "Описание",
|
||||
"location": "Место",
|
||||
"meeting_link": "Ссылка на встречу",
|
||||
"start_date": "Дата начала",
|
||||
"end_date": "Дата окончания",
|
||||
"start_time": "Время начала",
|
||||
|
||||
Reference in New Issue
Block a user