Skip to content

About devs #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
155d328
Use HTTPS in production
whois-jon-peterson Jul 24, 2019
616f511
Remove errant console.log
whois-jon-peterson Jul 25, 2019
ec8d00c
Add readme and associated screenshots.
lynnerang Jul 25, 2019
04c28a1
Move screenshots folder.
lynnerang Jul 25, 2019
4c735e4
Update title.
lynnerang Jul 25, 2019
50a7e7e
Fix failing tests for card component.
lynnerang Jul 25, 2019
12b9b15
Fix all but one failing tests.
lynnerang Jul 25, 2019
dce380e
Update README.md
SiimonStark Jul 25, 2019
eb2545d
change JoinGame tests
rdren0 Jul 25, 2019
d680b3e
add coverage ignore file variables
rdren0 Jul 25, 2019
cbf10e0
update Join Game tests
rdren0 Jul 25, 2019
aa66547
Update main and board tests
rdren0 Jul 25, 2019
cf01eeb
update App and Card tests
rdren0 Jul 25, 2019
21e3c6b
Add fixes for Main component tests by adding more props.
lynnerang Jul 25, 2019
f7ec6cd
Update index.test.js
rdren0 Jul 25, 2019
dc509ae
Add final tests.
lynnerang Jul 25, 2019
eb94e85
Remove main snap
lynnerang Jul 25, 2019
bc592f7
Add main snapshot again.
lynnerang Jul 25, 2019
bb0f2cf
Rebase: [remote]Master -> [local]Feature
SiimonStark Jul 28, 2019
7c3150e
Merge w/ remote Master
SiimonStark Aug 8, 2019
fc35451
Invite code now shows for all players
SiimonStark Aug 13, 2019
cc1b81f
Call handlePlayAgain() to fetch & inst player
SiimonStark Aug 13, 2019
e518162
Pass necessary props to ReplayScreen, Erase Game state on New game.
SiimonStark Aug 13, 2019
6a5cd35
Create component for AboutDevs, Render info card per dev (Random order)
SiimonStark Aug 13, 2019
12674d4
Import AboutDev Component
SiimonStark Aug 13, 2019
faf2c87
Create NavLink for AboutDevs component
SiimonStark Aug 13, 2019
cbeb856
Change style of buttons in Header
SiimonStark Aug 13, 2019
f6b74ce
Whole card links to dev's Github, remove green border
SiimonStark Aug 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@


