Skip to content

Commit

Permalink
Add 'review' button for press uers
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Jul 1, 2016
1 parent c4eb0e2 commit 4493c7c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
20 changes: 13 additions & 7 deletions appsrc/components/game-actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,30 @@ const makeMapStateToProps = () => {
downloadKeys: (state, props) => state.market.downloadKeys,
task: (state, props) => state.tasks.tasksByGameId[props.game.id],
download: (state, props) => state.downloads.downloadsByGameId[props.game.id],
meId: (state, props) => (state.session.credentials.me || {id: 'anonymous'}).id
meId: (state, props) => (state.session.credentials.me || {id: 'anonymous'}).id,
mePress: (state, props) => (state.session.credentials.me || {pressUser: false}).pressUser
}),
(happenings) => {
const {game, cave, downloadKeys, task, download, meId} = happenings
const {game, cave, downloadKeys, task, download, meId, mePress} = happenings

const animate = false
let action = ClassificationActions[game.classification] || 'launch'
// TODO: finish implementing that
// if (cave && cave.upload && cave.upload.demo) {
// action += '_demo'
// }

const platformCompatible = (action === 'open' ? true : isPlatformCompatible(game))
const cancellable = false
const downloadKey = downloadKeys::findWhere({gameId: game.id})
const hasMinPrice = game.minPrice > 0
// FIXME game admins
const canEdit = game.userId === meId
const mayDownload = !!(downloadKey || !hasMinPrice || canEdit)
console.log(`for ${game.title}, game press? ${game.inPressSystem}, we press? ${mePress}`)
let mayDownload = !!(downloadKey || !hasMinPrice || canEdit)
let pressDownload = false
if (!mayDownload) {
pressDownload = (game.inPressSystem && mePress)
if (pressDownload) {
mayDownload = true
}
}
const canBeBought = game.canBeBought

const downloading = download && !download.finished
Expand All @@ -108,6 +113,7 @@ const makeMapStateToProps = () => {
mayDownload,
canBeBought,
downloadKey,
pressDownload,
platformCompatible,
action,
task: (task ? task.name : (downloading ? 'download' : (cave ? 'idle' : null))),
Expand Down
4 changes: 2 additions & 2 deletions appsrc/components/game-actions/main-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const linearGradient = (progress) => {

class MainAction extends Component {
render () {
const {t, cancellable, platform, platformCompatible, mayDownload, canBeBought, progress, task, action, animate} = this.props
const {t, cancellable, platform, platformCompatible, mayDownload, pressDownload, canBeBought, progress, task, action, animate} = this.props

let child = ''
if (task) {
Expand All @@ -35,7 +35,7 @@ class MainAction extends Component {
if (mayDownload) {
child = <span className='state'>
<Icon icon='install'/>
{t('grid.item.install')}
{t('grid.item.' + (pressDownload ? 'review' : 'install'))}
</span>
} else if (canBeBought) {
child = <span className='state'>
Expand Down
1 change: 1 addition & 0 deletions appsrc/static/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"grid.item.downloading": "Downloading…",
"grid.item.finalize_installation": "Finalize install",
"grid.item.install": "Install",
"grid.item.review": "Review",
"grid.item.installing": "Installing...",
"grid.item.launch": "Launch",
"grid.item.launch_demo": "Launch demo",
Expand Down
4 changes: 4 additions & 0 deletions appsrc/style/pages/_hub.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
width: $grid-item-width;
margin: .5em;
cursor: default;

.main-action {
@include single-line;
}
}

.hub-filler {
Expand Down

0 comments on commit 4493c7c

Please sign in to comment.