@@ -304,8 +317,10 @@ export default function CalendarApp() {
weekNumbers
weekNumberFormat={{ week: "long" }}
slotDuration={"00:30:00"}
- slotLabelInterval={"01:00:00"}
- scrollTime={"08:00:00"}
+ slotLabelInterval={"00:30:00"}
+ scrollTime={new Date(Date.now() - 2 * 60 * 60 * 1000)
+ .toTimeString()
+ .slice(0, 5)}
unselectAuto={false}
allDayText=""
slotLabelFormat={{
diff --git a/src/components/Calendar/CalendarSelection.tsx b/src/components/Calendar/CalendarSelection.tsx
index d526ed1..1734226 100644
--- a/src/components/Calendar/CalendarSelection.tsx
+++ b/src/components/Calendar/CalendarSelection.tsx
@@ -10,7 +10,6 @@ import { Calendars } from "../../features/Calendars/CalendarTypes";
import MoreVertIcon from "@mui/icons-material/MoreVert";
import IconButton from "@mui/material/IconButton";
import Checkbox from "@mui/material/Checkbox";
-import Button from "@mui/material/Button";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
function CalendarAccordion({
@@ -34,8 +33,8 @@ function CalendarAccordion({
}) {
const allCalendars = useAppSelector((state) => state.calendars.list);
- if (calendars.length === 0) return null;
const [expended, setExpended] = useState(defaultExpanded);
+ if (calendars.length === 0) return null;
return (
@@ -81,7 +80,8 @@ export default function CalendarSelection({
selectedCalendars: string[];
setSelectedCalendars: Function;
}) {
- const userId = useAppSelector((state) => state.user.userData.openpaasId);
+ const userId =
+ useAppSelector((state) => state.user.userData?.openpaasId) ?? "";
const calendars = useAppSelector((state) => state.calendars.list);
const personnalCalendars = Object.keys(calendars).filter(
diff --git a/src/components/Menubar/Menubar.css b/src/components/Menubar/Menubar.css
index aafc6df..2fcffb0 100644
--- a/src/components/Menubar/Menubar.css
+++ b/src/components/Menubar/Menubar.css
@@ -42,7 +42,8 @@
padding: 0.5rem;
width: 100%;
z-index: 1000;
- height: 7vh;
+ height: 80px;
+ background-color: #fff;
}
.menubar-item {
diff --git a/src/components/Menubar/Menubar.tsx b/src/components/Menubar/Menubar.tsx
index cc3ee09..3850f71 100644
--- a/src/components/Menubar/Menubar.tsx
+++ b/src/components/Menubar/Menubar.tsx
@@ -48,14 +48,18 @@ export function Menubar() {
- {user.name && user.family_name
+ {user?.name && user?.family_name
? `${user.name[0]}${user.family_name[0]}`
- : user.email[0]}
+ : (user?.email?.[0] ?? "")}
diff --git a/src/features/Calendars/CalendarModal.tsx b/src/features/Calendars/CalendarModal.tsx
index 623716b..d53c3c1 100644
--- a/src/features/Calendars/CalendarModal.tsx
+++ b/src/features/Calendars/CalendarModal.tsx
@@ -30,7 +30,7 @@ function CalendarPopover({
}) {
const dispatch = useAppDispatch();
const userId =
- useAppSelector((state) => state.user.userData.openpaasId) ?? "";
+ useAppSelector((state) => state.user.userData?.openpaasId) ?? "";
const [name, setName] = useState(calendar?.name ?? "");
const [description, setDescription] = useState(calendar?.description ?? "");
const [color, setColor] = useState(calendar?.color ?? "");
diff --git a/src/features/Events/EventDisplay.tsx b/src/features/Events/EventDisplay.tsx
index 5bc56ab..0c51855 100644
--- a/src/features/Events/EventDisplay.tsx
+++ b/src/features/Events/EventDisplay.tsx
@@ -74,7 +74,7 @@ export default function EventDisplayModal({
);
const userPersonnalCalendars: Calendars[] = calendars.filter(
- (c) => c.id?.split("/")[0] === user.userData.openpaasId
+ (c) => c.id?.split("/")[0] === user.userData?.openpaasId
);
// Form state
@@ -97,7 +97,7 @@ export default function EventDisplayModal({
const [timezone, setTimezone] = useState(event?.timezone ?? "UTC");
const [newCalId, setNewCalId] = useState(event?.calId);
const [calendarid, setCalendarid] = useState(
- calId.split("/")[0] === user.userData.openpaasId
+ calId.split("/")[0] === user.userData?.openpaasId
? userPersonnalCalendars.findIndex((cal) => cal.id === calId)
: calendars.findIndex((cal) => cal.id === calId)
);
@@ -198,7 +198,7 @@ export default function EventDisplayModal({
};
const calList =
- calId.split("/")[0] === user.userData.openpaasId
+ calId.split("/")[0] === user.userData?.openpaasId
? Object.keys(userPersonnalCalendars).map((calendar, index) => (