Compare commits
No commits in common. "9e392fb9452a197338bc908444f20b4175475bb7" and "cb3f5c350fec66af7086f841c68e1ad81b34f155" have entirely different histories.
9e392fb945
...
cb3f5c350f
@ -3,14 +3,59 @@ import iCalendarPlugin from '@fullcalendar/icalendar';
|
|||||||
import resourceTimeGridPlugin from '@fullcalendar/resource-timegrid';
|
import resourceTimeGridPlugin from '@fullcalendar/resource-timegrid';
|
||||||
|
|
||||||
import { unique_colors } from 'unique-colors';
|
import { unique_colors } from 'unique-colors';
|
||||||
import _ALL_SHOPS from './shops.json';
|
|
||||||
export const ALL_SHOPS: { [key: string]: Shop } = _ALL_SHOPS;
|
|
||||||
|
|
||||||
interface Shop {
|
interface Shop {
|
||||||
calendar?: string;
|
calendar?: string;
|
||||||
children?: string[];
|
children?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const shops: { [key: string]: Shop } = {
|
||||||
|
Cafe: {
|
||||||
|
calendar: 'ofbkp5ctd1hr7917sknlj9s15g@group.calendar.google.com',
|
||||||
|
},
|
||||||
|
'Conference Room': {}, // same calendar as mezzanine
|
||||||
|
'Classroom / Computer Lab': {
|
||||||
|
calendar: '6mmjp85e4732ru6skf1dda54ls@group.calendar.google.com',
|
||||||
|
children: ['Printer, Canon iPF8400S 44" 8-Color/Pigment'],
|
||||||
|
},
|
||||||
|
'Digital Fabrication and Electronics Lab': {
|
||||||
|
calendar: '1g8atbdschshrg2inf162rcqt4@group.calendar.google.com',
|
||||||
|
children: [
|
||||||
|
'3d printer, Lulzbot Taz 6',
|
||||||
|
'3d printer, Lulzbot Mini',
|
||||||
|
'Laser Cutter, GLS Hybrid',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
'Fiber Arts Studio': {
|
||||||
|
calendar: '7gbndciog37ge0hd8ug33ml70k@group.calendar.google.com',
|
||||||
|
children: ['Mid Arm, Brother DQLT15'],
|
||||||
|
},
|
||||||
|
'Jewelry Studio': {
|
||||||
|
calendar: 'l0dl2jq3vhbi9f4lfmaf5negc0@group.calendar.google.com',
|
||||||
|
},
|
||||||
|
'Metal Shop': {
|
||||||
|
calendar: 'a4p97kiiafatqdr52c3a0cpre0@group.calendar.google.com',
|
||||||
|
children: [
|
||||||
|
'Plasma Cutter, Hypertherm Powermax85',
|
||||||
|
'MIG Welder, Miller 210',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
Mezzanine: {
|
||||||
|
calendar: 'f4ro53uklj2u6pr0se7ucskm6g@group.calendar.google.com',
|
||||||
|
},
|
||||||
|
'Wood Shop': {
|
||||||
|
calendar: '4unv3ia1n9mc9u31n2n5lv8nd8@group.calendar.google.com',
|
||||||
|
children: [
|
||||||
|
'ShopBot, PRSstandard 96-48-8',
|
||||||
|
'Table Saw, SawStop 3HP 10"',
|
||||||
|
'Planer, Powermatic 20"',
|
||||||
|
'Jointer, Powermatic 8"',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const colors: string[] = unique_colors(Object.keys(shops).length);
|
||||||
|
|
||||||
export const common_calendarOptions: CalendarOptions = {
|
export const common_calendarOptions: CalendarOptions = {
|
||||||
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
|
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
|
||||||
plugins: [iCalendarPlugin, resourceTimeGridPlugin],
|
plugins: [iCalendarPlugin, resourceTimeGridPlugin],
|
||||||
@ -37,15 +82,7 @@ export const common_calendarOptions: CalendarOptions = {
|
|||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
hour12: false,
|
hour12: false,
|
||||||
},
|
},
|
||||||
};
|
resources: Object.entries(shops).map(([shop_name, shop]) => {
|
||||||
|
|
||||||
export function main(
|
|
||||||
calendarOptions: CalendarOptions,
|
|
||||||
showNewTools: boolean = false,
|
|
||||||
shops: { [key: string]: Shop } = ALL_SHOPS
|
|
||||||
) {
|
|
||||||
const calendarEl = document.getElementById('calendar');
|
|
||||||
calendarOptions.resources = Object.entries(shops).map(([shop_name, shop]) => {
|
|
||||||
return {
|
return {
|
||||||
id: shop_name,
|
id: shop_name,
|
||||||
title: shop_name,
|
title: shop_name,
|
||||||
@ -59,10 +96,15 @@ export function main(
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
});
|
}),
|
||||||
const calendar = new Calendar(calendarEl!, calendarOptions);
|
};
|
||||||
|
|
||||||
const colors: string[] = unique_colors(Object.keys(shops).length);
|
export function main(
|
||||||
|
calendarOptions: CalendarOptions,
|
||||||
|
allTools: boolean = false
|
||||||
|
) {
|
||||||
|
const calendarEl = document.getElementById('calendar');
|
||||||
|
const calendar = new Calendar(calendarEl!, calendarOptions);
|
||||||
Object.entries(shops)
|
Object.entries(shops)
|
||||||
.filter(([shop_name, shop]) => shop.calendar !== undefined)
|
.filter(([shop_name, shop]) => shop.calendar !== undefined)
|
||||||
.forEach(([shop_name, shop], idx) => {
|
.forEach(([shop_name, shop], idx) => {
|
||||||
@ -83,7 +125,7 @@ export function main(
|
|||||||
// assume any event not for a specific tool is for the shop as a whole
|
// assume any event not for a specific tool is for the shop as a whole
|
||||||
eventData.resourceId = shop_name;
|
eventData.resourceId = shop_name;
|
||||||
}
|
}
|
||||||
if (showNewTools) {
|
if (allTools) {
|
||||||
if (!calendar.getResourceById(eventData.resourceId)) {
|
if (!calendar.getResourceById(eventData.resourceId)) {
|
||||||
calendar.addResource(
|
calendar.addResource(
|
||||||
{ id: eventData.resourceId, title: eventData.resourceId },
|
{ id: eventData.resourceId, title: eventData.resourceId },
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"Cafe": {
|
|
||||||
"calendar": "ofbkp5ctd1hr7917sknlj9s15g@group.calendar.google.com"
|
|
||||||
},
|
|
||||||
"Conference Room": {},
|
|
||||||
"Classroom / Computer Lab": {
|
|
||||||
"calendar": "6mmjp85e4732ru6skf1dda54ls@group.calendar.google.com",
|
|
||||||
"children": ["Printer, Canon iPF8400S 44\" 8-Color/Pigment"]
|
|
||||||
},
|
|
||||||
"Digital Fabrication and Electronics Lab": {
|
|
||||||
"calendar": "1g8atbdschshrg2inf162rcqt4@group.calendar.google.com",
|
|
||||||
"children": [
|
|
||||||
"3d printer, Lulzbot Taz 6",
|
|
||||||
"3d printer, Lulzbot Mini",
|
|
||||||
"Laser Cutter, GLS Hybrid"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Fiber Arts Studio": {
|
|
||||||
"calendar": "7gbndciog37ge0hd8ug33ml70k@group.calendar.google.com",
|
|
||||||
"children": ["Mid Arm, Brother DQLT15"]
|
|
||||||
},
|
|
||||||
"Jewelry Studio": {
|
|
||||||
"calendar": "l0dl2jq3vhbi9f4lfmaf5negc0@group.calendar.google.com"
|
|
||||||
},
|
|
||||||
"Metal Shop": {
|
|
||||||
"calendar": "a4p97kiiafatqdr52c3a0cpre0@group.calendar.google.com",
|
|
||||||
"children": [
|
|
||||||
"Plasma Cutter, Hypertherm Powermax85",
|
|
||||||
"MIG Welder, Miller 210"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Mezzanine": {
|
|
||||||
"calendar": "f4ro53uklj2u6pr0se7ucskm6g@group.calendar.google.com"
|
|
||||||
},
|
|
||||||
"Wood Shop": {
|
|
||||||
"calendar": "4unv3ia1n9mc9u31n2n5lv8nd8@group.calendar.google.com",
|
|
||||||
"children": [
|
|
||||||
"ShopBot, PRSstandard 96-48-8",
|
|
||||||
"Table Saw, SawStop 3HP 10\"",
|
|
||||||
"Planer, Powermatic 20\"",
|
|
||||||
"Jointer, Powermatic 8\""
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
import type { CalendarOptions } from '@fullcalendar/core';
|
import type { CalendarOptions } from '@fullcalendar/core';
|
||||||
|
|
||||||
import { ALL_SHOPS, common_calendarOptions, main } from './common';
|
import { common_calendarOptions, main } from './common';
|
||||||
|
|
||||||
import './wall-display.html';
|
import './wall-display.html';
|
||||||
import './modal.css';
|
import './modal.css';
|
||||||
@ -61,19 +61,7 @@ const calendarOptions: CalendarOptions = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const calendar = main(
|
const calendar = main(calendarOptions, !toolFilter);
|
||||||
calendarOptions,
|
|
||||||
!toolFilter,
|
|
||||||
toolFilter
|
|
||||||
? Object.fromEntries(
|
|
||||||
Object.entries(ALL_SHOPS).filter(
|
|
||||||
([shop_name, shop]) =>
|
|
||||||
toolFilter.includes(shop_name) ||
|
|
||||||
shop.children?.some((t) => toolFilter.includes(t))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
: ALL_SHOPS
|
|
||||||
);
|
|
||||||
|
|
||||||
function refresh() {
|
function refresh() {
|
||||||
calendar.refetchEvents();
|
calendar.refetchEvents();
|
||||||
|
Loading…
Reference in New Issue
Block a user