From 3dee0ee8b762ea32e9a733c106d1d47395280d22 Mon Sep 17 00:00:00 2001 From: alexanderqchen Date: Mon, 5 Mar 2018 17:45:07 -0800 Subject: [PATCH 01/10] added charts for individual event with hard-coded data --- src/components/ControlPanel/controlPanel.js | 4 +- src/components/ControlPanel/eventAnalytics.js | 85 +++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 src/components/ControlPanel/eventAnalytics.js diff --git a/src/components/ControlPanel/controlPanel.js b/src/components/ControlPanel/controlPanel.js index dd4fdd0..8924daa 100644 --- a/src/components/ControlPanel/controlPanel.js +++ b/src/components/ControlPanel/controlPanel.js @@ -1,5 +1,6 @@ import React from 'react'; import Button from 'components/Button'; +import EventAnalytics from './eventAnalytics' export default class ControlPanel extends React.Component { render() { @@ -29,8 +30,9 @@ export default class ControlPanel extends React.Component { - + + ); } diff --git a/src/components/ControlPanel/eventAnalytics.js b/src/components/ControlPanel/eventAnalytics.js new file mode 100644 index 0000000..d57c37c --- /dev/null +++ b/src/components/ControlPanel/eventAnalytics.js @@ -0,0 +1,85 @@ +import React from 'react'; +import Button from 'components/Button'; +import { Chart } from 'chart.js' +import { Pie } from 'react-chartjs-2' + + + +export default class EventAnalytics extends React.Component { + + render() { + + var genderData = { + labels: ["Male", "Female", "Other"], + datasets: [{ + label: 'Gender', + data: [400, 190, 10], + backgroundColor: [ + 'rgba(54, 162, 235, 0.2)', + 'rgba(255, 99, 132, 0.2)', + 'rgba(255, 206, 86, 0.2)' + ], + borderColor: [ + 'rgba(54, 162, 235, 1)', + 'rgba(255,99,132,1)', + 'rgba(255, 206, 86, 1)' + ], + borderWidth: 1 + }] + } + + var yearData = { + labels: ["Freshman", "Sophomore", "Junior", "Senior", "Post-Senior"], + datasets: [{ + label: 'Year', + data: [400, 150, 30, 15, 5], + backgroundColor: [ + 'rgba(255, 99, 132, 0.2)', + 'rgba(255, 159, 64, 0.2)', + 'rgba(255, 206, 86, 0.2)', + 'rgba(75, 192, 192, 0.2)', + 'rgba(54, 162, 235, 0.2)' + ], + borderColor: [ + 'rgba(255,99,132,1)', + 'rgba(255, 159, 64, 1)', + 'rgba(255, 206, 86, 1)', + 'rgba(75, 192, 192, 1)', + 'rgba(54, 162, 235, 1)' + ], + borderWidth: 1 + }] + } + + var majorData = { + labels: ["Computer Science", "Linguistics and Computer Science", "Mathematics of Computation", "Cognitive Science", "Electrical Engineering"], + datasets: [{ + label: 'Year', + data: [400, 150, 30, 15, 5], + backgroundColor: [ + 'rgba(255, 99, 132, 0.2)', + 'rgba(255, 159, 64, 0.2)', + 'rgba(255, 206, 86, 0.2)', + 'rgba(75, 192, 192, 0.2)', + 'rgba(54, 162, 235, 0.2)' + ], + borderColor: [ + 'rgba(255,99,132,1)', + 'rgba(255, 159, 64, 1)', + 'rgba(255, 206, 86, 1)', + 'rgba(75, 192, 192, 1)', + 'rgba(54, 162, 235, 1)' + ], + borderWidth: 1 + }] + } + + return ( +
+ + + +
+ ); + } +} \ No newline at end of file From bf628f2d9d1d0a046ba69ff965f1ea021a5295d1 Mon Sep 17 00:00:00 2001 From: alexanderqchen Date: Sat, 10 Mar 2018 21:35:38 -0800 Subject: [PATCH 02/10] commit to switch branches --- src/components/ControlPanel/eventAnalytics.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/ControlPanel/eventAnalytics.js b/src/components/ControlPanel/eventAnalytics.js index d57c37c..29fcd2a 100644 --- a/src/components/ControlPanel/eventAnalytics.js +++ b/src/components/ControlPanel/eventAnalytics.js @@ -1,7 +1,7 @@ import React from 'react'; import Button from 'components/Button'; import { Chart } from 'chart.js' -import { Pie } from 'react-chartjs-2' +import { Bar } from 'react-chartjs-2' @@ -76,9 +76,9 @@ export default class EventAnalytics extends React.Component { return (
- - - + + +
); } From 136051a2f8fb1b010a4cea7e4c5b41c8e5e7d58a Mon Sep 17 00:00:00 2001 From: alexanderqchen Date: Sun, 11 Mar 2018 15:05:48 -0700 Subject: [PATCH 03/10] embeded graphs within an event component --- src/components/ControlPanel/controlPanel.js | 4 +- src/components/ControlPanel/event.js | 24 +++++++ src/components/ControlPanel/eventAnalytics.js | 42 +++-------- src/components/ControlPanel/style.scss | 71 +++++++++++++++++++ 4 files changed, 106 insertions(+), 35 deletions(-) create mode 100644 src/components/ControlPanel/event.js diff --git a/src/components/ControlPanel/controlPanel.js b/src/components/ControlPanel/controlPanel.js index 8924daa..3cf8559 100644 --- a/src/components/ControlPanel/controlPanel.js +++ b/src/components/ControlPanel/controlPanel.js @@ -1,6 +1,6 @@ import React from 'react'; import Button from 'components/Button'; -import EventAnalytics from './eventAnalytics' +import Event from './event' export default class ControlPanel extends React.Component { render() { @@ -32,7 +32,7 @@ export default class ControlPanel extends React.Component { - + ); } diff --git a/src/components/ControlPanel/event.js b/src/components/ControlPanel/event.js new file mode 100644 index 0000000..c1afea1 --- /dev/null +++ b/src/components/ControlPanel/event.js @@ -0,0 +1,24 @@ +//Edited from components/Events/UserEvents/event.js +//To dynamically pull data, use components/Events/UserEvents/event.js as reference + +import React from 'react' +import EventAnalytics from './eventAnalytics' + +export default class EventCard extends React.Component { + render() { + const className = "event-card user-card"; + return( +
+
+

Event Title

+

Event Committee

+
+ 7:00 am — 11:00 am +

Event Location

+
+ +
+
+ ); + } +} diff --git a/src/components/ControlPanel/eventAnalytics.js b/src/components/ControlPanel/eventAnalytics.js index 29fcd2a..d8858b1 100644 --- a/src/components/ControlPanel/eventAnalytics.js +++ b/src/components/ControlPanel/eventAnalytics.js @@ -1,34 +1,15 @@ import React from 'react'; import Button from 'components/Button'; +import Event from './event.js'; import { Chart } from 'chart.js' -import { Bar } from 'react-chartjs-2' +import { HorizontalBar } from 'react-chartjs-2' export default class EventAnalytics extends React.Component { render() { - - var genderData = { - labels: ["Male", "Female", "Other"], - datasets: [{ - label: 'Gender', - data: [400, 190, 10], - backgroundColor: [ - 'rgba(54, 162, 235, 0.2)', - 'rgba(255, 99, 132, 0.2)', - 'rgba(255, 206, 86, 0.2)' - ], - borderColor: [ - 'rgba(54, 162, 235, 1)', - 'rgba(255,99,132,1)', - 'rgba(255, 206, 86, 1)' - ], - borderWidth: 1 - }] - } - - var yearData = { + const yearData = { labels: ["Freshman", "Sophomore", "Junior", "Senior", "Post-Senior"], datasets: [{ label: 'Year', @@ -51,22 +32,18 @@ export default class EventAnalytics extends React.Component { }] } - var majorData = { - labels: ["Computer Science", "Linguistics and Computer Science", "Mathematics of Computation", "Cognitive Science", "Electrical Engineering"], + const majorData = { + labels: ["Computer Science", "Linguistics and Computer Science", "Mathematics of Computation"], datasets: [{ - label: 'Year', - data: [400, 150, 30, 15, 5], + label: 'Top 3 Majors', + data: [520, 150, 30], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', - 'rgba(255, 159, 64, 0.2)', - 'rgba(255, 206, 86, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(54, 162, 235, 0.2)' ], borderColor: [ 'rgba(255,99,132,1)', - 'rgba(255, 159, 64, 1)', - 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(54, 162, 235, 1)' ], @@ -76,9 +53,8 @@ export default class EventAnalytics extends React.Component { return (
- - - + +
); } diff --git a/src/components/ControlPanel/style.scss b/src/components/ControlPanel/style.scss index af5b3e9..22d1f0d 100644 --- a/src/components/ControlPanel/style.scss +++ b/src/components/ControlPanel/style.scss @@ -43,4 +43,75 @@ padding: 5px 0px; } } + + .event-card { + display: inline-block; + vertical-align: top; + text-align: left; + width: 500px; + margin: 20px; + border-radius: 4px; + box-shadow: 0px 0px 3px #D2D2D2; + background-color: white; + transition: 0.125s ease-in-out; + // border: 3px solid $light-green; + + @media (max-width: 690px) { + margin: 20px 0px; + } + + @media (max-width: 340px) { + width: 300px; + } + + &.selected { + transform: scale(1.02, 1.02); + } + + &.selected:hover { + background: white; + } + + &.admin-card { + margin-left: 10px; + } + + .content { + padding: 20px; + } + + h2 { + color: #333333; + margin: 0; + } + + h3 { + text-transform: uppercase; + font-size: 1.0em; + font-weight: 400; + color: #555555; + margin: 5px 0px; + } + + p { + padding-top: 5px; + } + + .subcontent { + border-top: 1px solid #F2F2F2; + margin-top: 10px; + padding-top: 10px; + color: #666666; + font-weight: 300; + font-size: 0.8em; + + .time { + font-weight: 400; + } + + .location { + padding-bottom: 0px; + } + } + } } From 4d44c64e3d0a5bb453e9ddc3ae71616924e37191 Mon Sep 17 00:00:00 2001 From: alexanderqchen Date: Sun, 11 Mar 2018 15:19:29 -0700 Subject: [PATCH 04/10] changed spaces to tabs --- src/components/ControlPanel/event.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ControlPanel/event.js b/src/components/ControlPanel/event.js index c1afea1..61a63de 100644 --- a/src/components/ControlPanel/event.js +++ b/src/components/ControlPanel/event.js @@ -16,7 +16,7 @@ export default class EventCard extends React.Component { 7:00 am — 11:00 am

Event Location

- + ); From 6dbdf22a72ca5596300426176dfa39bfcdc73dbb Mon Sep 17 00:00:00 2001 From: alexanderqchen Date: Tue, 17 Apr 2018 21:18:59 -0700 Subject: [PATCH 05/10] made bar graphs vertical and added total attendees --- src/components/ControlPanel/eventAnalytics.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/ControlPanel/eventAnalytics.js b/src/components/ControlPanel/eventAnalytics.js index d8858b1..66f6f47 100644 --- a/src/components/ControlPanel/eventAnalytics.js +++ b/src/components/ControlPanel/eventAnalytics.js @@ -2,7 +2,7 @@ import React from 'react'; import Button from 'components/Button'; import Event from './event.js'; import { Chart } from 'chart.js' -import { HorizontalBar } from 'react-chartjs-2' +import { Bar } from 'react-chartjs-2' @@ -33,7 +33,7 @@ export default class EventAnalytics extends React.Component { } const majorData = { - labels: ["Computer Science", "Linguistics and Computer Science", "Mathematics of Computation"], + labels: ["Computer Science", "Ling CS", "Math CS"], datasets: [{ label: 'Top 3 Majors', data: [520, 150, 30], @@ -53,8 +53,9 @@ export default class EventAnalytics extends React.Component { return (
- - +

Total Attendees: 100

+ +
); } From f47b3ed0844ef1c42c4ef298ae1eb42db4d9bb2c Mon Sep 17 00:00:00 2001 From: alexanderqchen Date: Fri, 20 Apr 2018 19:47:29 -0700 Subject: [PATCH 06/10] improved attendees display format, accounted for long event names, and made graphs dynamically sized --- src/components/ControlPanel/controlPanel.js | 4 ++ src/components/ControlPanel/event.js | 12 ++++- src/components/ControlPanel/eventAnalytics.js | 26 +++++++---- src/components/ControlPanel/style.scss | 46 +++++++++++++++++-- src/components/Leaderboard/leaderboard.js | 1 + src/reducers/leaderboard.js | 2 +- 6 files changed, 76 insertions(+), 15 deletions(-) diff --git a/src/components/ControlPanel/controlPanel.js b/src/components/ControlPanel/controlPanel.js index 0270f50..4a02144 100644 --- a/src/components/ControlPanel/controlPanel.js +++ b/src/components/ControlPanel/controlPanel.js @@ -45,6 +45,10 @@ export default class ControlPanelComponent extends React.Component { + + + + ); } diff --git a/src/components/ControlPanel/event.js b/src/components/ControlPanel/event.js index 61a63de..6b7305f 100644 --- a/src/components/ControlPanel/event.js +++ b/src/components/ControlPanel/event.js @@ -10,8 +10,18 @@ export default class EventCard extends React.Component { return(
-

Event Title

+

THIS IS A VERY LONG EVENT TITLE THAT WILL OVERFLOW THE DIV

Event Committee

+ + + +
+
100
+
attendees
+
+ + +
7:00 am — 11:00 am

Event Location

diff --git a/src/components/ControlPanel/eventAnalytics.js b/src/components/ControlPanel/eventAnalytics.js index 66f6f47..92c73fb 100644 --- a/src/components/ControlPanel/eventAnalytics.js +++ b/src/components/ControlPanel/eventAnalytics.js @@ -10,9 +10,9 @@ export default class EventAnalytics extends React.Component { render() { const yearData = { - labels: ["Freshman", "Sophomore", "Junior", "Senior", "Post-Senior"], + labels: ["1", "2", "3", "4", "5+"], datasets: [{ - label: 'Year', + label: 'Attendees', data: [400, 150, 30, 15, 5], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', @@ -29,13 +29,18 @@ export default class EventAnalytics extends React.Component { 'rgba(54, 162, 235, 1)' ], borderWidth: 1 - }] - } + }], + options: { + legend: { + display: false + } + } + }; const majorData = { - labels: ["Computer Science", "Ling CS", "Math CS"], + labels: ["CS", "Ling CS", "Math CS"], datasets: [{ - label: 'Top 3 Majors', + label: 'Attendees', data: [520, 150, 30], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', @@ -49,13 +54,14 @@ export default class EventAnalytics extends React.Component { ], borderWidth: 1 }] - } + }; return (
-

Total Attendees: 100

- - +

Attendees By Year

+ +

Attendees By Major

+
); } diff --git a/src/components/ControlPanel/style.scss b/src/components/ControlPanel/style.scss index dd8e4c0..fede92e 100644 --- a/src/components/ControlPanel/style.scss +++ b/src/components/ControlPanel/style.scss @@ -73,7 +73,7 @@ display: inline-block; vertical-align: top; text-align: left; - width: 500px; + width: calc((100vw - 550px)/2); margin: 20px; border-radius: 4px; box-shadow: 0px 0px 3px #D2D2D2; @@ -81,6 +81,10 @@ transition: 0.125s ease-in-out; // border: 3px solid $light-green; + @media (max-width: 1224px) { + width: calc((100vw - 500px)); + } + @media (max-width: 690px) { margin: 20px 0px; } @@ -102,7 +106,43 @@ } .content { - padding: 20px; + padding: 20px; + position: relative; + + h2 { + margin-right: 100px; + } + + .points-container { + position: absolute; + height: 60px; + width: 85px; + border-radius: 50px; + line-height: 50px; + right: 12px; + top: 12px; + border: 1px solid #DADADA; + background-color: white; + text-align: center; + + .label { + line-height: 0px; + margin-top: -10px; + font-size: 0.85em; + } + + .points { + font-size: 1.1em; + } + } + + .chartWrapper { + margin-top: 20px; + + .chart-title { + text-align: center; + } + } } h2 { @@ -139,4 +179,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/components/Leaderboard/leaderboard.js b/src/components/Leaderboard/leaderboard.js index 3de41f9..47798f0 100644 --- a/src/components/Leaderboard/leaderboard.js +++ b/src/components/Leaderboard/leaderboard.js @@ -13,6 +13,7 @@ export default class Leaderboard extends React.Component { } render() { + console.log(this.props.leaderboard); if (!this.props.leaderboard || !this.props.leaderboard.length || this.props.leaderboard.length < 3) return null; if (this.props.error) { diff --git a/src/reducers/leaderboard.js b/src/reducers/leaderboard.js index 34fb0b1..6cdab01 100644 --- a/src/reducers/leaderboard.js +++ b/src/reducers/leaderboard.js @@ -53,7 +53,7 @@ const FetchLeaderboard = () => { }); const status = await response.status; - if (status === 401 || status === 403) { + if (status === 401 || status === 403) { return dispatch(LogoutUser()); } From 5cda65539d8bea37c15c4259329e21cf17798845 Mon Sep 17 00:00:00 2001 From: Alexander Chen Date: Fri, 20 Apr 2018 20:46:11 -0700 Subject: [PATCH 07/10] removed debug console.log --- src/components/Leaderboard/leaderboard.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/Leaderboard/leaderboard.js b/src/components/Leaderboard/leaderboard.js index 47798f0..19de3f9 100644 --- a/src/components/Leaderboard/leaderboard.js +++ b/src/components/Leaderboard/leaderboard.js @@ -13,7 +13,6 @@ export default class Leaderboard extends React.Component { } render() { - console.log(this.props.leaderboard); if (!this.props.leaderboard || !this.props.leaderboard.length || this.props.leaderboard.length < 3) return null; if (this.props.error) { @@ -60,4 +59,4 @@ export default class Leaderboard extends React.Component { ); } } -} \ No newline at end of file +} From 89ee34ece7771aa149671a69335b1c89d4832678 Mon Sep 17 00:00:00 2001 From: alexanderqchen Date: Sun, 29 Apr 2018 14:57:33 -0700 Subject: [PATCH 08/10] added major consolidation function --- src/components/ControlPanel/event.js | 24 ++++ src/components/Leaderboard/leaderboard.js | 1 - src/components/Topbar/index.js | 1 + src/config.js | 127 +++++++++++++++++++++- 4 files changed, 151 insertions(+), 2 deletions(-) diff --git a/src/components/ControlPanel/event.js b/src/components/ControlPanel/event.js index 6b7305f..2aafbf6 100644 --- a/src/components/ControlPanel/event.js +++ b/src/components/ControlPanel/event.js @@ -3,9 +3,33 @@ import React from 'react' import EventAnalytics from './eventAnalytics' +import Config from 'config' export default class EventCard extends React.Component { + //input: array of majors + translate(majors) { + + const majorMap = Config.majorMap; + + const decideMajor = inputMajor => { + for (let j = 0; j < majorMap.length; j++) { + const { major, criteria } = majorMap[j]; + const output = criteria.find(({ val }) => inputMajor.match(val)); + if (output) { + return major; + } + } + return "Other" + } + + let reducedMajors = majors.map(decideMajor); + console.log(reducedMajors); + } + render() { + + this.translate(["computer science", "computer science and engineering", "electrical engineering", "mathematics of computation", "cognitive science", "linguistics and computer science", "math of computation", "applied mathematics", "undeclared engineering", "physics", "computer science & engineering", "computational and systems biology", "economics", "statistics", "mathematics", "bioengineering", "biochemistry", "mathematics/economics", "neuroscience", "chemistry", "mechanical engineering", "cs", "computer science engineering", "business economics", "cse", "civil engineering", "chemical engineering", "electrical and computer engineering", "math", "computational & systems biology", "computer engineering"]); + const className = "event-card user-card"; return(
diff --git a/src/components/Leaderboard/leaderboard.js b/src/components/Leaderboard/leaderboard.js index 47798f0..3de41f9 100644 --- a/src/components/Leaderboard/leaderboard.js +++ b/src/components/Leaderboard/leaderboard.js @@ -13,7 +13,6 @@ export default class Leaderboard extends React.Component { } render() { - console.log(this.props.leaderboard); if (!this.props.leaderboard || !this.props.leaderboard.length || this.props.leaderboard.length < 3) return null; if (this.props.error) { diff --git a/src/components/Topbar/index.js b/src/components/Topbar/index.js index 3ae5c44..778e5b1 100644 --- a/src/components/Topbar/index.js +++ b/src/components/Topbar/index.js @@ -22,6 +22,7 @@ export default class Topbar extends React.Component { +
}
diff --git a/src/config.js b/src/config.js index 158f664..b000395 100644 --- a/src/config.js +++ b/src/config.js @@ -141,4 +141,129 @@ export default { { startsAt: 500, rank: "Constant Cheetah" }, { startsAt: 800, rank: "Extraterrestrial Eagle" }, ], -}; + majorMap: [ //order of majors are significant + { + major: "Ling CS", + criteria: [ + { type: "regex", val: /ling.*comp.*sci/ }, + { type: "regex", val: /ling.*cs/ } + ] + }, + { + major: "Ling", + criteria: [ + { type: "regex", val: /ling/ } + ] + }, + { + major: "Math CS", + criteria: [ + { type: "regex", val: /math.*comp/ }, + { type: "regex", val: /comp.*math/ }, + { type: "regex", val: /math .*cs/ } + ] + }, + { + major: "CS/CSE/CE", + criteria: [ + { type: "regex", val: /comp.*sci/ }, + { type: "regex", val: /^cs$/ }, + { type: "regex", val: /^cse$/ }, + { type: "regex", val: /comp.*eng./ } + ] + }, + { + major: "EE", + criteria: [ + { type: "regex", val: /elec.*eng/ }, + { type: "regex", val: /^ee$/ } + ] + }, + { + major: "Cog Sci", + criteria: [ + { type: "regex", val: /cog.*sci/ } + ] + }, + { + major: "CS Bio", + criteria: [ + { type: "regex", val: /comp.*bio/ }, + { type: "regex", val: /cs.*bio/ }, + ] + }, + { + major: "Stats", + criteria: [ + { type: "regex", val: /stat/ }, + ] + }, + { + major: "Math", + criteria: [ + { type: "regex", val: /.*math/ } + ] + }, + { + major: "Econ", + criteria: [ + { type: "regex", val: /econ/ }, + ] + }, + { + major: "Undeclared", + criteria: [ + { type: "regex", val: /undeclared/ }, + { type: "regex", val: /undecided/ } + ] + }, + { + major: "physics", + criteria: [ + { type: "regex", val: /physics/ } + ] + }, + { + major: "BioE", + criteria: [ + { type: "regex", val: /bioe.*/ } + ] + }, + { + major: "Biochem", + criteria: [ + { type: "regex", val: /bio.*chem/ } + ] + }, + { + major: "ChemE", + criteria: [ + { type: "regex", val: /chem.*e/ } + ] + }, + { + major: "MechE", + criteria: [ + { type: "regex", val: /mech.*e/ } + ] + }, + { + major: "CivilE", + criteria: [ + { type: "regex", val: /civil.*e/ } + ] + }, + { + major: "Chem", + criteria: [ + { type: "regex", val: /chem/ } + ] + }, + { + major: "Neuro", + criteria: [ + { type: "regex", val: /neuro/ } + ] + } + ] +}; \ No newline at end of file From 876adde3072fc31e57d52f90dfe5e98c97938fc1 Mon Sep 17 00:00:00 2001 From: alexanderqchen Date: Fri, 25 May 2018 11:18:52 -0700 Subject: [PATCH 09/10] completed changes that nikhil requested --- src/components/ControlPanel/controlPanel.js | 1 + src/components/ControlPanel/event.js | 41 ++++--------------- src/components/ControlPanel/eventAnalytics.js | 6 +-- src/utils.js | 18 ++++++++ 4 files changed, 30 insertions(+), 36 deletions(-) diff --git a/src/components/ControlPanel/controlPanel.js b/src/components/ControlPanel/controlPanel.js index 4a02144..a3ea292 100644 --- a/src/components/ControlPanel/controlPanel.js +++ b/src/components/ControlPanel/controlPanel.js @@ -42,6 +42,7 @@ export default class ControlPanelComponent extends React.Component { +
diff --git a/src/components/ControlPanel/event.js b/src/components/ControlPanel/event.js index 2aafbf6..46687fc 100644 --- a/src/components/ControlPanel/event.js +++ b/src/components/ControlPanel/event.js @@ -1,56 +1,31 @@ -//Edited from components/Events/UserEvents/event.js -//To dynamically pull data, use components/Events/UserEvents/event.js as reference - import React from 'react' import EventAnalytics from './eventAnalytics' import Config from 'config' +import { translate } from 'utils' export default class EventCard extends React.Component { - //input: array of majors - translate(majors) { - - const majorMap = Config.majorMap; - - const decideMajor = inputMajor => { - for (let j = 0; j < majorMap.length; j++) { - const { major, criteria } = majorMap[j]; - const output = criteria.find(({ val }) => inputMajor.match(val)); - if (output) { - return major; - } - } - return "Other" - } - - let reducedMajors = majors.map(decideMajor); - console.log(reducedMajors); - } render() { + const yearData = { 1: 100, 2: 50, 3: 25, 4: 10, 5: 3 }; + const majorData= { "CS/CSE": 300, "Ling CS": 100, "Math": 25 }; - this.translate(["computer science", "computer science and engineering", "electrical engineering", "mathematics of computation", "cognitive science", "linguistics and computer science", "math of computation", "applied mathematics", "undeclared engineering", "physics", "computer science & engineering", "computational and systems biology", "economics", "statistics", "mathematics", "bioengineering", "biochemistry", "mathematics/economics", "neuroscience", "chemistry", "mechanical engineering", "cs", "computer science engineering", "business economics", "cse", "civil engineering", "chemical engineering", "electrical and computer engineering", "math", "computational & systems biology", "computer engineering"]); - - const className = "event-card user-card"; - return( -
+ return( +
-

THIS IS A VERY LONG EVENT TITLE THAT WILL OVERFLOW THE DIV

+

Event Title

Event Committee

- -
100
attendees
- -
7:00 am — 11:00 am

Event Location

- + +
); diff --git a/src/components/ControlPanel/eventAnalytics.js b/src/components/ControlPanel/eventAnalytics.js index 92c73fb..8b4ba98 100644 --- a/src/components/ControlPanel/eventAnalytics.js +++ b/src/components/ControlPanel/eventAnalytics.js @@ -13,7 +13,7 @@ export default class EventAnalytics extends React.Component { labels: ["1", "2", "3", "4", "5+"], datasets: [{ label: 'Attendees', - data: [400, 150, 30, 15, 5], + data: Object.values(this.props.yearData), backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(255, 159, 64, 0.2)', @@ -38,10 +38,10 @@ export default class EventAnalytics extends React.Component { }; const majorData = { - labels: ["CS", "Ling CS", "Math CS"], + labels: Object.keys(this.props.majorData), datasets: [{ label: 'Attendees', - data: [520, 150, 30], + data: Object.values(this.props.majorData), backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(75, 192, 192, 0.2)', diff --git a/src/utils.js b/src/utils.js index c33f8d2..708178b 100644 --- a/src/utils.js +++ b/src/utils.js @@ -17,5 +17,23 @@ const getLevel = points => { return { currLevel, nextLevel, currLevelNumber }; } +const translate = majors => { + const majorMap = Config.majorMap; + + const decideMajor = inputMajor => { + for (const { major, criteria } of majorMap) { + const output = criteria.find(({ val }) => inputMajor.match(val)); + if (output) { + return major; + } + } + return "Other" + } + + let reducedMajors = majors.map(decideMajor); + return reducedMajors; +} + export { getLevel }; +export { translate }; export default { getLevel }; \ No newline at end of file From b8763204c906b98d8cab2ea0a8abc558defca598 Mon Sep 17 00:00:00 2001 From: alexanderqchen Date: Fri, 25 May 2018 11:21:22 -0700 Subject: [PATCH 10/10] removed event components from controlPanel --- src/components/ControlPanel/controlPanel.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/components/ControlPanel/controlPanel.js b/src/components/ControlPanel/controlPanel.js index a3ea292..9426c79 100644 --- a/src/components/ControlPanel/controlPanel.js +++ b/src/components/ControlPanel/controlPanel.js @@ -44,12 +44,6 @@ export default class ControlPanelComponent extends React.Component {
- - - - - -
); }