|
|
|
@ -1,6 +1,7 @@
|
|
|
|
import _ from 'lodash'
|
|
|
|
import _ from 'lodash'
|
|
|
|
import { render } from 'preact'
|
|
|
|
import { render } from 'preact'
|
|
|
|
import { useEffect, useState } from 'preact/hooks'
|
|
|
|
import { useEffect, useState } from 'preact/hooks'
|
|
|
|
|
|
|
|
import semesterData from './semester-data.json'
|
|
|
|
|
|
|
|
|
|
|
|
// import { ToolOverlay } from './components/ToolOverlay.jsx'
|
|
|
|
// import { ToolOverlay } from './components/ToolOverlay.jsx'
|
|
|
|
//
|
|
|
|
//
|
|
|
|
@ -32,29 +33,7 @@ window._ = _
|
|
|
|
window.dataBuffer = {}
|
|
|
|
window.dataBuffer = {}
|
|
|
|
|
|
|
|
|
|
|
|
// NOTA: magistrale *non* è quello con i corsi a cavallo
|
|
|
|
// NOTA: magistrale *non* è quello con i corsi a cavallo
|
|
|
|
// These IDs will be dynamically updated from the academic data
|
|
|
|
const TIMETABLE_IDS = semesterData.timetableIds
|
|
|
|
let TIMETABLE_IDS = {
|
|
|
|
|
|
|
|
'anno-1': '687e66d62d13e6001edd366d',
|
|
|
|
|
|
|
|
'anno-2': '687e681301ee9300198320e6',
|
|
|
|
|
|
|
|
'anno-3': '687e68bb01ee9300198320eb',
|
|
|
|
|
|
|
|
'magistrale': '687e6a9f96ea080019d439d5',
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Load academic data directly
|
|
|
|
|
|
|
|
async function loadAcademicData() {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
// Use relative path to work with Vite's base URL configuration
|
|
|
|
|
|
|
|
const response = await fetch('./timetable-ids-dates.json')
|
|
|
|
|
|
|
|
if (!response.ok) {
|
|
|
|
|
|
|
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const data = await response.json()
|
|
|
|
|
|
|
|
return data
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
console.error('Failed to load academic data:', error)
|
|
|
|
|
|
|
|
return null
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// const DEFAULT_DATE_RANGE = {
|
|
|
|
// const DEFAULT_DATE_RANGE = {
|
|
|
|
// from: '2023-10-09T00:00:00.000Z',
|
|
|
|
// from: '2023-10-09T00:00:00.000Z',
|
|
|
|
@ -194,20 +173,6 @@ const App = ({}) => {
|
|
|
|
// Use any random string of your choice
|
|
|
|
// Use any random string of your choice
|
|
|
|
// clearOldPersistentStates('e73cba02')
|
|
|
|
// clearOldPersistentStates('e73cba02')
|
|
|
|
|
|
|
|
|
|
|
|
// Academic data loading
|
|
|
|
|
|
|
|
const [academicData, setAcademicData] = useState(null)
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
|
|
loadAcademicData().then(data => {
|
|
|
|
|
|
|
|
if (data) {
|
|
|
|
|
|
|
|
setAcademicData(data)
|
|
|
|
|
|
|
|
if (data.timetableIds) {
|
|
|
|
|
|
|
|
// Update global TIMETABLE_IDS for backward compatibility
|
|
|
|
|
|
|
|
Object.assign(TIMETABLE_IDS, data.timetableIds)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [date, setDate] = useState(new Date().toISOString())
|
|
|
|
const [date, setDate] = useState(new Date().toISOString())
|
|
|
|
|
|
|
|
|
|
|
|
// Data Sources
|
|
|
|
// Data Sources
|
|
|
|
@ -298,13 +263,10 @@ const App = ({}) => {
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
<button
|
|
|
|
<button
|
|
|
|
onClick={() => {
|
|
|
|
onClick={() => {
|
|
|
|
const dateToSet =
|
|
|
|
setDate(semesterData.firstMondayDate)
|
|
|
|
academicData?.firstMondayDate ||
|
|
|
|
|
|
|
|
'2025-09-29T00:00:00.000Z'
|
|
|
|
|
|
|
|
setDate(dateToSet)
|
|
|
|
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{academicData?.buttonText || 'Vai al 29 settembre! 🚀'}
|
|
|
|
{semesterData.buttonText}
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
|
|
{/* <p>
|
|
|
|
{/* <p>
|
|
|
|
|