<template>
  <div class="layout-default">
    <div class="main-navigation">
      <header-menu />
    </div>
    <div class="ds-container ds-container-x-large">
      <div class="main-container">
        <nuxt />
      </div>
    </div>
    <page-footer class="desktop-footer" />
    <div id="overlay" />
    <div v-if="getShowChat.showChat" class="chat-modul">
      <client-only>
        <chat singleRoom :roomId="getShowChat.roomID" @close-single-room="closeSingleRoom" />
      </client-only>
    </div>
  </div>
</template>

<script>
import { mapGetters, mapMutations } from 'vuex'
import seo from '~/mixins/seo'
import mobile from '~/mixins/mobile'
import HeaderMenu from '~/components/HeaderMenu/HeaderMenu'
import PageFooter from '~/components/PageFooter/PageFooter'
import Chat from '~/components/Chat/Chat.vue'

export default {
  components: {
    HeaderMenu,
    PageFooter,
    Chat,
  },
  mixins: [seo, mobile()],
  computed: {
    ...mapGetters({
      getShowChat: 'chat/showChat',
    }),
  },
  methods: {
    ...mapMutations({
      showChat: 'chat/SET_OPEN_CHAT',
    }),
    closeSingleRoom() {
      this.showChat({ showChat: false, roomID: null })
    },
  },
  beforeCreate() {
    this.$store.commit('chat/SET_OPEN_CHAT', { showChat: false, roomID: null })
  },
}
</script>

<style lang="scss">
.main-navigation {
  background-color: $color-header-background;
}
.main-container {
  padding-top: 6rem;
  padding-bottom: 8rem;
}

@media (max-width: 810px) {
  .desktop-footer {
    display: none;
  }

  .ds-container {
    padding-left: $space-x-small !important;
    padding-right: $space-x-small !important;
  }
}

.chat-modul {
  background-color: rgb(233, 228, 228);
  width: 355px;
  position: fixed;
  bottom: 45px;
  right: 0;
  z-index: 10000;
  .close {
    padding: 10px;
    color: blue;
    cursor: pointer;
  }
}
</style>
