17 Commits
Author SHA1 Message Date
aziis98 0c6f60e461 fix: wrong default 2025-08-27 15:04:57 +02:00
aziis98 e6c5db05a6 feat: first time button sends to all courses tab 2025-08-27 13:06:12 +02:00
BachoSeven d0c2f58094 chore: update calendar IDs for 1st semester 25/26 2025-08-15 20:33:12 +02:00
BachoSeven e9539b7f35 Fix lab1 split courses recognition, add snapping! 2025-02-14 16:39:35 +01:00
aziis98 4c98950822 chore: updated to new semester calendar ids 2025-02-04 10:57:14 +01:00
aziis98 d929aa6cfe chore: updated calendar ids to first semester of 2024/2025 2024-08-06 19:00:20 +02:00
aziis98 4d95a1a633 chore: empty commit to trigger deploy 2024-02-25 17:16:44 +01:00
aziis98 935309147c cmd: prettier -w src/ 2024-02-25 16:43:59 +01:00
aziis98 fb551fb719 fix: safari ios showPicker() bug 2024-02-25 16:42:10 +01:00
BachoSeven c731d9c8b9 Merge pull request 'chore: fix LIMCO courses' names' (#13) from dev into main
continuous-integration/drone/push Build is passing
Reviewed-on: #13
2024-02-04 15:35:53 +00:00
BachoSeven d9d2aaed11 chore: fix LIMCO courses' names 2024-02-04 16:35:20 +01:00
BachoSeven 7bbd9ba139 Merge pull request 'chore: update calendar IDs for the 2nd semester' (#12) from dev into main
continuous-integration/drone/push Build is passing
Reviewed-on: #12
2024-02-04 15:00:00 +00:00
BachoSeven 62a9b80b21 chore: update calendar IDs for the 2nd semester 2024-02-04 15:59:07 +01:00
Fran314 c43bdc60e7 Merge pull request 'dev' (#11) from dev into main
continuous-integration/drone/push Build is passing
Reviewed-on: #11
2023-10-09 13:30:58 +00:00
aziis98 bdbf031bce Merge pull request 'fix: rimosso un console.log' (#8) from dev into main
continuous-integration/drone/push Build is passing
Reviewed-on: #8
2023-10-08 11:12:04 +00:00
Fran314 2d4a3ce664 Merge pull request 'reintrodotta visualizzazione lista rimossa nel commit precedente' (#7) from dev into main
continuous-integration/drone/push Build is passing
Reviewed-on: #7
2023-10-07 21:05:33 +00:00
Fran314 22ce830c80 Merge pull request 'dev' (#6) from dev into main
continuous-integration/drone/push Build is passing
Reviewed-on: #6
2023-10-07 18:56:33 +00:00
14 changed files with 110 additions and 214 deletions
+9
View File
@@ -0,0 +1,9 @@
{
"printWidth": 90,
"singleQuote": true,
"quoteProps": "consistent",
"tabWidth": 4,
"semi": false,
"arrowParens": "avoid",
"proseWrap": "always"
}
Executable
BIN
View File
Binary file not shown.
-40
View File
@@ -1,40 +0,0 @@
[
"ALGEBRA 1",
"ANALISI ARMONICA - ANALISI ARMONICA/a",
"ANALISI MATEMATICA 1",
"ANALISI MATEMATICA 2",
"ANALISI MATEMATICA 3",
"ANALISI NUMERICA CON LABORATORIO - ANALISI NUMERICA",
"ARITMETICA",
"ASPETTI MATEMATICI NELLA COMPUTAZIONE QUANTISTICA",
"CALCOLO SCIENTIFICO",
"COMBINATORIA ALGEBRICA",
"DETERMINAZIONE ORBITALE",
"DINAMICA DEL SISTEMA SOLARE",
"ELEMENTI DI GEOMETRIA ALGEBRICA",
"ELEMENTI DI TOPOLOGIA ALGEBRICA",
"FISICA II",
"FONDAMENTI DI PROGRAMMAZIONE CON LABORATORIO - FONDAMENTI DI PROGRAMMAZIONE ",
"GEOMETRIA 1",
"GEOMETRIA 2 - GEOMETRIA 2 A",
"GEOMETRIA E TOPOLOGIA DIFFERENZIALE",
"INGLESE SCIENTIFICO",
"ISTITUZIONI DI ALGEBRA",
"ISTITUZIONI DI ANALISI MATEMATICA",
"ISTITUZIONI DI DIDATTICA DELLA MATEMATICA",
"ISTITUZIONI DI FISICA MATEMATICA",
"LABORATORIO COMPUTAZIONALE",
"LABORATORIO DI INTRODUZIONE ALLA MATEMATICA COMPUTAZIONALE",
"LOGICA MATEMATICA",
"MECCANICA SUPERIORE - MECCANICA SUPERIORE/a",
"METODI NUMERICI PER CATENE DI MARKOV - METODI NUMERICI PER CATENE DI MARKOV/a",
"METODI NUMERICI PER LA GRAFICA - METODI NUMERICI PER LA GRAFICA/a",
"PROBABILITÀ",
"RICERCA OPERATIVA",
"SISTEMI DINAMICI",
"STORIA DELLA MATEMATICA",
"TECNOLOGIE PER LA DIDATTICA",
"TEORIA ANALITICA DEI NUMERI A - TEORIA ANALITICA DEI NUMERI A/a",
"TEORIA E METODI DELL'OTTIMIZZAZIONE",
"TOPOLOGIA DIFFERENZIALE - TOPOLOGIA DIFFERENZIALE/a"
]
+8 -1
View File
@@ -1,12 +1,19 @@
import { useRef } from 'preact/hooks' import { useRef } from 'preact/hooks'
import { Icon } from './Icon.jsx' import { Icon } from './Icon.jsx'
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)
export const DatePicker = ({ date, setDate }) => { export const DatePicker = ({ date, setDate }) => {
const input = useRef() const input = useRef()
const [year, month, day] = date.split('T')[0].split('-') const [year, month, day] = date.split('T')[0].split('-')
return ( return (
<div class="date-picker" onClick={() => input.current.showPicker()}> <div
class="date-picker"
onClick={() =>
isSafari ? input.current.focus() : input.current.showPicker()
}
>
<input <input
ref={input} ref={input}
type="date" type="date"
-1
View File
@@ -24,7 +24,6 @@ const viewModeMap = {
export const EventsView = ({ mode, source, ...viewProps }) => { export const EventsView = ({ mode, source, ...viewProps }) => {
// const Mode = viewModeMap[mode] // const Mode = viewModeMap[mode]
if (source === 'orario') { if (source === 'orario') {
return ( return (
+13 -15
View File
@@ -4,33 +4,31 @@ export const Help = ({}) => (
<> <>
<h3>Visualizzazione Corsi</h3> <h3>Visualizzazione Corsi</h3>
<p> <p>
Per visualizzare i corsi che ti interessano nella tabella Per visualizzare i corsi che ti interessano nella tabella dell'orario, devi
dell'orario, devi prima selezionarli. Puoi selezionare dei corsi prima selezionarli. Puoi selezionare dei corsi cliccandoli, cercandoli nelle
cliccandoli, cercandoli nelle sezioni Primo anno (<b>I</b>), Secondo sezioni Primo anno (<b>I</b>), Secondo anno (<b>II</b>), Terzo anno (
anno (<b>II</b>), Terzo anno (<b>III</b>), Magistrale (<b>M</b>), o <b>III</b>), Magistrale (<b>M</b>), o Tutti.
Tutti.
</p> </p>
<p> <p>
Una volta compiuta la selezione, è possibile vedere la tabella delle Una volta compiuta la selezione, è possibile vedere la tabella delle lezioni
lezioni andando nella visualizzazione Orario ( andando nella visualizzazione Orario (
<Icon name="calendar_view_month" />) <Icon name="calendar_view_month" />)
</p> </p>
<p> <p>
Per via di eventuali preferenze personali, è possibile cambiare Per via di eventuali preferenze personali, è possibile cambiare l'orientazione
l'orientazione della tabella Orario trasponendola, utilizzando il della tabella Orario trasponendola, utilizzando il pulsante Trasponi (
pulsante Trasponi (
<Icon name="switch_left" style="transform: rotate(-45deg)" />) <Icon name="switch_left" style="transform: rotate(-45deg)" />)
</p> </p>
<p> <p>
È anche possibile visualizzare in uno specchietto riassuntivo È anche possibile visualizzare in uno specchietto riassuntivo soltanto i corsi
soltanto i corsi selezionati, andando nella visualizzazione Lista ( selezionati, andando nella visualizzazione Lista (
<Icon name="list" />) <Icon name="list" />)
</p> </p>
<h3>Stampa</h3> <h3>Stampa</h3>
<p> <p>
Da desktop puoi stampare l'orario attualmente visibile con il Da desktop puoi stampare l'orario attualmente visibile con il bottone{' '}
bottone <Icon name="print" /> (è consigliato controllare le opzioni <Icon name="print" /> (è consigliato controllare le opzioni di stampa per
di stampa per ottenere un risultato soddisfacente). ottenere un risultato soddisfacente).
</p> </p>
<h3>Bug &amp; Contatti</h3> <h3>Bug &amp; Contatti</h3>
<p> <p>
+2 -6
View File
@@ -7,13 +7,9 @@ export const SettingsBar = ({ theme, setTheme, date, setDate }) => {
<div class="settings-group"> <div class="settings-group">
<button <button
class="icon" class="icon"
onClick={() => onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
setTheme(theme === 'dark' ? 'light' : 'dark')
}
> >
<Icon <Icon name={theme === 'dark' ? 'dark_mode' : 'light_mode'} />
name={theme === 'dark' ? 'dark_mode' : 'light_mode'}
/>
</button> </button>
<DatePicker date={date} setDate={setDate} /> <DatePicker date={date} setDate={setDate} />
</div> </div>
+3 -8
View File
@@ -24,8 +24,7 @@ export const Toolbar = ({
</button> </button>
</div> </div>
<div class="item logo"> <div class="item logo">
<img src="logo-circuit-board.svg" alt="logo" /> /{' '} <img src="logo-circuit-board.svg" alt="logo" /> / <span>Orario</span>
<span>Orario</span>
</div> </div>
<div class="option-group"> <div class="option-group">
<div class="item option"> <div class="item option">
@@ -64,13 +63,9 @@ export const Toolbar = ({
<div class="item option"> <div class="item option">
<button <button
class="icon" class="icon"
onClick={() => onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
setTheme(theme === 'dark' ? 'light' : 'dark')
}
> >
<Icon <Icon name={theme === 'dark' ? 'dark_mode' : 'light_mode'} />
name={theme === 'dark' ? 'dark_mode' : 'light_mode'}
/>
</button> </button>
</div> </div>
<div class="item option"> <div class="item option">
+5 -14
View File
@@ -72,27 +72,18 @@ export const Courses = ({
} }
data-course-id={id} data-course-id={id}
onClick={() => { onClick={() => {
if (!selectionSet.has(id)) if (!selectionSet.has(id)) setSelection([...selection, id])
setSelection([...selection, id]) else setSelection(selection.filter(selId => selId !== id))
else
setSelection(
selection.filter(selId => selId !== id)
)
}} }}
> >
<div class="title"> <div class="title">{prettyCourseName(courseEvents[0].name)}</div>
{prettyCourseName(courseEvents[0].name)} <div class="docenti">{profsPerCourse[id].join(', ')}</div>
</div>
<div class="docenti">
{profsPerCourse[id].join(', ')}
</div>
<div class="events"> <div class="events">
{courseEvents.map(course => ( {courseEvents.map(course => (
<div> <div>
{WEEK_DAYS[course.start.getDay()]}{' '} {WEEK_DAYS[course.start.getDay()]}{' '}
{format(course.start, 'H:mm')}&ndash; {format(course.start, 'H:mm')}&ndash;
{format(course.end, 'H:mm')}{' '} {format(course.end, 'H:mm')} {course.aule.join(', ')}
{course.aule.join(', ')}
</div> </div>
))} ))}
</div> </div>
+18 -46
View File
@@ -3,11 +3,7 @@ import { useEffect, useRef, useState } from 'preact/hooks'
import _ from 'lodash' import _ from 'lodash'
import { differenceInMinutes, startOfDay } from 'date-fns' import { differenceInMinutes, startOfDay } from 'date-fns'
import { import { WEEK_DAYS_SHORT, prettyCourseName, usePersistentState } from '../../utils.jsx'
WEEK_DAYS_SHORT,
prettyCourseName,
usePersistentState,
} from '../../utils.jsx'
import { layoutEvents, layoutIntervals } from '../../interval-layout.js' import { layoutEvents, layoutIntervals } from '../../interval-layout.js'
import { Popup } from '../Popup.jsx' import { Popup } from '../Popup.jsx'
import { Icon } from '../Icon.jsx' import { Icon } from '../Icon.jsx'
@@ -17,28 +13,23 @@ const TransposePopup = ({ onClose }) => {
<Popup <Popup
title={ title={
<> <>
<Icon name="info" /> Attenzione! La tabella è stata <Icon name="info" /> Attenzione! La tabella è stata trasposta!
trasposta!
</> </>
} }
onClose={onClose} onClose={onClose}
> >
<p>A grande richiesta popolare abbiamo trasposto la tabella dell'orario!</p>
<p> <p>
A grande richiesta popolare abbiamo trasposto la tabella Assicurati quindi di leggerla correttamente (dall'alto verso il basso
dell'orario! invece che da sinistra verso destra).
</p> </p>
<p> <p>
Assicurati quindi di leggerla correttamente (dall'alto verso il Se preferisci utilizzare la versione vecchia, puoi utilizzare il pulsante
basso invece che da sinistra verso destra). Trasponi <Icon name="switch_left" style="transform: rotate(-45deg)" />{' '}
</p> nell'origine della tabella per trasporla. Questa scelta verrà salvata nei
cookie e verrà ricordata in futuro
<p>
Se preferisci utilizzare la versione vecchia, puoi utilizzare il
pulsante Trasponi{' '}
<Icon name="switch_left" style="transform: rotate(-45deg)" />{' '}
nell'origine della tabella per trasporla. Questa scelta verrà
salvata nei cookie e verrà ricordata in futuro
</p> </p>
</Popup> </Popup>
) )
@@ -49,8 +40,8 @@ const NoCourseWarning = () => {
<div class="warning"> <div class="warning">
<p>Non hai ancora selezionato nessun corso.</p> <p>Non hai ancora selezionato nessun corso.</p>
<p> <p>
Clicca sui corsi nelle altre visuali per selezionarli e Clicca sui corsi nelle altre visuali per selezionarli e visualizzarli
visualizzarli nell'orario nell'orario
</p> </p>
</div> </div>
) )
@@ -75,13 +66,10 @@ const Layout = ({ layout, day, colors }) => {
style={{ style={{
'--block-size': block.end - block.start, '--block-size': block.end - block.start,
'--size': event.end - event.start, '--size': event.end - event.start,
'--relative-start': '--relative-start': event.start - block.start,
event.start - block.start,
'--index': event.index, '--index': event.index,
'--of': block.layers, '--of': block.layers,
'--color': `var(--event-${ '--color': `var(--event-${colors[event.id]})`,
colors[event.id]
})`,
}} }}
> >
<div class="event"> <div class="event">
@@ -118,16 +106,11 @@ const ScheduleGrid = ({
class="small" class="small"
onClick={() => onClick={() =>
setOrientation( setOrientation(
orientation === 'original' orientation === 'original' ? 'transposed' : 'original'
? 'transposed'
: 'original'
) )
} }
> >
<Icon <Icon name="switch_left" style="transform: rotate(-45deg)" />
name="switch_left"
style="transform: rotate(-45deg)"
/>
</button> </button>
</div> </div>
{[1, 2, 3, 4, 5].map(n => ( {[1, 2, 3, 4, 5].map(n => (
@@ -215,20 +198,9 @@ export const Schedule = ({ timetables, selection }) => {
'transpose_info', 'transpose_info',
'false' 'false'
) )
const [orientation, setOrientation] = usePersistentState( const [orientation, setOrientation] = usePersistentState('orientation', 'original')
'orientation',
'original'
)
const colorList = [ const colorList = ['red', 'purple', 'blue', 'yellow', 'green', 'orange', 'lightblue']
'red',
'purple',
'blue',
'yellow',
'green',
'orange',
'lightblue',
]
const allEvents = timetables['tutti'] const allEvents = timetables['tutti']
const selectionSet = new Set(selection) const selectionSet = new Set(selection)
+3 -10
View File
@@ -42,10 +42,7 @@ function layoutBlockEvents(events) {
let viableIndex = 0 let viableIndex = 0
while ( while (
result.filter( result.filter(
e => e => e.index === viableIndex && e.start < event.end && event.start < e.end
e.index === viableIndex &&
e.start < event.end &&
event.start < e.end
).length !== 0 ).length !== 0
) { ) {
viableIndex += 1 viableIndex += 1
@@ -57,8 +54,7 @@ function layoutBlockEvents(events) {
return result return result
} }
export function layoutEvents(events) { export function layoutEvents(events) {
const overlap = (event, block) => const overlap = (event, block) => event.start < block.end && block.start < event.end
event.start < block.end && block.start < event.end
events.sort((a, b) => a.start - b.start) events.sort((a, b) => a.start - b.start)
@@ -68,10 +64,7 @@ export function layoutEvents(events) {
if (blocks.length > 0) { if (blocks.length > 0) {
layout = layout.filter(block => !overlap(event, block)) layout = layout.filter(block => !overlap(event, block))
layout.push({ layout.push({
start: Math.min( start: Math.min(event.start, ...blocks.map(block => block.start)),
event.start,
...blocks.map(block => block.start)
),
end: Math.max(event.end, ...blocks.map(block => block.end)), end: Math.max(event.end, ...blocks.map(block => block.end)),
events: blocks.flatMap(block => block.events).concat([event]), events: blocks.flatMap(block => block.events).concat([event]),
}) })
+36 -29
View File
@@ -24,17 +24,19 @@ import {
clearOldPersistentStates, clearOldPersistentStates,
usePersistentState, usePersistentState,
} from './utils.jsx' } from './utils.jsx'
import { SettingsBar } from './components/SettingsBar.jsx' import { SettingsBar } from './components/SettingsBar.jsx'
// Che fanno queste due righe? // Che fanno queste due righe?
window._ = _ window._ = _
window.dataBuffer = {} window.dataBuffer = {}
// NOTA: magistrale *non* è quello con i corsi a cavallo
const TIMETABLE_IDS = { const TIMETABLE_IDS = {
'anno-1': '64a7c1c651f079001d52e9c8', 'anno-1': '687e66d62d13e6001edd366d',
'anno-2': '6308e2dc09352a0208fefdd9', 'anno-2': '687e681301ee9300198320e6',
'anno-3': '6308e42a1df5cb026699ced4', 'anno-3': '687e68bb01ee9300198320eb',
'magistrale': '64a7c7091ab813002c5d9ede', 'magistrale': '687e6a9f96ea080019d439d5',
} }
// const DEFAULT_DATE_RANGE = { // const DEFAULT_DATE_RANGE = {
@@ -50,15 +52,17 @@ const TIMETABLE_IDS = {
// } // }
function specialEventPatches(eventi) { function specialEventPatches(eventi) {
// Il laboratorio del primo anno in realtà è in due canali separati // Il laboratorio del primo anno in realtà è in due gruppi separati
let i = 1
eventi.forEach(evento => { eventi.forEach(evento => {
if ( if (
evento.nome === evento.nome === 'LABORATORIO DI INTRODUZIONE ALLA MATEMATICA COMPUTAZIONALE'
'LABORATORIO DI INTRODUZIONE ALLA MATEMATICA COMPUTAZIONALE'
) { ) {
evento.nome += ` (${i})` if (evento.evento.dettagliDidattici[0].partizione.descrizione === 'CORSO A') {
i++ evento.nome += ' (A)'
}
if (evento.evento.dettagliDidattici[0].partizione.descrizione === 'CORSO B') {
evento.nome += ' (B)'
}
} }
}) })
@@ -72,9 +76,7 @@ function formatEvents(timetable) {
name: _.split(nome, '-', 1)[0].trim(), name: _.split(nome, '-', 1)[0].trim(),
start: new Date(dataInizio), start: new Date(dataInizio),
end: new Date(dataFine), end: new Date(dataFine),
docenti: docenti.map(({ nome, cognome }) => docenti: docenti.map(({ nome, cognome }) => prettyProfName(nome, cognome)),
prettyProfName(nome, cognome)
),
aule: aule.map(aula => prettyAulaName(aula.codice)), aule: aule.map(aula => prettyAulaName(aula.codice)),
} }
}) })
@@ -131,7 +133,7 @@ async function loadCalendari(date) {
const timetablesRaw = results.map(timetable => const timetablesRaw = results.map(timetable =>
specialEventPatches(_.uniqBy(timetable, 'id')) specialEventPatches(_.uniqBy(timetable, 'id'))
) )
const allRaw = specialEventPatches(_.uniqBy(_.concat(...results), 'id')) const allRaw = specialEventPatches(_.concat(...results), 'id')
return { return {
'anno-1': formatEvents(timetablesRaw[0]), 'anno-1': formatEvents(timetablesRaw[0]),
@@ -178,7 +180,7 @@ const App = ({}) => {
const [date, setDate] = useState(new Date().toISOString()) const [date, setDate] = useState(new Date().toISOString())
// Data Sources // Data Sources
const [view, setView] = usePersistentState('view', 'magistrale') const [view, setView] = usePersistentState('view', 'tutti')
const [timetables, setTimetables] = useState(null) const [timetables, setTimetables] = useState(null)
useEffect(async () => { useEffect(async () => {
setTimetables(await loadCalendari(new Date(date))) setTimetables(await loadCalendari(new Date(date)))
@@ -188,18 +190,12 @@ const App = ({}) => {
// const [mode, setMode] = usePersistentState('orario.mode', MODE_COURSES) // const [mode, setMode] = usePersistentState('orario.mode', MODE_COURSES)
// Selection // Selection
const [selectedCourses, setSelectedCourses] = usePersistentState( const [selectedCourses, setSelectedCourses] = usePersistentState('selection', [])
'selection',
[]
)
// Menus // Menus
const [helpVisible, setHelpVisible] = useState(false) const [helpVisible, setHelpVisible] = useState(false)
const [showMobileMenu, setShowMobileMenu] = useState(false) const [showMobileMenu, setShowMobileMenu] = useState(false)
// const groupIds = new Set(eventi.map(e => e.nome))
const toolOverlayVisible = selectedCourses.length > 0
const [theme, setTheme] = usePersistentState( const [theme, setTheme] = usePersistentState(
'theme', 'theme',
'light' 'light'
@@ -262,18 +258,29 @@ const App = ({}) => {
) : timetables['tutti'].length === 0 ? ( ) : timetables['tutti'].length === 0 ? (
<div class="warning"> <div class="warning">
<p> <p>
Non esistono corsi per la settimana selezionata: Non esistono corsi per la settimana selezionata: buone
buone vacanze! 🎉 vacanze! 🎉
</p> </p>
<p> <p>
Per cambiare settimana puoi usare il widget Clicca sul bottone qua sotto per vedere la prima settimana
Calendario ( completa di lezioni:
</p>
<button
onClick={() => {
setDate('2025-09-29T00:00:00.000Z')
}}
>
Vai al 29 settembre! 🚀
</button>
{/* <p>
Per cambiare settimana puoi usare il widget Calendario (
<Icon name="calendar_month" />) in alto a destra <Icon name="calendar_month" />) in alto a destra
<br /> <br />
In versione mobile, il widget Calendario è In versione mobile, il widget Calendario è situato dentro
situato dentro il Menu ( il Menu (
<Icon name="menu" />) <Icon name="menu" />)
</p> </p> */}
</div> </div>
) : ( ) : (
<View <View
+8 -26
View File
@@ -644,8 +644,7 @@ body {
border: 1px solid var(--border-600); border: 1px solid var(--border-600);
border-radius: 10px 10px 0 0; border-radius: 10px 10px 0 0;
@media screen and (max-width: $device-s-width), @media screen and (max-width: $device-s-width), (pointer: coarse) {
(pointer: coarse) {
font-size: 12px; font-size: 12px;
} }
@@ -700,10 +699,7 @@ body {
&.original { &.original {
grid-template-columns: auto repeat(5, 1fr); grid-template-columns: auto repeat(5, 1fr);
grid-template-rows: min-content repeat( grid-template-rows: min-content repeat(var(--time-slots), 1fr);
var(--time-slots),
1fr
);
.transpose-button, .transpose-button,
.day-label { .day-label {
@@ -730,22 +726,16 @@ body {
} }
.event-block-wrapper { .event-block-wrapper {
grid-row: calc(var(--time-start) + 2) / grid-row: calc(var(--time-start) + 2) / calc(var(--time-end) + 2);
calc(var(--time-end) + 2);
grid-column: calc(var(--day-position) + 1); grid-column: calc(var(--day-position) + 1);
.event-block { .event-block {
.event-wrapper { .event-wrapper {
width: calc(100% / var(--of)); width: calc(100% / var(--of));
height: calc( height: calc(100% * var(--size) / var(--block-size));
100% * var(--size) / var(--block-size)
);
transform: translateX(calc(100% * var(--index))) transform: translateX(calc(100% * var(--index)))
translateY( translateY(
calc( calc(100% * var(--relative-start) / var(--size))
100% * var(--relative-start) /
var(--size)
)
); );
} }
} }
@@ -753,10 +743,7 @@ body {
} }
&.transposed { &.transposed {
grid-template-rows: auto repeat(5, 1fr); grid-template-rows: auto repeat(5, 1fr);
grid-template-columns: min-content repeat( grid-template-columns: min-content repeat(var(--time-slots), 1fr);
var(--time-slots),
1fr
);
.transpose-button, .transpose-button,
.day-label { .day-label {
@@ -792,15 +779,10 @@ body {
.event-block { .event-block {
.event-wrapper { .event-wrapper {
height: calc(100% / var(--of)); height: calc(100% / var(--of));
width: calc( width: calc(100% * var(--size) / var(--block-size));
100% * var(--size) / var(--block-size)
);
transform: translateY(calc(100% * var(--index))) transform: translateY(calc(100% * var(--index)))
translateX( translateX(
calc( calc(100% * var(--relative-start) / var(--size))
100% * var(--relative-start) /
var(--size)
)
); );
} }
} }
+5 -18
View File
@@ -12,15 +12,7 @@ export const WEEK_DAYS = [
'Sabato', 'Sabato',
] ]
export const WEEK_DAYS_SHORT = [ export const WEEK_DAYS_SHORT = ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab']
'Dom',
'Lun',
'Mar',
'Mer',
'Gio',
'Ven',
'Sab'
]
// Hashing // Hashing
@@ -32,12 +24,8 @@ export function hashString(str, seed = 0) {
h1 = Math.imul(h1 ^ ch, 2654435761) h1 = Math.imul(h1 ^ ch, 2654435761)
h2 = Math.imul(h2 ^ ch, 1597334677) h2 = Math.imul(h2 ^ ch, 1597334677)
} }
h1 = h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909)
Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909)
Math.imul(h2 ^ (h2 >>> 13), 3266489909)
h2 =
Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^
Math.imul(h1 ^ (h1 >>> 13), 3266489909)
return 4294967296 * (2097151 & h2) + (h1 >>> 0) return 4294967296 * (2097151 & h2) + (h1 >>> 0)
} }
@@ -50,9 +38,7 @@ export function prettyCourseName(name) {
.map(word => { .map(word => {
if (word.trim().length === 0) return word if (word.trim().length === 0) return word
return /(^del|^nel|^di$|^dei$|^con$|^alla$|^per$|^e$|^la$)/.test( return /(^del|^nel|^di$|^dei$|^con$|^alla$|^per$|^e$|^la$)/.test(word)
word
)
? word ? word
: word[0].toUpperCase() + word.slice(1) : word[0].toUpperCase() + word.slice(1)
}) })
@@ -61,6 +47,7 @@ export function prettyCourseName(name) {
.replaceAll('IIi', 'III') .replaceAll('IIi', 'III')
.replaceAll('Iii', 'III') .replaceAll('Iii', 'III')
.replaceAll(/'(.)/g, ({}, letter) => "'" + letter.toUpperCase()) .replaceAll(/'(.)/g, ({}, letter) => "'" + letter.toUpperCase())
.replaceAll(/\((a|b)\)/g, ({}, letter) => '(' + letter.toUpperCase() + ')')
} }
export function prettyAulaName(name) { export function prettyAulaName(name) {