|
|
@ -3,7 +3,7 @@ import { render } from 'preact'
|
|
|
|
import { useEffect, useState } from 'preact/hooks'
|
|
|
|
import { useEffect, useState } from 'preact/hooks'
|
|
|
|
import { ToolOverlay } from './components/CourseVisibility.jsx'
|
|
|
|
import { ToolOverlay } from './components/CourseVisibility.jsx'
|
|
|
|
|
|
|
|
|
|
|
|
import { EventsView, MODE_WORKWEEK_GRID } from './components/EventsView.jsx'
|
|
|
|
import { EventsView, MODE_COURSE, MODE_WORKWEEK_GRID } from './components/EventsView.jsx'
|
|
|
|
import { HamburgerMenu } from './components/HamburgerMenu.jsx'
|
|
|
|
import { HamburgerMenu } from './components/HamburgerMenu.jsx'
|
|
|
|
import { Help } from './components/Help.jsx'
|
|
|
|
import { Help } from './components/Help.jsx'
|
|
|
|
import { Icon } from './components/Icon.jsx'
|
|
|
|
import { Icon } from './components/Icon.jsx'
|
|
|
@ -58,8 +58,6 @@ async function loadEventi(ids) {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// console.log(calendari)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ids.length === 1) {
|
|
|
|
if (ids.length === 1) {
|
|
|
|
return calendari[0]
|
|
|
|
return calendari[0]
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -69,11 +67,11 @@ async function loadEventi(ids) {
|
|
|
|
|
|
|
|
|
|
|
|
const App = ({}) => {
|
|
|
|
const App = ({}) => {
|
|
|
|
// Data Sources
|
|
|
|
// Data Sources
|
|
|
|
const [source, setSource] = useState('anno-1')
|
|
|
|
const [source, setSource] = useState('magistrale')
|
|
|
|
const [eventi, setEventi] = useState([])
|
|
|
|
const [eventi, setEventi] = useState([])
|
|
|
|
|
|
|
|
|
|
|
|
// View Modes
|
|
|
|
// View Modes
|
|
|
|
const [mode, setMode] = useState(MODE_WORKWEEK_GRID)
|
|
|
|
const [mode, setMode] = useState(MODE_COURSE)
|
|
|
|
|
|
|
|
|
|
|
|
// Selection
|
|
|
|
// Selection
|
|
|
|
const [selectedCourses, setSelectedCourses] = useState([])
|
|
|
|
const [selectedCourses, setSelectedCourses] = useState([])
|
|
|
@ -84,7 +82,6 @@ const App = ({}) => {
|
|
|
|
const [showMobileMenu, setShowMobileMenu] = useState(false)
|
|
|
|
const [showMobileMenu, setShowMobileMenu] = useState(false)
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(async () => {
|
|
|
|
useEffect(async () => {
|
|
|
|
console.log('source changed')
|
|
|
|
|
|
|
|
const eventi = await loadEventi(CALENDAR_IDS[source])
|
|
|
|
const eventi = await loadEventi(CALENDAR_IDS[source])
|
|
|
|
|
|
|
|
|
|
|
|
window.dataBuffer[source] = eventi
|
|
|
|
window.dataBuffer[source] = eventi
|
|
|
@ -97,7 +94,6 @@ const App = ({}) => {
|
|
|
|
selectedCourses.length > 0 && selectedCourses.filter(id => groupIds.has(id)).length > 0
|
|
|
|
selectedCourses.length > 0 && selectedCourses.filter(id => groupIds.has(id)).length > 0
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
console.log('course length changed')
|
|
|
|
|
|
|
|
const groupIds = new Set(eventi.map(e => e.nome))
|
|
|
|
const groupIds = new Set(eventi.map(e => e.nome))
|
|
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
if (
|
|
|
|