@@ -0,0 +1,7 @@
|
||||
import { RootState } from "@/app/store";
|
||||
import { createSelector } from "@reduxjs/toolkit";
|
||||
|
||||
export const selectCalendars = createSelector(
|
||||
(state: RootState) => state.calendars.list,
|
||||
(list) => Object.values(list)
|
||||
);
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useAppDispatch, useAppSelector } from "@/app/hooks";
|
||||
import { selectCalendars } from "@/app/selectors/selectCalendars";
|
||||
import { searchEventsAsync } from "@/features/Search/SearchSlice";
|
||||
import { setView } from "@/features/Settings/SettingsSlice";
|
||||
import { userAttendee } from "@/features/User/models/attendee";
|
||||
@@ -31,12 +32,12 @@ import UserSearch from "../Attendees/AttendeeSearch";
|
||||
import { PeopleSearch, User } from "../Attendees/PeopleSearch";
|
||||
import { CalendarItemList } from "../Calendar/CalendarItemList";
|
||||
|
||||
const SEARCH_OBJECT_TYPES = ["user", "contact"];
|
||||
|
||||
export default function SearchBar() {
|
||||
const { t } = useI18n();
|
||||
const dispatch = useAppDispatch();
|
||||
const calendars = Object.values(
|
||||
useAppSelector((state) => state.calendars.list)
|
||||
);
|
||||
const calendars = useAppSelector(selectCalendars);
|
||||
const userId = useAppSelector((state) => state.user.userData?.openpaasId);
|
||||
const personnalCalendars = userId
|
||||
? calendars.filter((c) => extractEventBaseUuid(c.id) === userId)
|
||||
@@ -227,7 +228,7 @@ export default function SearchBar() {
|
||||
onChange={(_event, users) => {
|
||||
handleContactSelect(users);
|
||||
}}
|
||||
objectTypes={["user", "contact"]}
|
||||
objectTypes={SEARCH_OBJECT_TYPES}
|
||||
onToggleEventPreview={() => {}}
|
||||
customSlotProps={{
|
||||
popper: {
|
||||
|
||||
Reference in New Issue
Block a user