Compare commits

..

1 Commits

Author SHA1 Message Date
75986160f8 Add renovate.json 2023-11-19 13:32:00 +00:00
11 changed files with 4106 additions and 4657 deletions

View File

@ -1,2 +0,0 @@
chrome:
skipDownload: true

View File

@ -10,29 +10,29 @@
"dev": "webpack serve"
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/plugin-transform-runtime": "^7.25.9",
"@babel/preset-env": "^7.26.0",
"babel-loader": "^9.2.1",
"css-loader": "^7.1.2",
"style-loader": "^4.0.0",
"ts-loader": "^9.5.1",
"typescript": "^5.6.3",
"webpack": "^5.96.1",
"@babel/core": "^7.23.2",
"@babel/plugin-transform-runtime": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"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",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.1.0"
"webpack-dev-server": "^4.15.1"
},
"dependencies": {
"@babel/runtime": "^7.26.0",
"@fullcalendar/core": "^6.1.15",
"@fullcalendar/icalendar": "^6.1.15",
"@fullcalendar/resource": "^6.1.15",
"@fullcalendar/resource-timegrid": "^6.1.15",
"@fullcalendar/resource-timeline": "^6.1.15",
"@fullcalendar/timegrid": "^6.1.15",
"core-js": "^3.39.0",
"@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",
"ical.js": "^1.5.0",
"preact": "^10.24.3",
"preact": "^10.18.2",
"unique-colors": "^1.0.1"
}
}

File diff suppressed because it is too large Load Diff

6
renovate.json Normal file
View File

@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
}

View File

@ -2,8 +2,8 @@
"type": "module",
"exports": "./server.js",
"dependencies": {
"express": "^4.21.1",
"puppeteer": "^23.8.0"
"express": "^4.18.2",
"puppeteer": "^21.5.0"
},
"scripts": {
"start": "npm run dev",
@ -12,9 +12,9 @@
"serve": "node dist/server.js"
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/node": "^20.17.6",
"tsx": "^4.19.2",
"typescript": "^5.6.3"
"@types/express": "^4.17.20",
"@types/node": "^20.8.10",
"tsx": "^3.14.0",
"typescript": "^5.2.2"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ import puppeteer from 'puppeteer';
const PORT = process.env.PORT || 1234;
const app = express();
const puppet_browser = await puppeteer.launch({ headless: 'shell' });
const puppet_browser = await puppeteer.launch();
app.get('/ipad.png', async (req, res) => {
const puppet_page = await puppet_browser.newPage();
@ -27,7 +27,7 @@ app.get('/ipad.png', async (req, res) => {
hidden: true,
timeout: 10000,
});
const screenshot = Buffer.from(await puppet_page.screenshot());
const screenshot = await puppet_page.screenshot();
await puppet_page.close();
// Disable caching

View File

@ -3,14 +3,59 @@ 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],
@ -37,15 +82,7 @@ export const common_calendarOptions: CalendarOptions = {
minute: '2-digit',
hour12: false,
},
};
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]) => {
resources: Object.entries(shops).map(([shop_name, shop]) => {
return {
id: shop_name,
title: shop_name,
@ -59,15 +96,19 @@ 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)
.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],
@ -84,7 +125,7 @@ export function main(
// assume any event not for a specific tool is for the shop as a whole
eventData.resourceId = shop_name;
}
if (showNewTools) {
if (allTools) {
if (!calendar.getResourceById(eventData.resourceId)) {
calendar.addResource(
{ id: eventData.resourceId, title: eventData.resourceId },
@ -92,22 +133,6 @@ 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;
},
});

View File

@ -1,48 +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\"",
"Rikon 70-305 Wood Lathe",
"Rikon 70-100 Mini Wood Lathe",
"Record CL3 Wood Lathe",
"Powermatic 45 Wood Lathe"
]
}
}

View File

@ -1,6 +1,6 @@
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 './modal.css';
@ -61,19 +61,7 @@ const calendarOptions: CalendarOptions = {
},
};
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
);
const calendar = main(calendarOptions, !toolFilter);
function refresh() {
calendar.refetchEvents();

View File

@ -37,17 +37,15 @@ module.exports = [
},
devServer: {
allowedHosts: 'all',
proxy: [
{
context: ['/calendar'],
proxy: {
'/calendar': {
target: 'https://calendar.google.com',
changeOrigin: true,
},
{
context: ['/ipad.png'],
'/ipad.png': {
target: 'http://localhost:1234',
},
],
},
},
module: {
rules: [