Skip to content

Commit

Permalink
invite link box
Browse files Browse the repository at this point in the history
  • Loading branch information
johngibbons committed Feb 21, 2016
1 parent 89e982a commit a2a3309
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 12 deletions.
38 changes: 38 additions & 0 deletions sass/components/game_share_box.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.game-share-box {
width: 400px;
max-width: 100%;
margin: 2rem auto;
padding: 1rem;
background: linear-gradient(to bottom right, white, lighten($brand-primary, 35%));
border: 1px solid $brand-primary;
border-radius: 3px;
text-align: center;

.text {
margin-bottom: 0.5rem;
color: $brand-primary;

.sub-text {
font-size: 0.6rem;
}

}

input {
border: 1px solid lighten($brand-primary, 30%);
cursor: text;
border-radius: 3px;
box-shadow: none;
border-image: none;
color: lighten($brand-primary, 10%);
font-size: 0.8rem;
text-align: center;
width: 100%;
padding: 0.5rem;

&::selection {
background-color: $gray-dark;
color: white;
}
}
}
1 change: 1 addition & 0 deletions sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
@import 'components/charts';
@import 'components/login_modal';
@import 'components/entry';
@import 'components/game_share_box';

body {
font-family: $font-family-base;
Expand Down
19 changes: 19 additions & 0 deletions src/components/GameShareBox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';

const GameShareBox = ({url}) => {
return (
<div className='game-share-box'>
<div className='text'>
Invite Friends To Play With This Link
<div className='sub-text'>(click to select)</div>
</div>
<input
value={url}
readOnly
onClick={(e) => e.target.setSelectionRange(0, e.target.value.length)}
/>
</div>
);
};

export default GameShareBox;
4 changes: 4 additions & 0 deletions src/components/GameShow.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Link} from 'react-router';
import {colors} from '../constants';

import EntriesList from './EntriesList';
import GameShareBox from './GameShareBox';
import ScoreDashboard from './ScoreDashboard';

const GameShow = ({
Expand All @@ -16,11 +17,14 @@ const GameShow = ({
totalPossible,
currentPossible,
toggleLoginModal,
hasGameStarted,
onClickEntry
}) => {
return (
<div>
<div className='container game-show'>
{!hasGameStarted &&
<GameShareBox url={location.href} />}
<EntriesList
entries={entries}
currentUserEntry={currentUserEntry}
Expand Down
3 changes: 1 addition & 2 deletions src/components/UserGames.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import React from 'react';
import {colors} from '../constants';
import calculateTotalPossible from '../helpers/calculate_total_possible';
import calculateCurrentPossible from '../helpers/calculate_current_possible';
import classNames from 'ClassNames';
import classNames from 'classnames';

import TitleBar from './TitleBar';

const UserGames = ({
user,
currentUser,
gamesOwned,
gamesPlaying,
onClickGame,
questionsById
Expand Down
1 change: 0 additions & 1 deletion src/containers/GameContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class GameContainer extends React.Component {
render() {
const {
currentUser,
location,
currentUserEntry,
toggleLoginModal,
game,
Expand Down
9 changes: 0 additions & 9 deletions src/containers/UserContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ class UserContainer extends React.Component {

}

function getGamesOwned(user, allGames) {
return Object.keys(allGames).filter((id) => {
return allGames[id].user === user.id;
}).map((id) => {
return allGames[id];
});
}

function getGamesPlaying(user, allGames, allEntries) {
return Object.keys(allEntries).filter((id) => {
return allEntries[id].user === user.id;
Expand All @@ -83,7 +75,6 @@ function mapStateToProps(state) {
currentUser: state.client.currentUser,
usersById: state.remote.usersById,
questionsById: state.remote.questionsById,
gamesOwned: getGamesOwned(state.client.currentUser, state.remote.gamesById),
gamesPlaying: getGamesPlaying(
state.client.currentUser,
state.remote.gamesById,
Expand Down

0 comments on commit a2a3309

Please sign in to comment.