From c7a49ff4914ed13a57d01a13cbc8b18930dd6788 Mon Sep 17 00:00:00 2001 From: Antonio De Lucreziis Date: Sat, 10 Sep 2022 17:19:19 +0200 Subject: [PATCH] Fixato bug dei giorni della settimana --- src/components/EventsView.jsx | 15 ++++++++++++--- src/main.jsx | 8 +++++--- src/styles/main.scss | 6 +++--- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/components/EventsView.jsx b/src/components/EventsView.jsx index 2329eb3..4f53bb0 100644 --- a/src/components/EventsView.jsx +++ b/src/components/EventsView.jsx @@ -140,11 +140,20 @@ const WorkWeekView = ({ events }) => { const WorkWeekVerticalView = ({ events, selection, setSelection, hideOtherCourses }) => { const selectionSet = new Set(selection) + // const base = { + // 1: [], + // 2: [], + // 3: [], + // 4: [], + // 5: [], + // } + const eventsByWeekday = _.groupBy( !hideOtherCourses ? events : events.filter(e => selectionSet.has(e.name)), event => event.start.getDay() ) + // const dayIntervalLayout = _.mapValues(Object.assign(base, eventsByWeekday), events => const dayIntervalLayout = _.mapValues(eventsByWeekday, events => layoutIntervals( events.map(e => ({ @@ -222,9 +231,9 @@ const WorkWeekVerticalView = ({ events, selection, setSelection, hideOtherCourse - {Object.values(dayIntervalLayout).map((layout, index) => ( -
-
{WEEK_DAYS[index + 1]}
+ {Object.entries(dayIntervalLayout).map(([index, layout]) => ( +
+
{WEEK_DAYS[parseInt(index)]}
{layout.map((events, stackIndex) => ( <> diff --git a/src/main.jsx b/src/main.jsx index 8708c18..645e54d 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -10,8 +10,8 @@ import { Icon } from './components/Icon.jsx' import { Popup } from './components/Popup.jsx' import { Toolbar } from './components/Toolbar.jsx' -// window._ = _ -// window.dataBuffer = {} +window._ = _ +window.dataBuffer = {} const CALENDAR_IDS = { 'anno-1': ['6308cfcb1df5cb026699ce32'], @@ -78,7 +78,9 @@ const App = ({}) => { useEffect(async () => { const eventi = await loadEventi(CALENDAR_IDS[source]) - // window.dataBuffer[source] = eventi + + window.dataBuffer[source] = eventi + setEventi(eventi) }, [source]) diff --git a/src/styles/main.scss b/src/styles/main.scss index 8008cc9..f2a9516 100644 --- a/src/styles/main.scss +++ b/src/styles/main.scss @@ -712,9 +712,9 @@ body { border-bottom: 1px solid var(--gray-500); } - &:not(:last-child) { - border-right: 1px solid var(--gray-500); - } + // &:not(:last-child) { + border-right: 1px solid var(--gray-500); + // } .events { position: relative;