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