2020-03-26 19:04:23 +01:00
< template >
2020-03-30 14:26:19 +02:00
< v-app class = "srd" >
2020-03-30 11:03:20 +02:00
2020-05-15 15:48:51 +02:00
< v-overlay :value = "$store.state.loading" >
< v-progress-circular indeterminate size = "64" > < / v-progress-circular >
< / v-overlay >
2020-04-11 18:01:59 +02:00
< NavDrawer class = "d-print-none" / >
< RightDrawer class = "d-print-none" v-if = "hasRightDrawer" / >
2020-03-26 19:04:23 +01:00
2020-04-11 18:01:59 +02:00
< Navbar class = "d-print-none" / >
2020-03-26 19:04:23 +01:00
2020-03-28 10:42:54 +01:00
< v-content >
2020-04-15 16:27:16 +02:00
< v-container fluid ref = "container" >
2020-03-30 11:03:20 +02:00
< v-row align = "start" justify = "center" >
< v-col cols = "12" >
< DefaultGlobalLayout / >
< / v-col >
2020-03-28 10:42:54 +01:00
< / v-row >
2020-04-23 09:42:35 +02:00
2020-03-28 10:42:54 +01:00
< / v-container >
2020-04-23 11:39:57 +02:00
2020-04-23 11:42:40 +02:00
< v-btn v-show = "$vuetify.breakpoint.lgAndUp && $store.state.hasRightDrawer" color="primary" @click.stop="setRightDrawer" :class="rightDrawerButtonCSS()" small top right fixed fab >
2020-04-23 11:39:57 +02:00
< v-icon v-if = "$store.state.rightDrawer" > mdi -chevron -right < / v-icon >
< v-icon v -else left > mdi - chevron - left < / v-icon >
< / v-btn >
2020-04-23 09:42:35 +02:00
< v-fab-transition >
< v-btn color = "primary" class = "d-print-none" fab bottom right fixed @click ="toTop" v-show = "toTopButton" v-scroll="onScroll" >
< v-icon class = "d-print-none" > mdi - chevron - up < / v-icon >
< / v-btn >
< / v-fab-transition >
2020-03-28 10:42:54 +01:00
< / v-content >
2020-04-17 17:04:03 +02:00
2020-04-18 15:27:29 +02:00
< v-bottom-sheet v-model = "cookieConsentDialog" persistent >
< v-sheet class = "text-center" tile >
< div class = "py-3" > Ce site utilise des cookies pour son bon fonctionnement et pour l ' analyse de la fréquentation . Sans ces cookies , vous ne pourriez pas écrire vos sorts dans votre grimoire ou recruter tous ces monstres pour garnir votre repaire maléfique . < / div >
< v-btn class = "my-6" color = "primary" @click ="setCookieConsent" > Compris < / v-btn >
< / v-sheet >
< / v-bottom-sheet >
2020-05-23 10:05:33 +02:00
< v-snackbar v-model = "$store.state.isOpenSnackbar" >
{ { $store . state . snackbarText } }
2020-05-23 11:17:42 +02:00
< v-btn color = "red" text @ click = "$store.commit('setIsOpenSnackbar', false)" >
2020-05-23 10:05:33 +02:00
Fermer
< / v-btn >
< / v-snackbar >
2020-06-10 19:14:34 +02:00
< v-dialog v-model = "$store.state.isOpenShareHomebrewDialog" @click:outside="$store.commit('setIsOpenShareHomebrewDialog', !$store.state.isOpenShareHomebrewDialog)" max-width="600" >
< v-card >
< v-card-title class = "headline d-flex justify-space-between" >
< span > Partage < / span > < / span >
< v-btn color = "primary" icon @ click = "$store.commit('setIsOpenShareHomebrewDialog', !$store.state.isOpenShareHomebrewDialog)" > < v-icon > mdi - close < / v-icon > < / v-btn >
< / v-card-title >
< v-card-text >
2020-06-11 10:13:25 +02:00
< v-text-field id = "copy-uri" outlined readonly label = "Copiez le lien pour partager" :hint = "hintCopied" : value = "$site.themeConfig.domain + '/homebrew/?h=' + $store.state.shareURI" append -outer -icon = " mdi -content -copy " @click:append-outer ="copyURI('copy-uri')" > < / v-text-field >
2020-06-10 19:14:34 +02:00
< div class = "text-center" >
2020-06-11 10:13:25 +02:00
< v-btn color = "accent" depressed link : to = "{ path: '/homebrew/', query: { h: $store.state.shareURI }}" @ click = "$store.commit('setIsOpenShareHomebrewDialog', !$store.state.isOpenShareHomebrewDialog)" > Voir la page < / v-btn >
2020-06-10 19:14:34 +02:00
< / div >
< / v-card-text >
< / v-card >
< / v-dialog >
2020-03-28 10:42:54 +01:00
< / v-app >
2020-03-26 19:04:23 +01:00
< / template >
< script >
import GlobalLayout from '@app/components/GlobalLayout.vue'
import Navbar from '@theme/components/Navbar.vue'
2020-03-30 11:03:20 +02:00
import NavDrawer from '@theme/components/NavDrawer.vue'
2020-04-01 19:34:06 +02:00
import RightDrawer from '@theme/components/RightDrawer.vue'
2020-04-15 16:27:16 +02:00
import Vue from 'vue'
import RuleTooltip from '@theme/global-components/RT'
2020-04-18 15:27:29 +02:00
import Cookies from 'js-cookie'
2020-03-26 19:04:23 +01:00
export default {
name : 'GlobalLayout' ,
components : {
DefaultGlobalLayout : GlobalLayout ,
2020-03-30 11:03:20 +02:00
Navbar ,
2020-04-01 19:34:06 +02:00
NavDrawer ,
RightDrawer
2020-03-26 19:04:23 +01:00
} ,
2020-04-23 11:39:57 +02:00
computed : {
} ,
2020-03-26 19:04:23 +01:00
data ( ) {
return {
2020-04-18 15:27:29 +02:00
cookieConsentDialog : true ,
2020-06-10 19:14:34 +02:00
toTopButton : false ,
hintCopied : ''
2020-03-26 19:04:23 +01:00
}
} ,
computed : {
2020-04-17 17:04:03 +02:00
footerCSS ( ) {
let css = ''
if ( this . $store . state . drawer ) {
css += ' footer-padding-left'
}
if ( this . $store . state . rightDrawer ) {
css += ' footer-padding-right'
}
return css
} ,
2020-04-01 19:34:06 +02:00
hasRightDrawer ( ) {
return this . $store . state . hasRightDrawer
}
2020-03-26 19:04:23 +01:00
} ,
mounted ( ) {
2020-05-15 15:48:51 +02:00
this . $store . commit ( 'setLoading' , false ) // Page chargée
2020-04-11 18:01:59 +02:00
this . $store . commit ( 'setDrawer' , this . $vuetify . breakpoint . lgAndUp )
2020-04-18 15:27:29 +02:00
// Cookie consent
const COOKIECONSENT = Cookies . get ( 'heros-et-dragons-cookies' )
if ( COOKIECONSENT == 'compris' ) {
this . cookieConsentDialog = false
}
2020-06-10 10:30:32 +02:00
// Dark theme
2020-04-18 15:27:29 +02:00
const THEMEISDARK = Cookies . get ( 'heros-et-dragons-is-dark' )
if ( THEMEISDARK === 'true' ) {
this . $vuetify . theme . dark = true
}
2020-04-22 11:17:05 +02:00
2020-06-10 10:30:32 +02:00
// Variante 5 royaumes pour les monstres
const L5R = Cookies . get ( 'heros-et-dragons-l5r' )
this . $store . state . l5r = L5R
2020-04-22 11:17:05 +02:00
// Chargement des donées utilisateur depuis le navigateur
this . $store . commit ( 'mySpells/initialiseStore' )
this . $store . commit ( 'myMonsters/initialiseStore' )
this . $store . commit ( 'myMagicItems/initialiseStore' )
2020-05-15 15:48:51 +02:00
// Loading feedback
this . $router . beforeEach ( ( to , from , next ) => {
if ( to . path !== from . path && ! Vue . component ( to . name ) ) {
this . $store . commit ( 'setLoading' , true )
}
next ( )
} )
this . $router . afterEach ( ( ) => {
this . $store . commit ( 'setLoading' , false )
} )
2020-03-26 19:04:23 +01:00
} ,
methods : {
2020-04-18 15:27:29 +02:00
setCookieConsent ( ) {
Cookies . set ( 'heros-et-dragons-cookies' , 'compris' )
this . cookieConsentDialog = false
2020-04-23 09:42:35 +02:00
} ,
onScroll ( e ) {
if ( typeof window === 'undefined' ) return
const top = window . pageYOffset || e . target . scrollTop || 0
this . toTopButton = top > 20
} ,
toTop ( ) {
this . $vuetify . goTo ( 0 )
2020-04-23 11:39:57 +02:00
} ,
rightDrawerButtonCSS ( ) {
if ( this . $store . state . rightDrawer ) {
return 'right-drawer-button right-drawer-button-open'
}
return 'right-drawer-button right-drawer-button-close'
} ,
setRightDrawer ( ) {
this . $store . commit ( 'setRightDrawer' , ! this . $store . state . rightDrawer )
} ,
2020-06-10 19:14:34 +02:00
copyURI ( id ) {
let toCopy = document . getElementById ( id )
toCopy . select ( )
document . execCommand ( 'copy' )
this . hintCopied = "L'adresse a été copiée dans le presse-papier"
let self = this
setTimeout ( function ( ) {
self . hintCopied = ''
} , 2000 )
}
2020-03-26 19:04:23 +01:00
}
}
< / script >
2020-04-17 17:04:03 +02:00
< style lang = "scss" >
. footer - padding - left {
padding - left : 300 px ;
}
. footer - padding - right {
padding - right : 300 px ;
}
2020-04-23 11:39:57 +02:00
. right - drawer - button {
top : 150 px ! important ;
}
. right - drawer - button - open {
right : 280 px ! important ;
}
. right - drawer - button - close {
right : - 20 px ! important ;
}
2020-04-17 17:04:03 +02:00
< / style >