## Table of contents
* [Intro](#CodeWords)
* [Screenshots](#Screenshots)
* [Getting Started](#Getting-Started)
* [How to Use](#How-to-Use)
* [Project Emphasis](#Project-Emphasis)
* [UI Design](#UI-Design)
* [Future Plans](#Future-Plans)
* [License](#License)
- [CodeWords ![Build Status](https://travis-ci.com/code-words/codewords-ui)](#codewords-build-statushttpstravis-cicomcode-wordscodewords-ui)
- [Screenshots](#screenshots)
- [Getting Started](#getting-started)
- [How to Use](#how-to-use)
- [UI Design](#ui-design)
- [Future Plans](#future-plans)
- [Project Emphasis](#project-emphasis)
- [Front-End](#front-end)
- [Back-end](#back-end)
- [Licensing](#licensing)


# CodeWords [![Build Status](https://travis-ci.com/code-words/codewords-ui.svg?branch=master)](https://travis-ci.com/code-words/codewords-ui)
Expand Down
72 changes: 72 additions & 0 deletions src/components/AboutDevs/_AboutDevs.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// ** TEMP
.dev-pic {
content: "";
background: $intel-assassin-accent;
height: 75px;
width: 75px;
margin: 5px auto;
border-radius: 50%;
}

.AboutDevs {
display: flex;
flex-direction: column;
justify-content: center;
background: $intel-assassin;
position: relative;
left: 10vw;
top: 10vh;
height: 70vh;
width: 75vw;
padding: 30px;
box-shadow: 8px 8px 10px $overlay-filter;

.divider {
content: "";
height: 2px;
width: 100%;
border: 1px inset gray;
}

a {
text-decoration: none;
}

h2 {
margin: 0 0 10px 30px;
text-shadow: 2px 2px 3px black;
}

h2, h4, h5 {
font-family: $header-font;
}
}

.devs {
display: flex;
align-items: center;
justify-content: center;
height: 85%;
width: 100%;
}

.dev {
display: grid;
grid-auto-flow: dense;
background: $button-default;
border-radius: 5px;
box-shadow: 3px 3px 5px $overlay-filter;
color: black;
padding: 20px;
margin: 30px;
height: 80%;
width: 25%;

p {
height: 25vh;
}

h4 {
color: black;
}
}
71 changes: 71 additions & 0 deletions src/components/AboutDevs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import React from 'react';

const AboutDevs = () => {
const devs = [
{
name: "Jon Peterson",
gH: "https://github.com/joequincy",
role: "BE",
summary:
"A tinkerer by nature, I enjoy hacking away on an interesting idea and learning new tricks along the way. I’m always looking for a new idea or technology to explore!"
},
{
name: "Justin Pyktel",
gH: "https://github.com/SiimonStark",
role: "FE",
summary:
"TBD"
},
{
name: "Lynne Rang",
gH: "https://github.com/lynnerang",
role: "FE",
summary:
"TBD"
},
{
name: "Rachael Drennan",
gH: "https://github.com/rdren0",
role: "FE/BE",
summary:
"TBD"
}
];

const randomizeDevs = () => {
// Resource:
// https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array

for (let i = devs.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[devs[i], devs[j]] = [devs[j], devs[i]];
}
}

const renderDevs = () => {
randomizeDevs();

return devs.map(dev => {
return (
<a className="dev" href={dev.gH} target="blank" key={dev.name}>
<div className="dev-pic" />
<h4>{dev.name}</h4>
<h5>Role: {dev.role}</h5>
<div className="divider" />
<p>{dev.summary}</p>
</a>
);
})
}

return (
<div className="AboutDevs">
<h2>Top Secret Case Files:</h2>
<section className="devs">
{renderDevs()}
</section>
</div>
)
}

export default AboutDevs;
Empty file.
48 changes: 40 additions & 8 deletions src/components/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Route, Switch } from 'react-router-dom';
import Header from '../Header';
import StartScreen from '../StartScreen';
import RuleList from '../RuleList';
import AboutDevs from '../AboutDevs';
import NewGame from '../NewGame';
import JoinGame from '../JoinGame';
import Lobby from '../Lobby';
Expand Down Expand Up @@ -37,12 +38,12 @@ export class App extends Component {
};
}

handleUserInit = result => {
handleUserInit = (result, inviteCode) => {
const { id, name, token } = result;
localStorage.setItem("Token", token);
const user = { id, name, token }
if (result.invite_code) this.setState({ invite_code: result.invite_code });
this.setState({ user }, () => this.createCable(token));
// if (result.invite_code) this.setState({ invite_code: result.invite_code });
this.setState({ user, invite_code: inviteCode || result.invite_code }, () => this.createCable(token));
};

updateHintLogs = data => {
Expand Down Expand Up @@ -140,6 +141,31 @@ export class App extends Component {
}
}

closeReplay = () => {
this.setState({
user: {},
invite_code: '',
playerRoster: [],
hintLogs: [],
cardData: [],
cable: {},
isLobbyFull: false,
currentPlayerId: null,
remainingAttempts: null,
winner: "",
currentHint: {
hintWord: "",
relatedCards: null
},
showDialog: false,
confMsg: ""
});
}

finishGame = (code) => {
this.setState({invite_code: code});
}

dataSwitch = result => {
const { type, data } = result;
switch (type) {
Expand All @@ -156,9 +182,8 @@ export class App extends Component {
this.setGuess(data);
break;
case 'game-over':
console.log(data)
this.setGuess(data);
// add resetting of invite code from response and resetting of some state properties
this.finishGame(data.nextGame);
setTimeout(() => this.setState({ winner: data.winningTeam}), 2500);
break;
case 'illegal-action':
Expand Down Expand Up @@ -194,10 +219,16 @@ export class App extends Component {
};

render() {
const { showDialog, cardData, confMsg } = this.state;
const { showDialog, cardData, confMsg, user, invite_code } = this.state;

const replay = !this.state.winner ? null
: < ReplayScreen winner={this.state.winner} closeReplay={() => this.setState({winner: ''})}/>
const replay = !this.state.winner ? null : (
<ReplayScreen
winner={this.state.winner}
userData={{ name: user.name, inviteCode: invite_code }}
handleUserInit={this.handleUserInit}
closeReplay={this.closeReplay}
/>
);

const dialog = showDialog ? <ConfDialog
message={confMsg}
Expand All @@ -213,6 +244,7 @@ export class App extends Component {
<Switch>
<Route exact path="/" component={StartScreen} />
<Route exact path="/rules" component={RuleList} />
<Route path="/about" component={AboutDevs} />
<Route exact path="/new" render={
/* istanbul ignore next */
() => <NewGame handleUserInit={this.handleUserInit} />} />
Expand Down
2 changes: 2 additions & 0 deletions src/components/Header/_Header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
color: white;
align-items: center;



.new-game-btn {
margin-left: 30px;
padding: 5px 15px;
Expand Down
13 changes: 10 additions & 3 deletions src/components/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ import { NavLink } from 'react-router-dom';

const Header = () => {
return (

<header className="Header">
<div className="header-left">
<h1 className="header-title">CodeWords</h1>
</div>
<nav className="header-right">
<NavLink to="/rules" className="nav-item rules-nav">
<i className="fas fa-question-circle"/>
<NavLink
to="/rules"
title="Rule List"
className="nav-item rules-nav btn-default new-game-btn"
>
Rule List
{/* <i className="fas fa-question-circle" /> */}
</NavLink>
<NavLink to="/about" className="nav-item btn-default new-game-btn">
About Devs
</NavLink>
<NavLink to="/" className="nav-item btn-default new-game-btn">
New Game
Expand Down
5 changes: 4 additions & 1 deletion src/components/JoinGame/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class JoinGame extends Component {
};
fetch(`${API_ROOT}/v1/games/${inviteCode}/players`, option)
.then(response => response.json())
.then(result => { this.props.handleUserInit(result) });
.then(result => {
this.props.handleUserInit(result, inviteCode)
});

this.setState({ redirect: true });
}
Expand All @@ -36,6 +38,7 @@ class JoinGame extends Component {
render() {
if (this.state.redirect) { return <Redirect to='/lobby' /> };


return (
<div className="backdrop">
<section className="StartScreen">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Main/Board/Card/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Card', () => {
expect(wrapper).toMatchSnapshot();
});
it('sendGuess should be called on click of the card', () => {
wrapper = shallow(<Card card={{ type: 'bystander' }} sendGuess={mockFn} isActive={true} card={{ type: false }} />);
wrapper = shallow(<Card sendGuess={mockFn} isActive={true} card={{ type: false }} />);
jest.spyOn(wrapper.instance(), 'handleClick');
let mockEvent = { target: { value: '', name: 'title' }, currentTarget: {value: 3} };

Expand Down
Loading