Compare commits
8 Commits
renovate/c
...
main
Author | SHA1 | Date | |
---|---|---|---|
7d7a6cea7d | |||
2ce860d7a4 | |||
89c63fc8df | |||
56bbe84249 | |||
cfdd261f13 | |||
55854a63a7 | |||
9e392fb945 | |||
ec92effe91 |
36
package.json
36
package.json
@ -10,29 +10,29 @@
|
||||
"dev": "webpack serve"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.23.2",
|
||||
"@babel/plugin-transform-runtime": "^7.23.2",
|
||||
"@babel/preset-env": "^7.23.2",
|
||||
"@babel/core": "^7.24.7",
|
||||
"@babel/plugin-transform-runtime": "^7.24.7",
|
||||
"@babel/preset-env": "^7.24.7",
|
||||
"babel-loader": "^9.1.3",
|
||||
"css-loader": "^6.8.1",
|
||||
"style-loader": "^3.3.3",
|
||||
"ts-loader": "^9.5.0",
|
||||
"typescript": "^5.2.2",
|
||||
"webpack": "^5.89.0",
|
||||
"css-loader": "^7.1.2",
|
||||
"style-loader": "^4.0.0",
|
||||
"ts-loader": "^9.5.1",
|
||||
"typescript": "^5.4.5",
|
||||
"webpack": "^5.91.0",
|
||||
"webpack-cli": "^5.1.4",
|
||||
"webpack-dev-server": "^4.15.1"
|
||||
"webpack-dev-server": "^5.0.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.23.2",
|
||||
"@fullcalendar/core": "^6.1.9",
|
||||
"@fullcalendar/icalendar": "^6.1.9",
|
||||
"@fullcalendar/resource": "^6.1.9",
|
||||
"@fullcalendar/resource-timegrid": "^6.1.9",
|
||||
"@fullcalendar/resource-timeline": "^6.1.9",
|
||||
"@fullcalendar/timegrid": "^6.1.9",
|
||||
"core-js": "^3.33.2",
|
||||
"@babel/runtime": "^7.24.7",
|
||||
"@fullcalendar/core": "^6.1.14",
|
||||
"@fullcalendar/icalendar": "^6.1.14",
|
||||
"@fullcalendar/resource": "^6.1.14",
|
||||
"@fullcalendar/resource-timegrid": "^6.1.14",
|
||||
"@fullcalendar/resource-timeline": "^6.1.14",
|
||||
"@fullcalendar/timegrid": "^6.1.14",
|
||||
"core-js": "^3.37.1",
|
||||
"ical.js": "^1.5.0",
|
||||
"preact": "^10.18.2",
|
||||
"preact": "^10.22.0",
|
||||
"unique-colors": "^1.0.1"
|
||||
}
|
||||
}
|
||||
|
6241
pnpm-lock.yaml
6241
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
@ -2,8 +2,8 @@
|
||||
"type": "module",
|
||||
"exports": "./server.js",
|
||||
"dependencies": {
|
||||
"express": "^4.18.2",
|
||||
"puppeteer": "^21.5.0"
|
||||
"express": "^4.19.2",
|
||||
"puppeteer": "^22.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npm run dev",
|
||||
@ -12,9 +12,9 @@
|
||||
"serve": "node dist/server.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.17.20",
|
||||
"@types/node": "^20.8.10",
|
||||
"tsx": "^3.14.0",
|
||||
"typescript": "^5.2.2"
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/node": "^20.14.2",
|
||||
"tsx": "^4.15.1",
|
||||
"typescript": "^5.4.5"
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@ import puppeteer from 'puppeteer';
|
||||
const PORT = process.env.PORT || 1234;
|
||||
|
||||
const app = express();
|
||||
const puppet_browser = await puppeteer.launch();
|
||||
const puppet_browser = await puppeteer.launch({ headless: 'shell' });
|
||||
|
||||
app.get('/ipad.png', async (req, res) => {
|
||||
const puppet_page = await puppet_browser.newPage();
|
||||
|
@ -3,59 +3,14 @@ import iCalendarPlugin from '@fullcalendar/icalendar';
|
||||
import resourceTimeGridPlugin from '@fullcalendar/resource-timegrid';
|
||||
|
||||
import { unique_colors } from 'unique-colors';
|
||||
import _ALL_SHOPS from './shops.json';
|
||||
export const ALL_SHOPS: { [key: string]: Shop } = _ALL_SHOPS;
|
||||
|
||||
interface Shop {
|
||||
calendar?: 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 = {
|
||||
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
|
||||
plugins: [iCalendarPlugin, resourceTimeGridPlugin],
|
||||
@ -82,7 +37,15 @@ export const common_calendarOptions: CalendarOptions = {
|
||||
minute: '2-digit',
|
||||
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 {
|
||||
id: shop_name,
|
||||
title: shop_name,
|
||||
@ -96,19 +59,15 @@ export const common_calendarOptions: CalendarOptions = {
|
||||
};
|
||||
}),
|
||||
};
|
||||
}),
|
||||
};
|
||||
|
||||
export function main(
|
||||
calendarOptions: CalendarOptions,
|
||||
allTools: boolean = false
|
||||
) {
|
||||
const calendarEl = document.getElementById('calendar');
|
||||
});
|
||||
const calendar = new Calendar(calendarEl!, calendarOptions);
|
||||
|
||||
const colors: string[] = unique_colors(Object.keys(shops).length);
|
||||
Object.entries(shops)
|
||||
.filter(([shop_name, shop]) => shop.calendar !== undefined)
|
||||
.forEach(([shop_name, shop], idx) => {
|
||||
calendar.addEventSource({
|
||||
id: shop_name,
|
||||
url: '/calendar/ical/' + shop.calendar + '/public/basic.ics',
|
||||
format: 'ics',
|
||||
color: colors[idx],
|
||||
@ -125,7 +84,7 @@ export function main(
|
||||
// assume any event not for a specific tool is for the shop as a whole
|
||||
eventData.resourceId = shop_name;
|
||||
}
|
||||
if (allTools) {
|
||||
if (showNewTools) {
|
||||
if (!calendar.getResourceById(eventData.resourceId)) {
|
||||
calendar.addResource(
|
||||
{ id: eventData.resourceId, title: eventData.resourceId },
|
||||
@ -133,6 +92,22 @@ export function main(
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Add background event if resource has children
|
||||
let tool_resource = calendar.getResourceById(eventData.resourceId);
|
||||
let children = tool_resource?.getChildren();
|
||||
if (tool_resource && children?.length) {
|
||||
let new_event = {
|
||||
...eventData,
|
||||
resourceIds: [
|
||||
tool_resource.id,
|
||||
...children.map((resource) => resource.id),
|
||||
],
|
||||
display: 'background',
|
||||
};
|
||||
calendar.addEvent(new_event, shop_name);
|
||||
}
|
||||
|
||||
return eventData;
|
||||
},
|
||||
});
|
||||
|
48
src/shops.json
Normal file
48
src/shops.json
Normal file
@ -0,0 +1,48 @@
|
||||
{
|
||||
"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\"",
|
||||
"Rikon 70-305 Wood Lathe",
|
||||
"Rikon 70-100 Mini Wood Lathe",
|
||||
"Record CL3 Wood Lathe",
|
||||
"Powermatic 45 Wood Lathe"
|
||||
]
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import type { CalendarOptions } from '@fullcalendar/core';
|
||||
|
||||
import { common_calendarOptions, main } from './common';
|
||||
import { ALL_SHOPS, common_calendarOptions, main } from './common';
|
||||
|
||||
import './wall-display.html';
|
||||
import './modal.css';
|
||||
@ -61,7 +61,19 @@ const calendarOptions: CalendarOptions = {
|
||||
},
|
||||
};
|
||||
|
||||
const calendar = main(calendarOptions, !toolFilter);
|
||||
const calendar = main(
|
||||
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() {
|
||||
calendar.refetchEvents();
|
||||
|
@ -37,15 +37,17 @@ module.exports = [
|
||||
},
|
||||
devServer: {
|
||||
allowedHosts: 'all',
|
||||
proxy: {
|
||||
'/calendar': {
|
||||
proxy: [
|
||||
{
|
||||
context: ['/calendar'],
|
||||
target: 'https://calendar.google.com',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/ipad.png': {
|
||||
{
|
||||
context: ['/ipad.png'],
|
||||
target: 'http://localhost:1234',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
|
Loading…
Reference in New Issue
Block a user