2018-10-19 05:15:28 +00:00
|
|
|
<template lang="html">
|
2019-01-11 20:20:21 +00:00
|
|
|
<div>
|
|
|
|
<game-detail-placeholder v-if="!game" />
|
2018-10-25 06:33:15 +00:00
|
|
|
|
2019-01-11 20:20:21 +00:00
|
|
|
<div class="game-detail" v-else :class="{ dark: darkModeEnabled }">
|
|
|
|
<div class="game-hero" :style="style" />
|
2018-11-24 20:50:27 +00:00
|
|
|
|
2019-01-11 20:20:21 +00:00
|
|
|
<div class="game-detail-container">
|
|
|
|
<div class="game-info">
|
|
|
|
<game-header />
|
2018-10-26 05:15:37 +00:00
|
|
|
|
2019-02-08 17:34:05 +00:00
|
|
|
<div class="game-details">
|
2019-01-11 20:20:21 +00:00
|
|
|
<h2>{{ game.name }}</h2>
|
2019-02-08 06:13:48 +00:00
|
|
|
<game-rating :rating="game.rating" />
|
2019-01-11 20:20:21 +00:00
|
|
|
<p class="game-description" v-html="game.summary" />
|
|
|
|
<affiliate-link />
|
|
|
|
<game-review-box />
|
|
|
|
</div>
|
2018-10-19 05:15:28 +00:00
|
|
|
|
2019-01-11 20:20:21 +00:00
|
|
|
</div>
|
2018-10-25 06:33:15 +00:00
|
|
|
|
2019-01-11 20:20:21 +00:00
|
|
|
<game-screenshots />
|
|
|
|
<game-videos />
|
2019-02-06 06:55:00 +00:00
|
|
|
<igdb-credit gray />
|
2018-10-19 05:15:28 +00:00
|
|
|
</div>
|
2018-11-25 03:39:15 +00:00
|
|
|
</div>
|
2018-10-19 05:15:28 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-12-21 21:52:11 +00:00
|
|
|
import { mapState, mapGetters } from 'vuex';
|
2018-10-19 05:15:28 +00:00
|
|
|
import GameHeader from '@/components/GameDetail/GameHeader';
|
|
|
|
import GameScreenshots from '@/components/GameDetail/GameScreenshots';
|
2019-02-08 06:13:48 +00:00
|
|
|
import GameRating from '@/components/GameDetail/GameRating';
|
2018-10-19 05:15:28 +00:00
|
|
|
import GameVideos from '@/components/GameDetail/GameVideos';
|
|
|
|
import GameReviewBox from '@/components/GameDetail/GameReviewBox';
|
2018-12-24 20:45:50 +00:00
|
|
|
import AffiliateLink from '@/components/GameDetail/AffiliateLink';
|
2019-02-06 06:55:00 +00:00
|
|
|
import IgdbCredit from '@/components/IgdbCredit/IgdbCredit';
|
2019-01-11 20:20:21 +00:00
|
|
|
import GameDetailPlaceholder from '@/components/GameDetail/GameDetailPlaceholder';
|
2018-10-19 05:15:28 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2019-02-06 06:55:00 +00:00
|
|
|
IgdbCredit,
|
2018-10-19 05:15:28 +00:00
|
|
|
GameHeader,
|
2019-02-08 06:13:48 +00:00
|
|
|
GameRating,
|
2018-10-19 05:15:28 +00:00
|
|
|
GameScreenshots,
|
|
|
|
GameVideos,
|
|
|
|
GameReviewBox,
|
2018-12-24 20:45:50 +00:00
|
|
|
AffiliateLink,
|
2019-01-11 20:20:21 +00:00
|
|
|
GameDetailPlaceholder,
|
2018-10-19 05:15:28 +00:00
|
|
|
},
|
|
|
|
|
2019-02-06 06:55:00 +00:00
|
|
|
props: {
|
|
|
|
id: [Number, String],
|
|
|
|
},
|
|
|
|
|
2018-10-19 05:15:28 +00:00
|
|
|
computed: {
|
2018-12-21 21:52:11 +00:00
|
|
|
...mapState(['game', 'platform']),
|
|
|
|
...mapGetters(['darkModeEnabled']),
|
2018-11-24 20:50:27 +00:00
|
|
|
|
|
|
|
style() {
|
|
|
|
return this.game && this.game.screenshots
|
|
|
|
? `background: url(${this.getImageUrl(this.game.screenshots[0].cloudinary_id)}) center center no-repeat; background-size: cover;`
|
|
|
|
: '';
|
|
|
|
},
|
2018-10-19 05:15:28 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
2019-02-06 06:55:00 +00:00
|
|
|
this.loadGame(this.id);
|
2018-10-19 05:15:28 +00:00
|
|
|
},
|
2018-10-29 23:53:49 +00:00
|
|
|
|
2018-11-17 22:21:29 +00:00
|
|
|
methods: {
|
2018-11-24 20:50:27 +00:00
|
|
|
getImageUrl(cloudinaryId) {
|
|
|
|
return cloudinaryId
|
|
|
|
? `https://images.igdb.com/igdb/image/upload/t_screenshot_huge/${cloudinaryId}.jpg`
|
|
|
|
: null;
|
|
|
|
},
|
|
|
|
|
2018-11-17 22:21:29 +00:00
|
|
|
loadGame(gameId) {
|
2019-02-06 06:55:00 +00:00
|
|
|
this.$store.commit('CLEAR_ACTIVE_GAME');
|
|
|
|
|
2018-11-17 22:21:29 +00:00
|
|
|
this.$store.dispatch('LOAD_GAME', gameId)
|
|
|
|
.then(() => {
|
|
|
|
this.$ga.event({
|
|
|
|
eventCategory: 'game',
|
|
|
|
eventAction: 'view',
|
|
|
|
eventLabel: 'gameViewed',
|
|
|
|
eventValue: `${this.platform.name} - ${this.game.name}`,
|
|
|
|
});
|
2018-11-18 22:27:47 +00:00
|
|
|
|
|
|
|
document.title = `${this.game.name} (${this.platform.name}) - Gamebrary`;
|
2018-11-17 22:21:29 +00:00
|
|
|
})
|
|
|
|
.catch(() => {
|
2019-02-05 07:31:40 +00:00
|
|
|
this.$bus.$emit('TOAST', { message: 'Error loading game', type: 'error' });
|
2018-11-17 22:21:29 +00:00
|
|
|
});
|
|
|
|
},
|
2018-10-29 23:53:49 +00:00
|
|
|
},
|
2018-10-19 05:15:28 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" rel="stylesheet/scss" scoped>
|
|
|
|
@import "~styles/styles.scss";
|
|
|
|
|
2018-10-25 06:33:15 +00:00
|
|
|
.game-detail {
|
|
|
|
display: flex;
|
2018-11-25 03:39:15 +00:00
|
|
|
justify-content: center;
|
2018-11-24 20:50:27 +00:00
|
|
|
background: $color-light-gray;
|
|
|
|
min-height: calc(100vh - #{$navHeight});
|
2018-11-02 01:42:43 +00:00
|
|
|
|
|
|
|
&.dark {
|
2019-01-17 06:23:34 +00:00
|
|
|
background: $color-darkest-gray;
|
|
|
|
|
2018-11-25 03:39:15 +00:00
|
|
|
.game-detail-container {
|
2019-01-17 06:23:34 +00:00
|
|
|
background: $color-darkest-gray;
|
2018-11-02 01:42:43 +00:00
|
|
|
color: $color-gray;
|
|
|
|
}
|
|
|
|
}
|
2018-10-19 05:15:28 +00:00
|
|
|
}
|
|
|
|
|
2018-11-24 20:50:27 +00:00
|
|
|
.game-hero {
|
|
|
|
background-color: $color-dark-gray;
|
|
|
|
position: absolute;
|
|
|
|
width: 100%;
|
|
|
|
left: 0;
|
2019-02-06 06:55:00 +00:00
|
|
|
border-top-left-radius: $border-radius;
|
|
|
|
border-top-right-radius: $border-radius;
|
2018-11-24 20:50:27 +00:00
|
|
|
height: 400px;
|
|
|
|
z-index: 1;
|
2018-11-25 03:39:15 +00:00
|
|
|
|
|
|
|
@media($small) {
|
|
|
|
background: none !important;
|
|
|
|
}
|
2018-11-24 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
2019-02-08 17:34:05 +00:00
|
|
|
.game-details {
|
|
|
|
margin-top: $gp;
|
2019-02-08 06:13:48 +00:00
|
|
|
}
|
|
|
|
|
2018-10-25 06:33:15 +00:00
|
|
|
.game-info {
|
2018-10-26 05:15:37 +00:00
|
|
|
display: grid;
|
2018-11-24 20:50:27 +00:00
|
|
|
grid-template-columns: 180px auto;
|
2018-10-26 05:15:37 +00:00
|
|
|
grid-gap: $gp * 2;
|
2018-10-25 06:33:15 +00:00
|
|
|
margin: 0 $gp;
|
|
|
|
|
2018-10-26 05:15:37 +00:00
|
|
|
@media($small) {
|
2018-11-24 20:50:27 +00:00
|
|
|
grid-gap: 0;
|
2018-10-26 05:15:37 +00:00
|
|
|
grid-template-columns: 1fr;
|
2018-11-24 20:50:27 +00:00
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
.game-description {
|
|
|
|
text-align: justify;
|
|
|
|
}
|
2018-10-26 05:15:37 +00:00
|
|
|
}
|
|
|
|
|
2018-10-25 06:33:15 +00:00
|
|
|
.game-description {
|
2018-10-26 05:15:37 +00:00
|
|
|
line-height: 1.4rem;
|
2018-10-25 06:33:15 +00:00
|
|
|
}
|
2018-10-19 05:15:28 +00:00
|
|
|
}
|
|
|
|
|
2018-11-25 03:39:15 +00:00
|
|
|
.game-detail-container {
|
2018-11-24 20:50:27 +00:00
|
|
|
background-color: rgba(255, 255, 255, 0.95);
|
|
|
|
-webkit-box-shadow: 0 0 2px 0 $color-gray;
|
|
|
|
box-shadow: 0 0 2px 0 $color-gray;
|
2018-10-29 23:53:49 +00:00
|
|
|
width: $container-width;
|
2018-10-26 05:15:37 +00:00
|
|
|
max-width: 100%;
|
2018-11-24 20:50:27 +00:00
|
|
|
z-index: 1;
|
2019-02-06 06:55:00 +00:00
|
|
|
margin: $gp * 3;
|
2018-10-25 06:33:15 +00:00
|
|
|
border-radius: $border-radius;
|
|
|
|
|
|
|
|
@media($small) {
|
|
|
|
margin: 0;
|
2018-10-19 05:15:28 +00:00
|
|
|
}
|
|
|
|
}
|
2018-10-25 06:33:15 +00:00
|
|
|
|
|
|
|
.igdb-credit {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
flex-direction: column;
|
|
|
|
padding: $gp;
|
|
|
|
}
|
2018-10-19 05:15:28 +00:00
|
|
|
</style>
|