|
|
@ -3,12 +3,13 @@
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
import { differenceInMinutes, format, startOfDay } from 'date-fns'
|
|
|
|
import { differenceInMinutes, format, startOfDay } from 'date-fns'
|
|
|
|
import { it } from 'date-fns/locale'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import _ from 'lodash'
|
|
|
|
import _ from 'lodash'
|
|
|
|
import { useEffect, useRef, useState } from 'preact/hooks'
|
|
|
|
import { useEffect, useRef, useState } from 'preact/hooks'
|
|
|
|
import { layoutIntervals } from '../interval-layout.js'
|
|
|
|
import { layoutIntervals } from '../interval-layout.js'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const WEEK_DAYS = ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato']
|
|
|
|
|
|
|
|
|
|
|
|
function hashString(str, seed = 0) {
|
|
|
|
function hashString(str, seed = 0) {
|
|
|
|
let h1 = 0xdeadbeef ^ seed,
|
|
|
|
let h1 = 0xdeadbeef ^ seed,
|
|
|
|
h2 = 0x41c6ce57 ^ seed
|
|
|
|
h2 = 0x41c6ce57 ^ seed
|
|
|
@ -53,12 +54,10 @@ const WorkWeekView = ({ events }) => {
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const weekDays = ['Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div class="work-week-h-view">
|
|
|
|
<div class="work-week-h-view">
|
|
|
|
<div class="week">
|
|
|
|
<div class="week">
|
|
|
|
{weekDays.map((label, index) => (
|
|
|
|
{WEEK_DAYS.slice(1, 6).map((label, index) => (
|
|
|
|
<div class="day" style={{ '--size': rowLayouts[index + 1]?.length ?? 0 }}>
|
|
|
|
<div class="day" style={{ '--size': rowLayouts[index + 1]?.length ?? 0 }}>
|
|
|
|
{label}
|
|
|
|
{label}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -156,8 +155,6 @@ const WorkWeekVerticalView = ({ events, selection, setSelection, hideOtherCourse
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const weekDays = ['Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [currentlyHovered, setCurrentlyHovered] = useState(null)
|
|
|
|
const [currentlyHovered, setCurrentlyHovered] = useState(null)
|
|
|
|
const element = useRef()
|
|
|
|
const element = useRef()
|
|
|
|
|
|
|
|
|
|
|
@ -227,7 +224,7 @@ const WorkWeekVerticalView = ({ events, selection, setSelection, hideOtherCourse
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{Object.values(dayIntervalLayout).map((layout, index) => (
|
|
|
|
{Object.values(dayIntervalLayout).map((layout, index) => (
|
|
|
|
<div class="day" style={{ '--size': layout.length }}>
|
|
|
|
<div class="day" style={{ '--size': layout.length }}>
|
|
|
|
<div class="top-header">{weekDays[index]}</div>
|
|
|
|
<div class="top-header">{WEEK_DAYS[index + 1]}</div>
|
|
|
|
<div class="events">
|
|
|
|
<div class="events">
|
|
|
|
{layout.map((events, stackIndex) => (
|
|
|
|
{layout.map((events, stackIndex) => (
|
|
|
|
<>
|
|
|
|
<>
|
|
|
@ -336,7 +333,7 @@ const CourseView = ({ events, selection, setSelection, hideOtherCourses }) => {
|
|
|
|
<div class="events">
|
|
|
|
<div class="events">
|
|
|
|
{courseEvents.map(course => (
|
|
|
|
{courseEvents.map(course => (
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
{_.capitalize(format(course.start, 'EEEE', { locale: it }))}{' '}
|
|
|
|
{WEEK_DAYS[course.start.getDay()]}{' '}
|
|
|
|
{format(course.start, 'H:mm')} –
|
|
|
|
{format(course.start, 'H:mm')} –
|
|
|
|
{format(course.end, 'H:mm')} {course.aula}
|
|
|
|
{format(course.end, 'H:mm')} {course.aula}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|