Compare commits

...

11 Commits

Author SHA1 Message Date
b8ce38ce71 Adjust polyfills to support Safari on iOS 5.1.1 (ie iPad 1)
Just load them directly instead of dynamically importing because this
version doesn't seem to support promises natively
2022-06-28 18:08:52 -04:00
48fefb326f Bump dependencies 2022-06-28 17:31:39 -04:00
02119f1001 Bump dependencies 2022-06-04 19:00:46 -04:00
d9f7785a7d Dynamically load Intl modules to allow code splitting 2022-03-11 00:13:20 -05:00
8e4202d658 Switch to source-map webpack devtool 2022-03-11 00:08:59 -05:00
af875b659d Apply prettier 2022-03-10 23:38:38 -05:00
cc637bfb0f Add .prettierignore 2022-03-10 23:38:26 -05:00
92795ff330 Bump dependencies 2022-03-10 23:34:27 -05:00
a23ec8310a Add /.log/ to .gitignore 2022-03-10 23:34:06 -05:00
dad94439c7 Migrate to pnpm 2022-03-10 23:33:37 -05:00
23ed5801dd Remove unused Vue-related option from webpack config 2021-11-27 01:34:29 -05:00
10 changed files with 3957 additions and 11118 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/node_modules/ /node_modules/
/.cache/ /.cache/
/dist/ /dist/
/.log/

1
.prettierignore Normal file
View File

@ -0,0 +1 @@
pnpm-lock.yaml

View File

