diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..18f330c --- /dev/null +++ b/.babelrc @@ -0,0 +1,21 @@ +{ + "presets": [ + "@babel/preset-env", + "@babel/preset-react" + ], + "plugins": [ + [ + "react-css-modules", + { + "generateScopedName": "[name]__[local]--[hash:base64]", + "filetypes": { + ".scss": { + "syntax": "postcss-scss" + } + } + } + ], + + ["@babel/plugin-proposal-class-properties"] + ] +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 975aafe..32ef68d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,83 +1,51 @@ -# Created by https://www.gitignore.io/api/windows,osx,node +### suredavid ### +*.psd -### Windows ### -# Windows image file caches -Thumbs.db -ehthumbs.db +## Development +/public/app.js.map +/public/app.js +/public/asset-manifest.json +/public/service-worker.js -# Folder config file -Desktop.ini +### IDEs ### +/.idea/ +/.vscode/ -# Recycle Bin used on file shares -$RECYCLE.BIN/ +### Node ### +pids +*.pid +*.seed +*.pid.lock +lib-cov +coverage +.nyc_output +.grunt +bower_components +.lock-wscript +build/Release -# Windows Installer files -*.cab -*.msi -*.msm -*.msp +# Dependency directories +node_modules/ +jspm_packages/ +.npm +.eslintcache +.node_repl_history +.yarn-integrity -# Windows shortcuts -*.lnk +# dotenv environment variables file +.env -### OSX ### +### macOS ### +# General .DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - - -# Thumbnails ._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 .fseventsd .Spotlight-V100 .TemporaryItems .Trashes .VolumeIcon.icns -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - - -### Node ### -# Logs -logs -*.log -npm-debug.log* - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directory -# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git -node_modules - -# Custom build script -start.sh +### Windows ### +Thumbs.db +[Dd]esktop.ini \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8913bf9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - 10 + - 12 +cache: npm +script: + - npm run build diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..e53107e --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,25 @@ +MIT License + +Copyright (c) 2020 David Wu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +N.B: +Images within the README file, or the media folder, (e.g. hero.png) are licensed separately, +under a [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License](https://creativecommons.org/licenses/by-nc-nd/4.0/). diff --git a/README.md b/README.md index ef3578f..5ccca9d 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,62 @@ -Classes -======= - -Config ------- -Configuration is done through the following environment variables: -```js -// Session -DATABASE_URL // Optional with OpenShift. -COOKIE_SECRET - -// OAuth2 -CLIENT_ID -CLIENT_SECRET -REDIRECT_URI - -// Server -PORT // Optional with OpenShift. -IP // Optional with OpenShift. -``` \ No newline at end of file +# Classes +[](https://travis-ci.com/hellodavie/shs_classes) + + +[](https://shsclasses.hellodavie.com/) + + + +A blazing fast, modern, tested, and trusted timetable app for Sydney Boys High School. +Previously known as [lordhelix.tk](https://shsclasses.hellodavie.com/). + +
+ +## At a glance + - Offline support + - Hide or show lunch breaks + - Dark theme with customizable accent colours + - Shows tomorrow's classes when you have free periods for the rest of the day + - Exams are given priority when they overlap with your normal scheduled classes + - Cross platform, automatic updates + +## Functionality +A customizable dashboard for your classes; +Classes provides detailed information in a convenient manner to help students go about their day. +Displays teachers, casuals/subtitute teachers, shared classes, room variations, and assessments in the daily overview. +Also includes your full timetable, upcoming exams, daily notices, and settings for personalisation and flexibility. +No internet? No worries! Built as a progressive web app, offline support is automatically enabled by caching your timetable. +Change your primary colour, notices filter, or enable dark mode using the settings page. + +## Building +To build a production release of the frontend, use the following command +```sh +$ npm build +``` + +## Deployment +Configuration of the backend is done through the following environment variables +``` +DATABASE_URL= +COOKIE_SECRET= +CLIENT_ID= +CLIENT_SECRET= +REDIRECT_URI= +``` + +Set up Postgres with the [connect-pg-simple schema](https://github.com/voxpelli/node-connect-pg-simple/blob/fc163b26511d746452ef42c798ab766caca2a5ac/table.sql) to enable user sessions. +Notices and patch notes schemas are set up with `knex.js` migrations. Use `npx knex migrate` to create the tables. +Finally, use `npm start` to fire up the backend. + +## License +Based on the original lordhelix app (MIT License), © 2016 Ram Kaniyur. All Rights Reserved. +Maintained by Eddie Qi over the period of 2017-18. + +New classes app and modifications are under the MIT License. © 2020 David Wu. All Rights Reserved. \ +See LICENSE for further information and licensing for images in this readme. diff --git a/app/components/analytics.js b/app/components/analytics.js new file mode 100644 index 0000000..f8e8408 --- /dev/null +++ b/app/components/analytics.js @@ -0,0 +1,20 @@ +import ReactGA from 'react-ga'; + +const GA_TRACKING_ID = 'UA-130596833-2'; + +export function initialiseAnalytics() { + ReactGA.initialize(GA_TRACKING_ID); + setDimension('dimension2', APP_VERSION); +} + +export function pageView(pathname) { + ReactGA.pageview((pathname || window.location.pathname) + window.location.search); +} + +function setDimension(dimensionName, data) { + ReactGA.set({[dimensionName]: data}); +} + +export function collectUserGrade(grade) { + setDimension('dimension1', grade); +} diff --git a/app/components/app/index.js b/app/components/app/index.js deleted file mode 100644 index a6de204..0000000 --- a/app/components/app/index.js +++ /dev/null @@ -1,93 +0,0 @@ -import React from 'react'; - -import Today from '../today'; -import Timetable from '../timetable'; -import Notices from '../notices'; -import Settings from '../settings'; - -import Tabs from '../tabs'; -import Icon from '../icon'; -import Loader from '../loader'; - -import SBHSStore from '../../stores/sbhs'; -import NetworkStore from '../../stores/network'; - -import STYLE from './style.css'; - -function button(icon, tooltip) { - return