Skip to content

Commit

Permalink
Merge branch 'main' into index-styles
Browse files Browse the repository at this point in the history
  • Loading branch information
drewwebs authored Jan 20, 2021
2 parents b2ef935 + 53c47c4 commit a63650a
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 38 deletions.
39 changes: 21 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ GEM
erubi (>= 1.0.0)
rack (>= 0.9.0)
bindex (0.8.1)
binding_of_caller (0.8.0)
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
bootsnap (1.5.1)
msgpack (~> 1.0)
Expand All @@ -86,21 +86,23 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.7)
concurrent-ruby (1.1.8)
connection_pool (2.2.3)
crass (1.0.6)
debug_inspector (0.0.3)
debug_inspector (1.0.0)
erubi (1.10.0)
execjs (2.7.0)
faraday (1.1.0)
faraday (1.3.0)
faraday-net_http (~> 1.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords
ffi (1.13.1)
faraday-net_http (1.0.1)
ffi (1.14.2)
figaro (1.2.0)
thor (>= 0.14.0, < 2)
globalid (0.4.2)
activesupport (>= 4.2.0)
i18n (1.8.5)
i18n (1.8.7)
concurrent-ruby (~> 1.0)
io-like (0.3.1)
jbuilder (2.10.1)
Expand All @@ -109,7 +111,7 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.8.0)
loofah (2.9.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
Expand All @@ -119,13 +121,14 @@ GEM
method_source (1.0.0)
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.2)
mini_portile2 (2.5.0)
minitest (5.14.3)
msgpack (1.3.3)
multipart-post (2.1.1)
nio4r (2.5.4)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
nokogiri (1.11.1)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
pg (1.2.3)
pry (0.13.1)
coderay (~> 1.1)
Expand All @@ -134,6 +137,7 @@ GEM
pry (>= 0.10.4)
public_suffix (4.0.6)
puma (3.12.6)
racc (1.5.2)
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
Expand Down Expand Up @@ -161,7 +165,7 @@ GEM
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rake (13.0.1)
rake (13.0.3)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
Expand All @@ -172,9 +176,9 @@ GEM
railties (>= 3.2)
tilt
regexp_parser (1.8.2)
ruby2_keywords (0.0.2)
ruby2_keywords (0.0.4)
ruby_dep (1.5.0)
ruby_http_client (3.5.1)
ruby_http_client (3.5.2)
rubyzip (2.3.0)
sass (3.7.4)
sass-listen (~> 4.0.0)
Expand All @@ -190,7 +194,7 @@ GEM
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
sendgrid-ruby (6.3.7)
sendgrid-ruby (6.3.8)
ruby_http_client (~> 3.4)
spring (2.1.1)
spring-watcher-listen (2.0.1)
Expand All @@ -209,7 +213,7 @@ GEM
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (1.2.8)
tzinfo (1.2.9)
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
Expand All @@ -226,7 +230,6 @@ GEM

PLATFORMS
ruby
x86_64-linux

DEPENDENCIES
annotate
Expand Down Expand Up @@ -261,4 +264,4 @@ RUBY VERSION
ruby 2.5.1p57

BUNDLED WITH
2.2.0
2.1.4
11 changes: 11 additions & 0 deletions app/assets/javascripts/bundle.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ object-assign
@license MIT
*/

/*!
* Chart.js v2.9.4
* https://www.chartjs.org
* (c) 2020 Chart.js Contributors
* Released under the MIT License
*/

