├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .travis.yml ├── README.md ├── gulpfile.js ├── img ├── acm-logo-flat.svg ├── ads │ ├── .gitkeep │ ├── clean-up.png │ ├── gs-hacknight.png │ ├── no-sleeping.png │ ├── reflections-projections.png │ └── your-ad-here.png └── sponsors │ ├── 3red.png │ ├── allston.png │ ├── citadel.png │ ├── goldman.png │ ├── hrt.png │ ├── optiver.png │ ├── palantir.png │ ├── sunrise.png │ └── uber.png ├── index.html ├── main.js ├── package-lock.json ├── package.json ├── sass ├── base.scss ├── header.scss ├── loading.scss ├── main.scss └── panels │ ├── ads.scss │ ├── clock.scss │ ├── concert.scss │ ├── events.scss │ ├── meeting-times.scss │ ├── memes.scss │ ├── mtd.scss │ ├── sponsors.scss │ ├── sujay.scss │ └── weather.scss ├── src ├── data │ ├── ads.json │ └── sponsors.json ├── header.js ├── layout.json ├── main.js ├── panels.js ├── panels │ ├── ads.js │ ├── clock.js │ ├── concert.js │ ├── events.js │ ├── meeting-times.js │ ├── memes.js │ ├── mtd.js │ ├── sponsors.js │ ├── sujay.js │ └── weather.js ├── secrets.js.sample ├── third_party │ └── skycons.js └── utils │ └── time.js └── yarn.lock /.eslintignore: -------------------------------------------------------------------------------- 1 | skycons.js 2 | bundle.js 3 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "env": { 3 | "node": true, 4 | "browser": true, 5 | "es6": true 6 | }, 7 | "extends": ["eslint:recommended", "plugin:react/recommended"], 8 | "parserOptions": { 9 | "ecmaFeatures": { 10 | "experimentalObjectRestSpread": true, 11 | "jsx": true 12 | } 13 | }, 14 | "plugins": [ 15 | "react" 16 | ], 17 | "rules": { 18 | "indent": [ 19 | "error", 20 | 4 21 | ], 22 | "linebreak-style": [ 23 | "error", 24 | "unix" 25 | ], 26 | "quotes": [ 27 | "error", 28 | "single" 29 | ], 30 | "semi": [ 31 | "error", 32 | "always" 33 | ] 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directories 27 | node_modules 28 | jspm_packages 29 | 30 | # Optional npm cache directory 31 | .npm 32 | 33 | # Optional REPL history 34 | .node_repl_history 35 | 36 | # Browserify bundle file 37 | bundle.js 38 | 39 | # Compiled CSS file 40 | main.css 41 | 42 | # Secrets file 43 | src/secrets.js 44 | 45 | # Vim swap file 46 | .*.swp 47 | current_layout.json 48 | 49 | # Miscellaneous 50 | .DS_Store 51 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "node" 4 | install: 5 | - npm i eslint 6 | script: 7 | - npm run lint 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ACM Display 2 | 3 | Digital signage for the ACM Office television. 4 | 5 | ## Setup 6 | 7 | ```bash 8 | npm install 9 | cd src 10 | cp secrets.js.sample secrets.js 11 | ``` 12 | 13 | Populate `secrets.js` with your API keys. 14 | 15 | ## How to run 16 | 17 | Download a prebuilt binary of [Electron](https://github.com/atom/electron/releases). Then run: 18 | 19 | `npm start` 20 | 21 | If you need to use a custom version of electron: 22 | ```bash 23 | npm run build 24 | /path/to/electron . # Replace with actual path to Electron binary 25 | ``` 26 | 27 | ## Adding a new Panel 28 | 29 | A panel is just a React component that can be fit flexibly inside a `div` (to conform with the dashboard layout). 30 | To add a new type of panel: 31 | 32 | 1. Create a new panel component in `src/panels/`. 33 | 2. Import your panel component in `src/panels.js` and give it a representative name. 34 | 3. Add an entry in `src/layout.json` to render your panel on the dashboard. 35 | 4. Follow the instructions for 'Changing the layout' to graphically resize and position your panel. 36 | 37 | ## Changing the layout 38 | 39 | You can manually edit `src/layout.json` to change the layout of the Dashboard. 40 | However, you can also run dashboard in layout mode with `--layout`, which allows you to drag and resize panels. 41 | 42 | 1. Run `npm run start:layout` or `/path/to/electron . --layout` 43 | 2. Drag and resize panels on the dashboard. 44 | 3. Copy the newly created `current_layout.json` from the project root directory to `src/layout.json`. 45 | 46 | ```mv curent_layout.json src/layout.json``` 47 | 48 | 49 | ## Raspberry Pi setup guide 50 | 51 | See the [wiki](https://github.com/acm-uiuc/display/wiki/Raspberry-Pi-2-3-Setup-Guide) for instructions for setting up a production display on a Raspberry Pi. 52 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var browserify = require('browserify'); 3 | var babelify = require('babelify'); 4 | var source = require('vinyl-source-stream'); 5 | var sass = require('gulp-sass'); 6 | var importCss = require('gulp-import-css'); 7 | 8 | gulp.task('bundle', function() { 9 | return browserify('./src/main.js') 10 | .transform('babelify', {presets: ['react']}) 11 | .bundle() 12 | .pipe(source('bundle.js')) 13 | .pipe(gulp.dest('.')); 14 | }); 15 | 16 | gulp.task('sass', function() { 17 | return gulp.src('./sass/main.scss') 18 | .pipe(sass().on('error', sass.logError)) 19 | .pipe(importCss()) 20 | .pipe(gulp.dest('.')); 21 | }); 22 | 23 | gulp.task('default', ['bundle', 'sass']); 24 | -------------------------------------------------------------------------------- /img/acm-logo-flat.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Slice 1 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /img/ads/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acm-uiuc/display/a5726142d8fb5007179c5a4bd2584c0bba27ab91/img/ads/.gitkeep -------------------------------------------------------------------------------- /img/ads/clean-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acm-uiuc/display/a5726142d8fb5007179c5a4bd2584c0bba27ab91/img/ads/clean-up.png -------------------------------------------------------------------------------- /img/ads/gs-hacknight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acm-uiuc/display/a5726142d8fb5007179c5a4bd2584c0bba27ab91/img/ads/gs-hacknight.png -------------------------------------------------------------------------------- /img/ads/no-sleeping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acm-uiuc/display/a5726142d8fb5007179c5a4bd2584c0bba27ab91/img/ads/no-sleeping.png -------------------------------------------------------------------------------- /img/ads/reflections-projections.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acm-uiuc/display/a5726142d8fb5007179c5a4bd2584c0bba27ab91/img/ads/reflections-projections.png -------------------------------------------------------------------------------- /img/ads/your-ad-here.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acm-uiuc/display/a5726142d8fb5007179c5a4bd2584c0bba27ab91/img/ads/your-ad-here.png -------------------------------------------------------------------------------- /img/sponsors/3red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acm-uiuc/display/a5726142d8fb5007179c5a4bd2584c0bba27ab91/img/sponsors/3red.png -------------------------------------------------------------------------------- /img/sponsors/allston.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acm-uiuc/display/a5726142d8fb5007179c5a4bd2584c0bba27ab91/img/sponsors/allston.png -------------------------------------------------------------------------------- /img/sponsors/citadel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acm-uiuc/display/a5726142d8fb5007179c5a4bd2584c0bba27ab91/img/sponsors/citadel.png -------------------------------------------------------------------------------- /img/sponsors/goldman.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acm-uiuc/display/a5726142d8fb5007179c5a4bd2584c0bba27ab91/img/sponsors/goldman.png -------------------------------------------------------------------------------- /img/sponsors/hrt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acm-uiuc/display/a5726142d8fb5007179c5a4bd2584c0bba27ab91/img/sponsors/hrt.png -------------------------------------------------------------------------------- /img/sponsors/optiver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acm-uiuc/display/a5726142d8fb5007179c5a4bd2584c0bba27ab91/img/sponsors/optiver.png -------------------------------------------------------------------------------- /img/sponsors/palantir.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acm-uiuc/display/a5726142d8fb5007179c5a4bd2584c0bba27ab91/img/sponsors/palantir.png -------------------------------------------------------------------------------- /img/sponsors/sunrise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acm-uiuc/display/a5726142d8fb5007179c5a4bd2584c0bba27ab91/img/sponsors/sunrise.png -------------------------------------------------------------------------------- /img/sponsors/uber.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acm-uiuc/display/a5726142d8fb5007179c5a4bd2584c0bba27ab91/img/sponsors/uber.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ACM Display 6 | 7 | 8 | 9 |
10 |
11 | 12 |

Loading display...

13 |
14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const electron = require('electron'); 4 | const log = require('electron-log'); 5 | log.transports.file.file = __dirname + '/log.txt'; 6 | const fs = require('fs'); 7 | const ipcMain = electron.ipcMain; 8 | // Module to control application life. 9 | const app = electron.app; 10 | // Module to create native browser window. 11 | const BrowserWindow = electron.BrowserWindow; 12 | 13 | // Keep a global reference of the window object, if you don't, the window will 14 | // be closed automatically when the JavaScript object is garbage collected. 15 | let mainWindow; 16 | 17 | function createWindow () { 18 | // Create the browser window. 19 | mainWindow = new BrowserWindow({fullscreen: true}); 20 | mainWindow.setMenu(null); 21 | 22 | // and load the index.html of the app. 23 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 24 | 25 | // Open the DevTools. 26 | //mainWindow.webContents.openDevTools(); 27 | 28 | // Emitted when the window is closed. 29 | mainWindow.on('closed', function() { 30 | // Dereference the window object, usually you would store windows 31 | // in an array if your app supports multi windows, this is the time 32 | // when you should delete the corresponding element. 33 | mainWindow = null; 34 | }); 35 | // Save current layout for layout mode 36 | ipcMain.on('layout-changed', function(event, layout) { 37 | if(process.argv.includes('--layout')) { 38 | var layoutJSON = JSON.stringify(layout.map(function(widget) { 39 | return { 40 | i: widget.i, 41 | x: widget.x, 42 | y: widget.y, 43 | w: widget.w, 44 | h: widget.h 45 | }; 46 | }), undefined, 4); 47 | fs.writeFile('./current_layout.json', layoutJSON); 48 | } 49 | }); 50 | 51 | // Setup log capture from renderer process 52 | ipcMain.on('renderer-error', function(event, error) { 53 | log.error(error); 54 | }); 55 | } 56 | 57 | // This method will be called when Electron has finished 58 | // initialization and is ready to create browser windows. 59 | app.on('ready', createWindow); 60 | 61 | // Quit when all windows are closed. 62 | app.on('window-all-closed', function () { 63 | // On OS X it is common for applications and their menu bar 64 | // to stay active until the user quits explicitly with Cmd + Q 65 | if (process.platform !== 'darwin') { 66 | app.quit(); 67 | } 68 | }); 69 | 70 | app.on('activate', function () { 71 | // On OS X it's common to re-create a window in the app when the 72 | // dock icon is clicked and there are no other windows open. 73 | if (mainWindow === null) { 74 | createWindow(); 75 | } 76 | }); 77 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "display", 3 | "version": "0.0.1", 4 | "author": "Kevin Wang ", 5 | "scripts": { 6 | "build": "gulp", 7 | "start": "npm run build && electron .", 8 | "start:layout": "npm run build && electron . --layout", 9 | "lint": "./node_modules/eslint/bin/eslint.js src/**/*.js src/*.js main.js" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/acm-uiuc/display.git" 14 | }, 15 | "main": "main.js", 16 | "dependencies": { 17 | "async": "1.5.x", 18 | "babel-preset-react": "6.5.x", 19 | "babelify": "7.2.x", 20 | "browserify": "13.0.x", 21 | "classnames": "2.2.x", 22 | "electron-log": "1.3.x", 23 | "gulp": "3.9.x", 24 | "gulp-import-css": "0.1.x", 25 | "gulp-sass": "2.3.x", 26 | "ical.js": "1.2.x", 27 | "jquery": "3.0.x", 28 | "moment": "2.12.x", 29 | "react": "0.14.x", 30 | "react-dom": "0.14.x", 31 | "react-grid-layout": "0.13.x", 32 | "vinyl-source-stream": "1.1.x" 33 | }, 34 | "devDependencies": { 35 | "electron": "^1.4.16", 36 | "eslint": "3.14.x", 37 | "eslint-plugin-react": "6.9.x" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /sass/base.scss: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css?family=Open+Sans:400,700|Roboto+Mono:400,700'); 2 | 3 | $font-color: #333333; 4 | $font-color-alt: #999; 5 | $font-color-neg: white; 6 | $font-color-neg-back: #333333; 7 | $border-color: #464646; 8 | $button-active-color: #999; 9 | $button-inactive-color: #ddd; 10 | 11 | @mixin monospace-font() { 12 | font-family: 'Roboto Mono', monospace; 13 | } 14 | 15 | @mixin serif-font() { 16 | font-family: 'Open Sans', sans-serif; 17 | } 18 | -------------------------------------------------------------------------------- /sass/header.scss: -------------------------------------------------------------------------------- 1 | @import 'panels/clock'; 2 | 3 | .header-container { 4 | width: 1920px; 5 | height: 200px; 6 | color: $font-color; 7 | border-bottom: 1.5px solid $border-color; 8 | display: flex; 9 | justify-content: space-between; 10 | } 11 | 12 | .header-left, .header-right { 13 | display: flex; 14 | align-items: center; 15 | margin: 25px; 16 | } 17 | 18 | .header-logo { 19 | width: 150px; 20 | height: 150px; 21 | margin-right: 20px; 22 | } 23 | 24 | .header-text { 25 | h1, h2 { 26 | margin: 5px; 27 | } 28 | 29 | h1 { 30 | font-size: 3em; 31 | } 32 | 33 | h2 { 34 | font-size: 2em; 35 | font-weight: normal; 36 | } 37 | } 38 | 39 | .header-right { 40 | display: flex; 41 | } 42 | -------------------------------------------------------------------------------- /sass/loading.scss: -------------------------------------------------------------------------------- 1 | .loading-container { 2 | position: absolute; 3 | top: 50%; 4 | left: 50%; 5 | margin-right: -50%; 6 | transform: translate(-50%, -50%); 7 | text-align: center; 8 | font-size: 1.25em; 9 | 10 | img { 11 | width: 300px; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /sass/main.scss: -------------------------------------------------------------------------------- 1 | @import 'base'; 2 | @import 'header'; 3 | @import 'loading'; 4 | @import 'panels/ads'; 5 | @import 'panels/concert'; 6 | @import 'panels/events'; 7 | @import 'panels/meeting-times'; 8 | @import 'panels/memes'; 9 | @import 'panels/mtd'; 10 | @import 'panels/sponsors'; 11 | @import 'panels/sujay'; 12 | @import 'panels/weather'; 13 | @import url('../node_modules/react-grid-layout/css/styles.css'); 14 | 15 | 16 | body { 17 | color: $font-color; 18 | margin: 0px; 19 | @include monospace-font(); 20 | } 21 | 22 | #main { 23 | width: 1920px; 24 | height: 1080px; 25 | } 26 | 27 | .row { 28 | margin: 25px; 29 | display: flex; 30 | justify-content: space-between; 31 | 32 | > .panel:first-child { 33 | margin-left: 0; 34 | } 35 | } 36 | 37 | .row-primary { 38 | height: 540px; 39 | } 40 | 41 | .row-secondary { 42 | height: 265px; 43 | } 44 | 45 | .panel { 46 | border: 1px solid $border-color; 47 | display: flex; 48 | flex-direction: column; 49 | width: inherit; 50 | height: inherit; 51 | 52 | .panel-heading { 53 | padding: 10px; 54 | border-bottom: 1.5px solid $border-color; 55 | color: $font-color-neg; 56 | background-color: $font-color-neg-back; 57 | flex-shrink: 0; 58 | 59 | h2 { 60 | margin-top: 0; 61 | margin-bottom: 0; 62 | font-size: 1.25em; 63 | font-weight: 400; 64 | } 65 | } 66 | 67 | .panel-body { 68 | padding: 10px; 69 | flex-grow: 1; 70 | @include serif-font; 71 | } 72 | } 73 | 74 | .panel-fill { 75 | flex-grow: 1; 76 | } 77 | 78 | // Make images not draggable 79 | img { 80 | user-drag: none; 81 | user-select: none; 82 | -moz-user-select: none; 83 | -webkit-user-drag: none; 84 | -webkit-user-select: none; 85 | -ms-user-select: none; 86 | } 87 | -------------------------------------------------------------------------------- /sass/panels/ads.scss: -------------------------------------------------------------------------------- 1 | .ads-panel { 2 | img { 3 | max-width:100%; 4 | max-height:100%; 5 | width: 100%; 6 | height: 100%; 7 | border: 1px $border-color solid; 8 | } 9 | margin: 0 auto; 10 | height: inherit; 11 | } 12 | -------------------------------------------------------------------------------- /sass/panels/clock.scss: -------------------------------------------------------------------------------- 1 | .clock-panel { 2 | text-align: right; 3 | 4 | .clock-time { 5 | font-size: 3em; 6 | font-weight: bold; 7 | } 8 | 9 | .clock-date { 10 | font-size: 1.2em; 11 | margin-right: 1px; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /sass/panels/concert.scss: -------------------------------------------------------------------------------- 1 | .concert-panel-body { 2 | display: flex; 3 | align-items: center; 4 | 5 | img { 6 | max-height: 150px; 7 | max-width: 150px; 8 | flex-shrink: 0; 9 | } 10 | 11 | .concert-text { 12 | margin-left: 15px; 13 | font-size: 1.15em; 14 | } 15 | 16 | .concert-title { 17 | font-size: 1.25em; 18 | } 19 | 20 | p { 21 | font-size: 1em; 22 | margin-bottom: 0px; 23 | } 24 | } 25 | 26 | .concert-error-body { 27 | display: flex; 28 | justify-content: center; 29 | align-items: center; 30 | font-size: 1.1em; 31 | color: $font-color-alt; 32 | } 33 | -------------------------------------------------------------------------------- /sass/panels/events.scss: -------------------------------------------------------------------------------- 1 | .event-item { 2 | margin: 10px 5px; 3 | line-height: 1.5em; 4 | 5 | .event-summary { 6 | font-size: 1.25em; 7 | } 8 | 9 | .event-location { 10 | white-space: nowrap; 11 | overflow: hidden; 12 | text-overflow: ellipsis; 13 | } 14 | } 15 | 16 | .events-body-no-events { 17 | display: flex; 18 | justify-content: center; 19 | align-items: center; 20 | font-size: 1.5em; 21 | color: $font-color-alt; 22 | } 23 | 24 | .events-error-body { 25 | display: flex; 26 | justify-content: center; 27 | align-items: center; 28 | font-size: 1.1em; 29 | color: $font-color-alt; 30 | } 31 | -------------------------------------------------------------------------------- /sass/panels/meeting-times.scss: -------------------------------------------------------------------------------- 1 | .meeting-times-body { 2 | display: flex; 3 | flex-direction: column; 4 | justify-content: space-between; 5 | } 6 | 7 | table { 8 | border-collapse: collapse; 9 | width: 100%; 10 | } 11 | 12 | td, th { 13 | border: 1px solid $border-color; 14 | padding: 0.625rem; 15 | text-align: left; 16 | width: calc(100% / 3); 17 | } 18 | 19 | .dot-container { 20 | text-align: center; 21 | 22 | .dot { 23 | display: inline-block; 24 | width: 12px; 25 | height: 12px; 26 | border-radius: 6px; 27 | background-color: $button-inactive-color; 28 | margin: 8px 6px; 29 | 30 | &.active { 31 | background-color: $button-active-color; 32 | } 33 | } 34 | } 35 | 36 | .meeting-times-error-body { 37 | display: flex; 38 | justify-content: center; 39 | align-items: center; 40 | font-size: 1.1em; 41 | color: $font-color-alt; 42 | } 43 | -------------------------------------------------------------------------------- /sass/panels/memes.scss: -------------------------------------------------------------------------------- 1 | .memes-body { 2 | img { 3 | max-width: 100%; 4 | max-height:100%; 5 | height: auto; 6 | } 7 | height: 233px; 8 | margin: 0 auto; 9 | } 10 | 11 | .memes-error-body { 12 | display: flex; 13 | justify-content: center; 14 | align-items: center; 15 | font-size: 5em; 16 | color: $font-color-alt; 17 | } 18 | -------------------------------------------------------------------------------- /sass/panels/mtd.scss: -------------------------------------------------------------------------------- 1 | .mtd-panel { 2 | width: 356px; // Same as events panel 3 | } 4 | 5 | .bus-item { 6 | font-size: 1.5em; 7 | line-height: 1.6em; 8 | 9 | .bus-name { 10 | display: inline; 11 | } 12 | 13 | .bus-mins { 14 | display: inline; 15 | float: right; 16 | } 17 | } 18 | 19 | .mtd-body-no-departures { 20 | display: flex; 21 | justify-content: center; 22 | align-items: center; 23 | font-size: 1.5em; 24 | color: $font-color-alt; 25 | } 26 | -------------------------------------------------------------------------------- /sass/panels/sponsors.scss: -------------------------------------------------------------------------------- 1 | .sponsor-body { 2 | display: flex; 3 | justify-content: center; 4 | align-items: center; 5 | } 6 | 7 | .sponsor-logo { 8 | max-width: 550px; 9 | max-height: 175px; 10 | } 11 | -------------------------------------------------------------------------------- /sass/panels/sujay.scss: -------------------------------------------------------------------------------- 1 | .sujay-panel { 2 | width: 960px; 3 | height: 540px; 4 | } 5 | 6 | .sujay-frame { 7 | width: 100%; 8 | height: 100%; 9 | border: none; 10 | } 11 | -------------------------------------------------------------------------------- /sass/panels/weather.scss: -------------------------------------------------------------------------------- 1 | .weather-panel { 2 | margin-right: 50px; 3 | text-align: right; 4 | 5 | .weather-icon { 6 | width: 50px; 7 | height: 50px; 8 | } 9 | 10 | .weather-temp { 11 | font-size: 3em; 12 | font-weight: bold; 13 | vertical-align: bottom; 14 | margin-left: 10px; 15 | } 16 | 17 | .weather-summary { 18 | font-size: 1.2em; 19 | margin-right: 3px; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/data/ads.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "owner": "Tyler Kim", 4 | "imgPath": "img/ads/no-sleeping.png" 5 | }, 6 | { 7 | "owner": "Tyler Kim", 8 | "imgPath": "img/ads/clean-up.png" 9 | }, 10 | { 11 | "owner": "Top4", 12 | "imgPath": "img/ads/your-ad-here.png" 13 | }, 14 | { 15 | "owner": "Justin Yang", 16 | "imgPath": "img/ads/gs-hacknight.png" 17 | }, 18 | { 19 | "owner": "Justin Yang", 20 | "imgPath": "img/ads/reflections-projections.png" 21 | } 22 | ] 23 | -------------------------------------------------------------------------------- /src/data/sponsors.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Uber", 4 | "level": "Silver", 5 | "logoPath": "img/sponsors/uber.png" 6 | }, 7 | { 8 | "name": "Citadel", 9 | "level": "Diamond", 10 | "logoPath": "img/sponsors/citadel.png" 11 | }, 12 | { 13 | "name": "Goldman Sachs", 14 | "level": "Gold", 15 | "logoPath": "img/sponsors/goldman.png" 16 | }, 17 | { 18 | "name": "HRT", 19 | "level": "Silver", 20 | "logoPath": "img/sponsors/hrt.png" 21 | }, 22 | { 23 | "name": "Sunrise Futures", 24 | "level": "Gold", 25 | "logoPath": "img/sponsors/sunrise.png" 26 | }, 27 | { 28 | "name": "Optiver", 29 | "level": "Gold", 30 | "logoPath": "img/sponsors/optiver.png" 31 | }, 32 | { 33 | "name": "3Red", 34 | "level": "Silver", 35 | "logoPath": "img/sponsors/3red.png" 36 | }, 37 | { 38 | "name": "Allston Trading", 39 | "level": "Bronze", 40 | "logoPath": "img/sponsors/allston.png" 41 | }, 42 | { 43 | "name": "Palantir", 44 | "level": "Silver", 45 | "logoPath": "img/sponsors/palantir.png" 46 | } 47 | ] 48 | -------------------------------------------------------------------------------- /src/header.js: -------------------------------------------------------------------------------- 1 | var React = require('react'); 2 | 3 | var ClockPanel = require('./panels/clock'); 4 | var WeatherPanel = require('./panels/weather'); 5 | 6 | var Header = React.createClass({ 7 | render: function() { 8 | return
9 |
10 | 12 |
13 |

Association for Computing Machinery

14 |

University of Illinois at Urbana-Champaign

15 |
16 |
17 |
18 | 19 | 20 |
21 |
; 22 | } 23 | }); 24 | 25 | module.exports = Header; 26 | -------------------------------------------------------------------------------- /src/layout.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "i": "ads", 4 | "x": 0, 5 | "y": 0, 6 | "w": 12, 7 | "h": 12 8 | }, 9 | { 10 | "i": "sigs", 11 | "x": 18, 12 | "y": 0, 13 | "w": 6, 14 | "h": 12 15 | }, 16 | { 17 | "i": "events", 18 | "x": 12, 19 | "y": 0, 20 | "w": 6, 21 | "h": 12 22 | }, 23 | { 24 | "i": "mtd", 25 | "x": 18, 26 | "y": 12, 27 | "w": 6, 28 | "h": 7 29 | }, 30 | { 31 | "i": "sponsors", 32 | "x": 0, 33 | "y": 12, 34 | "w": 12, 35 | "h": 7 36 | }, 37 | { 38 | "i": "concert", 39 | "x": 12, 40 | "y": 12, 41 | "w": 6, 42 | "h": 7 43 | } 44 | ] 45 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | var React = require('react'); 2 | var ReactDOM = require('react-dom'); 3 | var Header = require('./header'); 4 | 5 | // window.require necessary because we're using browserify 6 | // Something conflicts with the electron 'require' and breaks the bundle 7 | // https://github.com/electron/electron/issues/7300#issuecomment-248773783 8 | var electron = window.require('electron'); 9 | var remote = electron.remote; 10 | var ipcRenderer = electron.ipcRenderer; 11 | var argv = remote.process.argv; 12 | 13 | var ReactGridLayout = require('react-grid-layout'); 14 | var WidthProvider = require('react-grid-layout').WidthProvider; 15 | ReactGridLayout = WidthProvider(ReactGridLayout); 16 | var panels = require('./panels'); 17 | var layout = require('./layout.json'); 18 | 19 | /** 20 | * Top-level dashboard component. 21 | */ 22 | var ACMDisplay = React.createClass({ 23 | componentWillMount: function() { 24 | window.onerror = function(err) { 25 | ipcRenderer.send('renderer-error', err); 26 | }; 27 | }, 28 | onLayoutChange: function(currentLayout) { 29 | ipcRenderer.send('layout-changed', currentLayout); 30 | }, 31 | render: function() { 32 | var inLayoutMode = argv.includes('--layout'); 33 | var usedPanelIds = layout.map(function(panelLayout) { 34 | return panelLayout.i; 35 | }); 36 | var panelDivs = panels.filter(function(panel) { 37 | return usedPanelIds.includes(panel.name); 38 | }).map(function(panel) { 39 | return
{React.createElement(panel.component)}
; 40 | }); 41 | return
42 |
43 | 47 | {panelDivs} 48 | 49 |
; 50 | } 51 | }); 52 | 53 | ReactDOM.render( 54 | React.createElement(ACMDisplay), 55 | document.getElementById('main') 56 | ); 57 | -------------------------------------------------------------------------------- /src/panels.js: -------------------------------------------------------------------------------- 1 | var AdsPanel = require('./panels/ads'); 2 | var ConcertPanel = require('./panels/concert'); 3 | var MTDPanel = require('./panels/mtd'); 4 | var MeetingTimesPanel = require('./panels/meeting-times'); 5 | var SponsorsPanel = require('./panels/sponsors'); 6 | var EventsPanel = require('./panels/events'); 7 | 8 | 9 | module.exports = [ 10 | { 11 | name: 'ads', 12 | component: AdsPanel 13 | }, 14 | { 15 | name: 'sigs', 16 | component: MeetingTimesPanel 17 | }, 18 | { 19 | name: 'events', 20 | component: EventsPanel 21 | }, 22 | { 23 | name: 'mtd', 24 | component: MTDPanel 25 | }, 26 | { 27 | name: 'sponsors', 28 | component: SponsorsPanel 29 | }, 30 | { 31 | name: 'concert', 32 | component: ConcertPanel 33 | } 34 | ]; 35 | -------------------------------------------------------------------------------- /src/panels/ads.js: -------------------------------------------------------------------------------- 1 | var React = require('react'); 2 | 3 | var ads = require('../data/ads.json'); 4 | 5 | /** 6 | * Advertisements panel. 7 | */ 8 | var AdsPanel = React.createClass({ 9 | getInitialState: function() { 10 | return { 11 | index: 0 12 | }; 13 | }, 14 | 15 | nextAd: function() { 16 | var newIndex = (this.state.index + 1) % ads.length; 17 | this.setState({index: newIndex}); 18 | }, 19 | 20 | componentDidMount: function() { 21 | setInterval(this.nextAd, 15000); 22 | }, 23 | 24 | getCurrentAd: function() { 25 | return ; 26 | }, 27 | 28 | render: function() { 29 | return
30 | {this.getCurrentAd()} 31 |
; 32 | } 33 | }); 34 | 35 | module.exports = AdsPanel; 36 | -------------------------------------------------------------------------------- /src/panels/clock.js: -------------------------------------------------------------------------------- 1 | var React = require('react'); 2 | var moment = require('moment'); 3 | 4 | var time = require('../utils/time'); 5 | 6 | /** 7 | * Clock panel. 8 | */ 9 | var ClockPanel = React.createClass({ 10 | getInitialState: function() { 11 | return { 12 | date: moment() 13 | }; 14 | }, 15 | 16 | tick: function() { 17 | this.setState({date: moment()}); 18 | }, 19 | 20 | componentDidMount: function() { 21 | setInterval(this.tick, 1000); 22 | }, 23 | 24 | render: function() { 25 | return
26 |
27 | {time.formatTime(this.state.date)} 28 |
29 |
30 | {this.state.date.format('dddd, MMMM D, YYYY')} 31 |
32 |
; 33 | } 34 | }); 35 | 36 | module.exports = ClockPanel; 37 | -------------------------------------------------------------------------------- /src/panels/concert.js: -------------------------------------------------------------------------------- 1 | var React = require('react'); 2 | var $ = require('jquery'); 3 | 4 | var baseUrl = 'https://concert.acm.illinois.edu/'; 5 | var nowPlayingUrl = baseUrl + 'state'; 6 | 7 | /** 8 | * ACM Concert now playing panel. 9 | */ 10 | var ConcertPanel = React.createClass({ 11 | getInitialState: function() { 12 | return { 13 | nowPlaying: null, 14 | artError: false, 15 | error: null 16 | }; 17 | }, 18 | 19 | updateNowPlaying: function() { 20 | $.ajax({ 21 | url: nowPlayingUrl, 22 | timeout: 5000, 23 | }) 24 | .done(function(data) { 25 | this.setState({ 26 | nowPlaying: data, 27 | error: null 28 | }); 29 | }.bind(this)) 30 | .fail(function(xhr, status, errorThrown) { 31 | this.setState({error: errorThrown}); 32 | }.bind(this)); 33 | }, 34 | 35 | componentDidMount: function() { 36 | this.updateNowPlaying(); 37 | setInterval(this.updateNowPlaying, 1000); 38 | }, 39 | 40 | componentDidUpdate: function(prevProps, prevState) { 41 | if (!this.state.error && 42 | (!prevState.nowPlaying || 43 | prevState.nowPlaying.thumbnail != this.state.nowPlaying.thumbnail)) { 44 | this.setState({artError: false}); 45 | } 46 | }, 47 | 48 | getTimeString: function(time) { 49 | time = Math.round(time); 50 | var mins = Math.floor(time / 60); 51 | var secs = time % 60; 52 | return mins + ':' + ('0' + secs).substr(-2); 53 | }, 54 | 55 | getArtUrl: function() { 56 | var nowPlaying = this.state.nowPlaying; 57 | if (!nowPlaying) { 58 | return baseUrl + 'static/images/default-thumbnail.jpg'; 59 | } 60 | 61 | var artUri = nowPlaying.thumbnail; 62 | if (this.state.artError || !artUri) { 63 | return baseUrl + 'static/images/default-thumbnail.jpg'; 64 | } else if (/https?:\/\//.test(artUri)) { 65 | return artUri; 66 | } else { 67 | return baseUrl + nowPlaying.thumbnail; 68 | } 69 | }, 70 | 71 | handleError: function() { 72 | this.setState({artError: true}); 73 | }, 74 | 75 | render: function() { 76 | var error = this.state.error; 77 | var nowPlaying = this.state.nowPlaying; 78 | 79 | var body = null; 80 | if (error) { 81 | body =
82 |

Error fetching Now Playing from Concert: {error}

83 |
; 84 | } else if (nowPlaying) { 85 | var elapsed = nowPlaying.current_time / 1000; 86 | var elapsedStr = this.getTimeString(elapsed); 87 | var duration = nowPlaying.duration / 1000; 88 | var durationStr = this.getTimeString(duration); 89 | var playedby = nowPlaying.playedby; 90 | 91 | body =
92 | 93 |
94 |
95 | {nowPlaying.current_track} 96 |
97 |

{elapsedStr} / {durationStr}

98 |

{playedby}

99 |
100 |
; 101 | } 102 | 103 | return
104 |
105 |

ACM Concert - Now Playing

106 |
107 | {body} 108 |
; 109 | } 110 | }); 111 | 112 | module.exports = ConcertPanel; -------------------------------------------------------------------------------- /src/panels/events.js: -------------------------------------------------------------------------------- 1 | var React = require('react'); 2 | var $ = require('jquery'); 3 | var moment = require('moment'); 4 | var classNames = require('classnames'); 5 | var secrets = require('../secrets.js'); 6 | 7 | var time = require('../utils/time'); 8 | 9 | var eventsURL = secrets.grootServicesURL + '/events/upcoming'; 10 | var EVENTS_INTERVAL_MS = 60 * 1000; 11 | 12 | /** 13 | * Events panel. 14 | */ 15 | var EventsPanel = React.createClass({ 16 | getInitialState: function() { 17 | return { 18 | events: [], 19 | error: null 20 | }; 21 | }, 22 | 23 | updateEvents: function() { 24 | $.getJSON({ 25 | url: eventsURL, 26 | headers: { 27 | 'Authorization': secrets.grootAccessToken 28 | } 29 | }, function(data) { 30 | var now = moment(); 31 | var events = data 32 | .map(function(e) { 33 | var start = moment(e.start_time); 34 | var end = moment(e.end_time); 35 | return { 36 | startDate: start, 37 | endDate: end, 38 | duration: moment.duration(end.diff(start)), 39 | name: e.name, 40 | id: e.id, 41 | location: e.place ? e.place.name : null 42 | }; 43 | }) 44 | .filter(function(e) { 45 | return e.startDate.isAfter(now); 46 | }) 47 | .sort(function(a, b) { 48 | return a.startDate.isAfter(b.startDate); 49 | }) 50 | .slice(0, 5); 51 | this.setState({ 52 | events: events, 53 | error: null 54 | }); 55 | }.bind(this)) 56 | .fail(function(error){ 57 | this.setState({error: error.statusText}); 58 | }.bind(this)); 59 | }, 60 | 61 | componentDidMount: function() { 62 | this.updateEvents(); 63 | setInterval(this.updateEvents, EVENTS_INTERVAL_MS); 64 | }, 65 | 66 | formatDate: function(date, isEndDate, showDate) { 67 | var dateComponents = []; 68 | if (showDate) { 69 | dateComponents.push(date.format('MMM D')); 70 | } 71 | dateComponents.push(time.formatTime(date)); 72 | return dateComponents.join(' '); 73 | }, 74 | 75 | formatEventTime: function(event) { 76 | var startDateStr = this.formatDate(event.startDate, false, true); 77 | var isSameDay = event.startDate.isSame(event.endDate, 'day'); 78 | var endDateStr = this.formatDate(event.endDate, true, !isSameDay); 79 | return startDateStr + ' \u2013 ' + endDateStr; 80 | }, 81 | 82 | getEvents: function() { 83 | var events = this.state.events; 84 | if (events.length === 0) { 85 | return

No upcoming events

; 86 | } 87 | return events.map(function(event) { 88 | var loc = event.location ?
{event.location}
: null; 89 | return
90 |
{event.name}
91 |
{this.formatEventTime(event)}
92 | {loc} 93 |
; 94 | }.bind(this)); 95 | }, 96 | 97 | render: function() { 98 | var body = null; 99 | var error = this.state.error; 100 | var bodyClass = classNames({ 101 | 'panel-body': true, 102 | 'events-body-no-events': this.state.events.length == 0 103 | }); 104 | 105 | if(error) { 106 | body =
107 |

Error fetching events.

108 |
; 109 | } 110 | else { 111 | body =
112 | {this.getEvents()} 113 |
; 114 | } 115 | 116 | return
117 |
118 |

Events

119 |
120 | {body} 121 |
; 122 | } 123 | }); 124 | 125 | module.exports = EventsPanel; 126 | -------------------------------------------------------------------------------- /src/panels/meeting-times.js: -------------------------------------------------------------------------------- 1 | var React = require('react'); 2 | var $ = require('jquery'); 3 | var classNames = require('classnames'); 4 | var time = require('../utils/time.js'); 5 | var moment = require('moment'); 6 | 7 | var secrets = require('../secrets.js'); 8 | var sigsURL = secrets.grootServicesURL + '/groups/sigs'; 9 | var comitteesURL = secrets.grootServicesURL + '/groups/committees'; 10 | 11 | var ROWS_PER_PAGE = 9; 12 | var REFRESH_TIMES_MS = 60 * 1000; 13 | var SWITCH_PAGE_MS = 10 * 1000; 14 | 15 | /** 16 | * Meeting times panel. 17 | */ 18 | var MeetingTimesPanel = React.createClass({ 19 | getInitialState: function() { 20 | return { 21 | index: 0, 22 | groups: [], 23 | error: null 24 | }; 25 | }, 26 | 27 | updateMeetingTimes: function() { 28 | $.when( 29 | $.getJSON({ 30 | url: sigsURL, 31 | headers: { 32 | 'Authorization': secrets.grootAccessToken 33 | } 34 | }), 35 | $.getJSON({ 36 | url: comitteesURL, 37 | headers: { 38 | 'Authorization': secrets.grootAccessToken 39 | } 40 | }) 41 | ).done(function(sigs, committees) { 42 | this.setState({ 43 | groups: sigs[0].concat(committees[0]), 44 | error: null 45 | }); 46 | }.bind(this), function(error){ 47 | this.setState({error: error.statusText}); 48 | }.bind(this)); 49 | }, 50 | 51 | nextPage: function() { 52 | var newIndex = this.state.index + ROWS_PER_PAGE; 53 | newIndex = newIndex >= this.state.groups.length ? 0 : newIndex; 54 | this.setState({index: newIndex}); 55 | }, 56 | 57 | componentDidMount: function() { 58 | this.updateMeetingTimes(); 59 | setInterval(this.updateMeetingTimes, REFRESH_TIMES_MS); 60 | setInterval(this.nextPage, SWITCH_PAGE_MS); 61 | }, 62 | 63 | render: function() { 64 | var index = this.state.index; 65 | var error = this.state.error; 66 | var body = null; 67 | if(error){ 68 | body =
69 |

Error fetching meeting times.

70 |
; 71 | } 72 | else { 73 | var pageTimes = this.state.groups.slice(index, index + ROWS_PER_PAGE); 74 | var items = pageTimes.map(function(meeting) { 75 | var location = meeting.meetingLoc ? meeting.meetingLoc : 'TBA'; 76 | var meeting_time = moment(meeting.meetingTime, 'h:mm A', true); 77 | meeting_time = meeting_time.isValid() ? time.formatTime(meeting_time, true) : undefined; 78 | var meeting_date = time.formatMeetingDate(meeting.meetingDay) || meeting.meetingDay; 79 | var fulltime = (meeting_date && meeting_time) ? 80 | (meeting_date + ', ' + meeting_time) : 'TBA'; 81 | return 82 | {meeting.name} 83 | {location} 84 | {fulltime} 85 | ; 86 | }); 87 | 88 | var dots = []; 89 | for (var i = 0; i < this.state.groups.length; i += ROWS_PER_PAGE) { 90 | var dotClass = classNames({ 91 | dot: true, 92 | active: i == index 93 | }); 94 | dots.push(); 95 | } 96 | 97 | body =
98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | {items} 108 | 109 |
NameLocationTime
110 |
111 | {dots} 112 |
113 |
; 114 | } 115 | return
116 |
117 |

Meeting Times

118 |
119 | {body} 120 |
; 121 | } 122 | }); 123 | 124 | module.exports = MeetingTimesPanel; 125 | -------------------------------------------------------------------------------- /src/panels/memes.js: -------------------------------------------------------------------------------- 1 | var React = require('react'); 2 | var $ = require('jquery'); 3 | var secrets = require('../secrets.js'); 4 | 5 | var eventsURL = secrets.grootServicesURL + '/memes/random'; 6 | var MEMES_INTERVAL_MS = 10 * 1000; 7 | 8 | /** 9 | * ACM Memes panel. 10 | */ 11 | var MemesPanel = React.createClass({ 12 | getInitialState: function() { 13 | return { 14 | memeUrl: '', 15 | memeError: null 16 | }; 17 | }, 18 | 19 | nextMeme: function() { 20 | $.getJSON({ 21 | url: eventsURL, 22 | headers: { 23 | 'Authorization': secrets.grootAccessToken 24 | } 25 | }, function(data) { 26 | this.setState({ 27 | memeUrl: data.url, 28 | memeError: null 29 | }); 30 | }.bind(this)) 31 | .fail(function(error) { 32 | this.setState({memeError: error}); 33 | }.bind(this)); 34 | }, 35 | 36 | componentDidMount: function() { 37 | this.nextMeme(); 38 | setInterval(this.nextMeme, MEMES_INTERVAL_MS); 39 | }, 40 | 41 | imageError: function() { 42 | this.setState({memeError: true}); 43 | }, 44 | 45 | render: function() { 46 | var error = this.state.memeError; 47 | var body = null; 48 | 49 | if(error){ 50 | body =
51 |

🔥🤷🔥

52 |
; 53 | } 54 | else { 55 | body =
56 | 57 |
; 58 | } 59 | 60 | return
61 |
62 |

Memes

63 |
64 | {body} 65 |
; 66 | } 67 | }); 68 | 69 | module.exports = MemesPanel; 70 | -------------------------------------------------------------------------------- /src/panels/mtd.js: -------------------------------------------------------------------------------- 1 | var React = require('react'); 2 | var $ = require('jquery'); 3 | var classNames = require('classnames'); 4 | 5 | var secrets = require('../secrets'); 6 | 7 | var apiUrl = 'https://developer.cumtd.com/api/v2.2/json/GetDeparturesByStop'; 8 | 9 | /** 10 | * MTD bus times panel. 11 | */ 12 | var MTDPanel = React.createClass({ 13 | getInitialState: function() { 14 | return { 15 | departures: [] 16 | }; 17 | }, 18 | 19 | updateDepartures: function() { 20 | var params = $.param({stop_id: 'GWNMN', key: secrets.mtdApiKey}); 21 | var url = apiUrl + '?' + params; 22 | $.get(url, function(data) { 23 | this.setState({departures: data.departures}); 24 | }.bind(this)); 25 | }, 26 | 27 | componentDidMount: function() { 28 | // MTD limits requests to once per minute 29 | this.updateDepartures(); 30 | setInterval(this.updateDepartures, 60000); 31 | }, 32 | 33 | getMinsText: function(mins) { 34 | if (mins === 0) { 35 | return 'due'; 36 | } 37 | return mins + ' min' + (mins !== 1 ? 's' : ''); 38 | }, 39 | 40 | render: function() { 41 | var departures = this.state.departures.slice(0, 5); 42 | 43 | var body; 44 | if (departures.length > 0) { 45 | body = departures.map(function(departure) { 46 | var headsign = departure.headsign.split(' '); 47 | var num = headsign[0]; 48 | var name = headsign.slice(1).join(' '); 49 | var mins = departure.expected_mins; 50 | return
51 |
52 | {num} {name} 53 |
54 |
{this.getMinsText(mins)}
55 |
; 56 | }.bind(this)); 57 | } else { 58 | body =

No upcoming departures

; 59 | } 60 | 61 | var bodyClass = classNames({ 62 | 'panel-body': true, 63 | 'mtd-body-no-departures': departures.length == 0 64 | }); 65 | 66 | return
67 |
68 |

