#12 topbar search (#371)

- added search in topbar
 - added skeleton search results page
 - added tests
 - set personal calendars as default search in and allow to select personal and shared as a search in option

---------

Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
Camille Moussu
2025-11-28 14:54:13 +01:00
committed by GitHub
parent 1a85afc57d
commit ae17ac2bd6
20 changed files with 1508 additions and 152 deletions
+39
View File
@@ -10,6 +10,7 @@ import {
import ICAL from "ical.js";
import moment from "moment-timezone";
import { detectDateTimeFormat } from "../../components/Event/utils/dateTimeHelpers";
import { User } from "../../components/Attendees/PeopleSearch";
function resolveTimezoneId(tzid?: string): string | undefined {
if (!tzid) return undefined;
@@ -361,3 +362,41 @@ export async function importEventFromFile(id: string, calLink: string) {
});
return response;
}
export async function searchEvent(
query: string,
filters: {
searchIn: string[];
keywords: string;
organizers: string[];
attendees: string[];
}
) {
const { keywords, searchIn, organizers, attendees } = filters;
const reqParam: {
query: string;
calendars: { calendarId: string; userId: string }[];
organizers?: string[];
attendees?: string[];
} = {
query: !!keywords ? keywords : query,
calendars: searchIn.map((calId) => {
const [userId, calendarId] = calId.split("/");
return { calendarId, userId };
}),
};
if (organizers.length) {
reqParam.organizers = organizers;
}
if (attendees.length) {
reqParam.attendees = attendees;
}
const response = await api
.post("calendar/api/events/search?limit=30&offset=0", {
body: JSON.stringify(reqParam),
})
.json();
return response;
}