Ajoute le support des statuts d'évènements

This commit is contained in:
Tom Hubrecht 2022-03-12 16:39:58 +01:00
parent 0673b3e455
commit 22f055decc
3 changed files with 36 additions and 11 deletions

View file

@ -23,6 +23,11 @@
const toggle = () => (openModal = !openModal);
const mobile = window.innerWidth < 765;
const now = new Date();
const scrollTo = (() => {
const time = new Date();
time.setHours(Math.max(0, time.getHours() - 2));
return time.toLocaleTimeString();
})();
let calendar;
@ -49,7 +54,7 @@
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
nowIndicator: true,
now: now,
scrollTime: now.toLocaleTimeString(),
scrollTime: scrollTo,
eventClick: info => {
openModal = true;
event.set(info.event);
@ -82,17 +87,19 @@
<FilterBar {calendarTree} bind:selected={selectedCalendars} />
<div class="h-100 d-flex">
<div class="flex-grow-1">
<FullCalendar bind:this={calendar} options={$options} />
</div>
</div>
<FullCalendar bind:this={calendar} options={$options} />
<EventModal event={$event} open={openModal} {toggle} />
</div>
<div class="fc-toolbar-title" />
<style>
:global(.st-tentative) {
opacity: 40%;
}
:global(.st-cancelled) {
background: repeating-linear-gradient(45deg, #333, #333 10px, #950 10px, #950 20px);
}
:global(.modal-open) {
padding-right: 8px !important;
}
@ -101,7 +108,7 @@
cursor: pointer;
}
:global(.modal-body p, ul) {
:global(.modal-body p:last-child, ul:last-child) {
margin-bottom: 0 !important;
}

View file

@ -25,6 +25,18 @@
<b>{event.extendedProps.short_name}</b>
</ModalHeader>
<ModalBody>
{#if event.extendedProps.status === 'CANCELLED'}
<p class="w-100 text-center text-danger">
<Icon name="exclamation-triangle" />
<b class="ms-1">Évènement annulé</b>
</p>
{:else if event.extendedProps.status == 'TENTATIVE'}
<p class="w-100 text-primary text-center">
<Icon name="info-circle" />
<b class="ms-1">Évènement provisoire</b>
</p>
{/if}
{#if event.extendedProps.description}
{@html md.render(event.extendedProps.description)}
{:else}

View file

@ -8,7 +8,7 @@ const calendars = {
cloud: clouds.KLUB_RESEAU,
name: 'Club réseau',
color: null,
default_location: "Cave d'hackENS",
default_location: "Cave d'hackENS"
},
TFEAKjAgNFQZpNjo: {
cloud: clouds.KLUB_RESEAU,
@ -49,9 +49,9 @@ export const calendarTree = {
'Club réseau': {},
hackENS: {},
"Écriv'ENS": {},
"CinéClub": {},
CinéClub: {},
Ernestophone: {},
'Club inutile': {},
'Club inutile': {}
},
COF: {
BDA: {},
@ -120,6 +120,12 @@ function fcEventFromjCalEvent(cal) {
fcEvent.description = evt.description
fcEvent.location = evt.location || cal.default_location
if (evt.status) {
fcEvent.status = evt.status
fcEvent.classNames = [`st-${evt.status.toLowerCase()}`]
console.log(evt.status, evt.summary)
}
if (evt.rrule) {
const { freq, byday, interval } = evt.rrule
fcEvent.rrule = {