MTD - Goodwin & Main

69 |
70 |
71 | {body} 72 |
73 |
; 74 | } 75 | }); 76 | 77 | module.exports = MTDPanel; 78 | -------------------------------------------------------------------------------- /src/panels/sponsors.js: -------------------------------------------------------------------------------- 1 | var React = require('react'); 2 | 3 | var sponsors = require('../data/sponsors.json'); 4 | 5 | /** 6 | * Sponsors panel. 7 | */ 8 | var SponsorsPanel = React.createClass({ 9 | getInitialState: function() { 10 | return { 11 | index: 0 12 | }; 13 | }, 14 | 15 | nextSponsor: function() { 16 | var newIndex = (this.state.index + 1) % sponsors.length; 17 | this.setState({index: newIndex}); 18 | }, 19 | 20 | componentDidMount: function() { 21 | setInterval(this.nextSponsor, 5000); 22 | }, 23 | 24 | getCurrentSponsor: function() { 25 | return sponsors[this.state.index]; 26 | }, 27 | 28 | render: function() { 29 | var sponsor = this.getCurrentSponsor(); 30 | return
31 |
32 |

Sponsors

33 |
34 |
35 | 36 |
37 |
; 38 | } 39 | }); 40 | 41 | module.exports = SponsorsPanel; 42 | -------------------------------------------------------------------------------- /src/panels/sujay.js: -------------------------------------------------------------------------------- 1 | var React = require('react'); 2 | 3 | /** 4 | * Sujay.xyz panel. 5 | */ 6 | var SujayPanel = React.createClass({ 7 | refresh: function() { 8 | this.refs.sujay.contentWindow.location.reload(); 9 | }, 10 | 11 | componentDidMount: function() { 12 | setInterval(this.refresh, 10000); 13 | }, 14 | 15 | render: function() { 16 | return
17 |