/*!
* Sizzle CSS Selector Engine v2.3.5
* https://sizzlejs.com/
Expand Down Expand Up @@ -72,3 +79,7 @@ object-assign
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

//! moment.js

//! moment.js locale configuration
2 changes: 1 addition & 1 deletion app/assets/stylesheets/nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
transition: all 0.3s ease-in-out;
}

.navlinks:hover:before{
.navlinks:hover:before, .navlinks.selected:before{
visibility: visible;
transform: scaleX(1);
}
Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/splash.scss
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ html, body, body > div, .splashbg {
z-index: 4;
padding-bottom: 200px;
background: #f7f7f7;

.MuiPaper-root{
margin-top: 3%;
}

&-contents {
margin-top: -10%;
Expand Down
24 changes: 17 additions & 7 deletions frontend/components/chart/chart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,48 @@ export default function Graphs ({review, avgWage, avgSalary, displayedReviews}){
return (sumWages/wages.length).toFixed(2)
}


function locationComp(){
let storage = [];
let i = 0
while(i < displayedReviews.length) {
if(review.location === displayedReviews[i].location && displayedReviews[i].payFrequency === "Hourly" && !(displayedReviews[i].position.includes("Manager"))) {
if(review.location === displayedReviews[i].location && displayedReviews[i].payFrequency === 'Hourly') {
storage.push(displayedReviews[i].wage)
}
i++
}
return median(storage)
}

function random_rgba() {
var o = Math.round, r = Math.random, s = 230;
return 'rgba(' + o(r()*s) + ',' + o(r()*s) + ',' + o(r()*s) + ',' + 1.0 + ')';
}

const chart = () => {
debugger
setChartData({
labels: ['Current Wage', review.shopName + ' Avg Wage', 'City Wide Median Wage'],
labels: ['Current Wage', review.shopName + ' Avg Wage', review.location + ' Median Wage', 'National Average Wage'],
title: 'review.shopName',
datasets: [
{

label: review.shopName,
data: [[0,review.wage], [0, shopComp()],[0,locationComp()]],
data: [[0,review.wage], [0, shopComp()],[0,locationComp()], [0, avgWage.toFixed(2)]],
options: {
title: {
display: true,
text: review.shopName
}
},
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'yellow',
'red'
random_rgba(),
random_rgba(),
random_rgba(),
random_rgba()
],
borderWidth: 4
borderWidth: 4,

}
]
})
Expand All @@ -82,6 +91,7 @@ export default function Graphs ({review, avgWage, avgSalary, displayedReviews}){
}, []);

return(

<div className = 'chart'>
<Bar
data = {chartData}
Expand Down
18 changes: 8 additions & 10 deletions frontend/components/nav/nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button, Menu, MenuItem } from '@material-ui/core';
import React, { useState } from 'react';
import { useMediaPredicate } from 'react-media-hook';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import { Link, NavLink } from 'react-router-dom';
import { logout } from '../../actions/user_actions';

function Nav({currentUser, logout}) {
Expand All @@ -20,14 +20,12 @@ function Nav({currentUser, logout}) {
return (
<header className= 'browsenav' >
<nav>
<Link to="/">
<p className="navlinks">Home</p>
</Link>
<NavLink exact to="/" activeClassName='selected' className="navlinks">Home</NavLink>
</nav>
{!mobile && <nav className="explore-links">
<Link to="/reviews" className="navlinks">Explore Shops</Link>
<Link to="/create_review" className="navlinks">Report Wages</Link>
<Link to='/feedback' className='navlinks'>Feedback</Link>
<NavLink activeClassName='selected' to="/reviews" className="navlinks">Explore Shops</NavLink>
<NavLink activeClassName='selected' to="/create_review" className="navlinks">Report Wages</NavLink>
<NavLink activeClassName='selected' to='/feedback' className='navlinks'>Feedback</NavLink>
{Boolean(currentUser) ? <div className='user-info'>
<p>Hello {currentUser.firstName} {currentUser.admin ? <i className="fas fa-user-shield"></i> : null}, <a className='navlinks' onClick={logout}>Logout</a></p>
</div> : null}
Expand All @@ -41,9 +39,9 @@ function Nav({currentUser, logout}) {
keepMounted
open={Boolean(anchor)}
onClose={closeMenu} >
<MenuItem onClick={closeMenu}><Link to="/reviews" className="navlinks">Explore Shops</Link></MenuItem>
<MenuItem onClick={closeMenu}><Link to="/create_review" className="navlinks">Report Wages</Link></MenuItem>
<MenuItem onClick={closeMenu}><Link to='/feedback' className='navlinks'>Feedback</Link></MenuItem>
<MenuItem onClick={closeMenu}><NavLink activeClassName='selected' to="/reviews" className="navlinks">Explore Shops</NavLink></MenuItem>
<MenuItem onClick={closeMenu}><NavLink activeClassName='selected' to="/create_review" className="navlinks">Report Wages</NavLink></MenuItem>
<MenuItem onClick={closeMenu}><NavLink activeClassName='selected' to='/feedback' className='navlinks'>Feedback</NavLink></MenuItem>
{Boolean(currentUser) ? <MenuItem onClick={() => {
closeMenu()
logout()
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/reviews/Index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function ReviewIndex() {
let salaries = []
for (let i = 0; i < displayedReviews.length; i++) {
const review = displayedReviews[i];
if (review.payFrequency === "Hourly") {
if (review.wage<=40) {
sumWages += review.wage;
wages.push(review.wage);
} else {
Expand Down Expand Up @@ -86,7 +86,7 @@ export default function ReviewIndex() {
<div className={'reviews-index-search-stats'}>
<div>
<div>Average wage: <i>${avgWage.toFixed(2)}</i> per hour.</div>
<div>Median wage: <i>${medianWage}</i> per hour.</div>
<div>Median wage: <i>${medianWage.toFixed(2)}</i> per hour.</div>
{<div className='reviews-index-search-stats-omitted'>Data from <i>{displayedReviews.length}</i> results</div>}
</div>
<div>
Expand Down

0 comments on commit a63650a

Please sign in to comment.