@ -1,7 +1,9 @@
module.exports = { module.exports = {
plugins: ['@babel/plugin-transform-runtime'], plugins: ['@babel/plugin-transform-runtime'],
presets: [ presets: [
['@babel/preset-env', { [
'@babel/preset-env',
{
useBuiltIns: 'usage', useBuiltIns: 'usage',
corejs: 3, corejs: 3,
}, },

11047
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,8 @@
{ {
"browserslist": [ "browserslist": [
"defaults", "defaults",
"ios 8.4" "ios 8.4",
"ios 5.1"
], ],
"scripts": { "scripts": {
"start": "npm run serve", "start": "npm run serve",
@ -9,26 +10,26 @@
"serve": "webpack serve" "serve": "webpack serve"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.16.0", "@babel/core": "^7.18.6",
"@babel/plugin-transform-runtime": "^7.16.0", "@babel/plugin-transform-runtime": "^7.18.6",
"@babel/preset-env": "^7.16.0", "@babel/preset-env": "^7.18.6",
"@types/intl": "^1.2.0", "@types/intl": "^1.2.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.5",
"css-loader": "^6.5.1", "css-loader": "^6.7.1",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"style-loader": "^3.3.1", "style-loader": "^3.3.1",
"ts-loader": "^9.2.6", "ts-loader": "^9.3.1",
"typescript": "^4.2.3", "typescript": "^4.7.4",
"webpack": "^5.64.0", "webpack": "^5.73.0",
"webpack-cli": "^4.9.1", "webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.4.0" "webpack-dev-server": "^4.9.2"
}, },
"dependencies": { "dependencies": {
"@fullcalendar/core": "^5.10.0", "@babel/runtime": "^7.18.6",
"@fullcalendar/icalendar": "^5.10.1", "@fullcalendar/core": "^5.11.0",
"@fullcalendar/resource-timegrid": "^5.10.1", "@fullcalendar/icalendar": "^5.11.0",
"core-js": "^3.19.1", "@fullcalendar/resource-timegrid": "^5.11.0",
"ical.js": "github:ekreative/ical.js#var-ical", "core-js": "^3.23.3",
"intl": "^1.2.5", "intl": "^1.2.5",
"unique-colors": "^1.0.1" "unique-colors": "^1.0.1"
} }

3888
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@
} }
.fc .fc-timegrid-now-indicator-line { .fc .fc-timegrid-now-indicator-line {
border-color: rgba(255, 0, 0, .4); border-color: rgba(255, 0, 0, 0.4);
border-top-width: 1px; border-top-width: 1px;
border-top-color: red; border-top-color: red;
border-bottom-width: 9px; border-bottom-width: 9px;

View File

@ -1,13 +1,11 @@
// TODO: could probably be a dynamic import import 'core-js/stable/url';
import intl from 'intl'; import 'core-js/stable/function';
import Intl from 'intl';
import 'intl/locale-data/jsonp/en.js'; import 'intl/locale-data/jsonp/en.js';
window.Intl = Intl;
if (!window.Intl) { import { Calendar, CalendarOptions } from '@fullcalendar/core';
// No `Intl`, so use and load the polyfill.
window.Intl = intl;
}
import { EventInput, Calendar, CalendarOptions } from '@fullcalendar/core';
import iCalendarPlugin from '@fullcalendar/icalendar'; import iCalendarPlugin from '@fullcalendar/icalendar';
import resourceTimeGridPlugin from '@fullcalendar/resource-timegrid'; import resourceTimeGridPlugin from '@fullcalendar/resource-timegrid';
@ -31,22 +29,6 @@ const colors: string[] = unique_colors(Object.keys(calendars).length);
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
const toolFilter: string[] | undefined = urlParams.get('tool')?.split(';'); const toolFilter: string[] | undefined = urlParams.get('tool')?.split(';');
function eventDataTransform(eventData: EventInput): EventInput {
// clear the url to prevent clicking on the event
delete eventData.url;
const match = eventData?.title?.match(/([^\/]*) \| ([^-]*) - (.*)/);
if (match) {
const [, member, shop, tool] = match;
eventData.title = `${member}`;
eventData.resourceId = tool;
if (!toolFilter) {
calendar.addResource({ id: tool, title: tool }, false);
}
}
return eventData;
}
const calendarOptions: CalendarOptions = { const calendarOptions: CalendarOptions = {
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives', schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
plugins: [iCalendarPlugin, resourceTimeGridPlugin], plugins: [iCalendarPlugin, resourceTimeGridPlugin],
@ -62,14 +44,6 @@ const calendarOptions: CalendarOptions = {
startTime: '10:00', startTime: '10:00',
endTime: '21:00', endTime: '21:00',
}, },
eventSources: Object.values(calendars).map((id, idx) => {
return {
url: '/calendar/ical/' + id + '/public/basic.ics',
format: 'ics',
color: colors[idx],
eventDataTransform: eventDataTransform,
};
}),
slotLabelFormat: { slotLabelFormat: {
hour: 'numeric', hour: 'numeric',
minute: '2-digit', minute: '2-digit',
@ -90,8 +64,31 @@ const calendarOptions: CalendarOptions = {
: [], : [],
}; };
function main() {
const calendarEl = document.getElementById('calendar'); const calendarEl = document.getElementById('calendar');
const calendar = new Calendar(calendarEl!, calendarOptions); const calendar = new Calendar(calendarEl!, calendarOptions);
Object.values(calendars).forEach((id, idx) =>
calendar.addEventSource({
url: '/calendar/ical/' + id + '/public/basic.ics',
format: 'ics',
color: colors[idx],
eventDataTransform: (eventData) => {
// clear the url to prevent clicking on the event
delete eventData.url;
const match = eventData?.title?.match(/([^\/]*) \| ([^-]*) - (.*)/);
if (match) {
const [, member, shop, tool] = match;
eventData.title = `${member}`;
eventData.resourceId = tool;
if (!toolFilter) {
calendar.addResource({ id: tool, title: tool }, false);
}
}
return eventData;
},
})
);
calendar.render(); calendar.render();
@ -102,3 +99,6 @@ function refresh() {
// refresh data every five minutes // refresh data every five minutes
window.setInterval(refresh, 5 * 60 * 1000); window.setInterval(refresh, 5 * 60 * 1000);
}
main();

1
src/intl.d.ts vendored Normal file
View File

@ -0,0 +1 @@
declare module 'intl/locale-data/jsonp/en.js';

View File

@ -11,7 +11,7 @@ module.exports = {
}, },
}, },
}, },
devtool: "eval-cheap-source-map", devtool: 'source-map',
module: { module: {
rules: [ rules: [
{ {
@ -22,27 +22,19 @@ module.exports = {
{ {
test: /\.tsx?$/, test: /\.tsx?$/,
exclude: /node_modules/, exclude: /node_modules/,
use: [ use: ['babel-loader', 'ts-loader'],
'babel-loader',
{
loader: 'ts-loader',
options: {
appendTsSuffixTo: [/\.vue$/],
},
}
],
}, },
{ {
test: /\.css$/i, test: /\.css$/i,
use: ["style-loader", "css-loader"], use: ['style-loader', 'css-loader'],
}, },
{ {
test: /\/index.html$/i, test: /\/index.html$/i,
use: { use: {
loader: "file-loader", loader: 'file-loader',
options: { options: {
name: '[name].[ext]', name: '[name].[ext]',
} },
}, },
}, },
], ],