Fixed some bugs

pull/1/head
Antonio De Lucreziis 2 years ago
parent 7736ab5533
commit 6d490df016

@ -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')} &ndash; {format(course.start, 'H:mm')} &ndash;
{format(course.end, 'H:mm')} {course.aula} {format(course.end, 'H:mm')} {course.aula}
</div> </div>

@ -38,7 +38,7 @@ html {
--accent-900: #244624; --accent-900: #244624;
} }
$device-s-width: 420px; $device-s-width: 500px;
// Elements // Elements
@ -761,6 +761,7 @@ body {
align-self: center; align-self: center;
position: relative; position: relative;
top: 0.5px;
left: -0.5rem; left: -0.5rem;
width: calc(100% + 1rem); width: calc(100% + 1rem);

Loading…
Cancel
Save