-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dcrepublic-dev
- Loading branch information
Showing
38 changed files
with
1,178 additions
and
692 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,3 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/eslintrc.json", | ||
"env": { | ||
"browser": false, | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"plugin:react/recommended", | ||
"plugin:prettier/recommended", | ||
"plugin:react-hooks/recommended", | ||
"plugin:jsx-a11y/recommended" | ||
], | ||
"plugins": [ | ||
"react", | ||
"unused-imports", | ||
"import", | ||
"@typescript-eslint", | ||
"jsx-a11y", | ||
"prettier" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaFeatures": { | ||
"jsx": true | ||
}, | ||
"ecmaVersion": 12, | ||
"sourceType": "module" | ||
}, | ||
"settings": { | ||
"react": { | ||
"version": "detect" | ||
} | ||
}, | ||
"rules": { | ||
"no-console": "warn", | ||
"react/prop-types": "off", | ||
"react/jsx-uses-react": "off", | ||
"react/react-in-jsx-scope": "off", | ||
"react-hooks/exhaustive-deps": "off", | ||
"jsx-a11y/click-events-have-key-events": "warn", | ||
"jsx-a11y/interactive-supports-focus": "warn", | ||
"prettier/prettier": "warn", | ||
"no-unused-vars": "off", | ||
"unused-imports/no-unused-vars": "off", | ||
"unused-imports/no-unused-imports": "warn", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"warn", | ||
{ | ||
"args": "after-used", | ||
"ignoreRestSiblings": false, | ||
"argsIgnorePattern": "^_.*?$" | ||
} | ||
], | ||
"import/order": [ | ||
"warn", | ||
{ | ||
"groups": [ | ||
"type", | ||
"builtin", | ||
"object", | ||
"external", | ||
"internal", | ||
"parent", | ||
"sibling", | ||
"index" | ||
], | ||
"pathGroups": [ | ||
{ | ||
"pattern": "~/**", | ||
"group": "external", | ||
"position": "after" | ||
} | ||
], | ||
"newlines-between": "always" | ||
} | ||
], | ||
"react/self-closing-comp": "warn", | ||
"react/jsx-sort-props": [ | ||
"warn", | ||
{ | ||
"callbacksLast": true, | ||
"shorthandFirst": true, | ||
"noSortAlphabetically": false, | ||
"reservedFirst": true | ||
} | ||
], | ||
"padding-line-between-statements": [ | ||
"warn", | ||
{ "blankLine": "always", "prev": "*", "next": "return" }, | ||
{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" }, | ||
{ | ||
"blankLine": "any", | ||
"prev": ["const", "let", "var"], | ||
"next": ["const", "let", "var"] | ||
} | ||
] | ||
} | ||
"extends": "next" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,8 @@ next-env.d.ts | |
|
||
.env* | ||
|
||
/postgres | ||
/postgres | ||
|
||
# Serwist | ||
public/sw* | ||
public/swe-worker* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { MetadataRoute } from "next"; | ||
|
||
export default function manifest(): MetadataRoute.Manifest { | ||
return { | ||
name: "SCCS Course Planner", | ||
short_name: "Planner", | ||
id: "sccs_plan", | ||
categories: ["education", "productivity", "utilities"], | ||
description: "Plan and track your classes with the SCCS Course Planner", | ||
dir: "auto", | ||
lang: "en-US", | ||
start_url: "/", | ||
scope: "/", | ||
display: "standalone", | ||
orientation: "any", | ||
display_override: [ | ||
"window-controls-overlay", | ||
/* @ts-ignore tabbed is new https://developer.mozilla.org/en-US/docs/Web/Manifest/display_override */ | ||
"tabbed", | ||
"standalone", | ||
"minimal-ui", | ||
], | ||
background_color: "#141C2A", | ||
theme_color: "#141C2A", | ||
prefer_related_applications: false, | ||
edge_side_panel: { | ||
preferred_width: 425, | ||
}, | ||
shortcuts: [ | ||
{ | ||
name: "Calendar", | ||
url: "/calendar", | ||
description: "Course Planner calendar view", | ||
}, | ||
{ | ||
name: "Ratings", | ||
url: "/rating", | ||
description: "Course Planner ratings form", | ||
}, | ||
], | ||
icons: [ | ||
{ | ||
src: "favicon.ico", | ||
sizes: "32x32", | ||
type: "image/x-icon", | ||
purpose: "any", | ||
}, | ||
{ | ||
src: "logo.svg", | ||
sizes: "any", | ||
type: "image/svg", | ||
purpose: "any", | ||
}, | ||
{ | ||
src: "icon.png", | ||
sizes: "2048x2048", | ||
type: "image/png", | ||
purpose: "any", | ||
}, | ||
{ | ||
src: "icon-maskable.png", | ||
sizes: "2048x2048", | ||
type: "image/png", | ||
purpose: "maskable", | ||
}, | ||
{ | ||
src: "opengraph-image.png", | ||
sizes: "1200x630", | ||
type: "image/png", | ||
purpose: "any", | ||
}, | ||
{ | ||
src: "twitter-image.png", | ||
sizes: "1600x900", | ||
type: "image/png", | ||
purpose: "any", | ||
}, | ||
], | ||
screenshots: [ | ||
{ | ||
src: "screenshot-wide.png", | ||
sizes: "2363x1267", | ||
type: "image/png", | ||
form_factor: "wide", | ||
}, | ||
{ | ||
src: "screenshot-narrow.png", | ||
sizes: "563x999", | ||
type: "image/png", | ||
form_factor: "narrow", | ||
}, | ||
], | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SCCS Course Planner logo; a letter 'P' on a minimalistic calendar. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
User-Agent: * | ||
Allow: / | ||
|
||
Sitemap: https://schedulerv2.sccs.swarthmore.edu/sitemap.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { MetadataRoute } from "next"; | ||
|
||
export default function sitemap(): MetadataRoute.Sitemap { | ||
return [ | ||
{ | ||
url: "https://schedulerv2.sccs.swarthmore.edu", | ||
lastModified: new Date(), | ||
changeFrequency: "monthly", | ||
priority: 1, | ||
}, | ||
{ | ||
url: "https://schedulerv2.sccs.swarthmore.edu/calendar", | ||
lastModified: new Date(), | ||
changeFrequency: "monthly", | ||
priority: 0.8, | ||
}, | ||
{ | ||
url: "https://schedulerv2.sccs.swarthmore.edu/rating", | ||
lastModified: new Date(), | ||
changeFrequency: "monthly", | ||
priority: 0.5, | ||
}, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { defaultCache } from "@serwist/next/worker"; | ||
import type { PrecacheEntry, SerwistGlobalConfig } from "serwist"; | ||
import { Serwist } from "serwist"; | ||
|
||
declare global { | ||
interface WorkerGlobalScope extends SerwistGlobalConfig { | ||
// Change this attribute's name to your `injectionPoint`. | ||
// `injectionPoint` is an InjectManifest option. | ||
// See https://serwist.pages.dev/docs/build/configuring | ||
__SW_MANIFEST: (PrecacheEntry | string)[] | undefined; | ||
} | ||
} | ||
|
||
// @ts-expect-error | ||
declare const self: ServiceWorkerGlobalScope; | ||
|
||
const serwist = new Serwist({ | ||
precacheEntries: self.__SW_MANIFEST, | ||
skipWaiting: true, | ||
clientsClaim: true, | ||
navigationPreload: true, | ||
runtimeCaching: defaultCache, | ||
fallbacks: { | ||
entries: [ | ||
{ | ||
url: "/~offline", | ||
matcher({ request }) { | ||
return request.destination === "document"; | ||
}, | ||
}, | ||
], | ||
}, | ||
}); | ||
|
||
serwist.addEventListeners(); | ||
|
||
/* Push Notifs */ | ||
self.addEventListener("push", function (event: any) { | ||
if (event.data) { | ||
let body; | ||
let icon; | ||
let title; | ||
try { | ||
const data = event.data.json(); | ||
body = data.body; | ||
icon = data.icon || "/icon.png"; | ||
title = data.title; | ||
} catch (e) { | ||
console.log("clearly not a JSON notif"); | ||
body = ""; | ||
icon = "/icon.png"; | ||
title = event.data; | ||
} | ||
|
||
const options = { | ||
body: body, | ||
icon: icon, | ||
badge: "/icon.png", | ||
vibrate: [100, 50, 100], | ||
data: { | ||
dateOfArrival: Date.now(), | ||
primaryKey: "2", | ||
}, | ||
}; | ||
event.waitUntil(self.registration.showNotification(title, options)); | ||
} | ||
}); | ||
|
||
self.addEventListener("notificationclick", function (event: any) { | ||
console.log("Notification click received."); | ||
event.notification.close(); | ||
event.waitUntil( | ||
//@ts-ignore | ||
clients.openWindow("https://schedulerv2.sccs.swarthmore.edu/") | ||
); | ||
}); |
Oops, something went wrong.