<script setup>
  import CloseIcon from '../assets/icons/close.svg'
</script>

<template>
    <div id="infoMenuContainer" class="uiStyle">
      <div id="welcomeTextContainer">
        <p id="welcomeText">
          Lorem ipsum dolor sit amet consectetur adipiscing elit. Quisque faucibus ex sapien vitae pellentesque sem placerat. In id cursus mi pretium tellus duis convallis. Tempus leo eu aenean sed diam urna tempor. Pulvinar vivamus fringilla lacus nec metus bibendum egestas. Iaculis massa nisl malesuada lacinia integer nunc posuere. Ut hendrerit semper vel class aptent taciti sociosqu. Ad litora torquent per conubia nostra inceptos himenaeos.
          <br>
          <br>
          Lorem ipsum dolor sit amet consectetur adipiscing elit. Quisque faucibus ex sapien vitae pellentesque sem placerat. In id cursus mi pretium tellus duis convallis. Tempus leo eu aenean sed diam urna tempor. Pulvinar vivamus fringilla lacus nec metus bibendum egestas. Iaculis massa nisl malesuada lacinia integer nunc posuere. Ut hendrerit semper vel class aptent taciti sociosqu. Ad litora torquent per conubia nostra inceptos himenaeos.
        </p>
        <button type="button" class="textBtnStyle" @click="openPannel('follow')">NOUS SUIVRE HORS DES RÉSEAUX!</button>
      </div>
      <div id="btnColumn">
        <button type="button" class="iconBtnStyle" id="btnArtist" @click="openPannel('artist')" data-tooltip="à propos de nous">
          <CloseIcon name="test" class="icon"/>
        </button>
        <button type="button" class="iconBtnStyle" id="btnNews" @click="openPannel('news')" data-tooltip="newsletter">
          <CloseIcon name="test" class="icon"/>
        </button>
        <button type="button" class="iconBtnStyle" id="btnInsta" @click="openPannel('insta')" data-tooltip="instagram">
          <CloseIcon name="test" class="icon"/>
        </button>
        <button type="button" class="iconBtnStyle" id="btnContact" @click="openPannel('contact')" data-tooltip="nous contacter">
          <CloseIcon name="test" class="icon"/>
        </button>
      </div>
    </div>
    <!--'msg' 'insta' 'news' 'contact' 'artist' 'follow' 'visual' 'link'-->
    <InboxDiv @open="openPannel('msg')"></InboxDiv>
    <ArtistPan
      v-show="isActive.includes('artist')"
      @openImg = "openPannel('visual')"
      @openLink = "openPannel('link')"
      @close="closePannel('artist')"
      @focus="focusPannel('artist')"
      :class="{zBase: isFocused!=='artist', zFocus: isFocused==='artist'}">
    </ArtistPan>
    <NewsPan
      v-show="isActive.includes('news')"
      @close="closePannel('news')"
      @focus="focusPannel('news')"
      :class="{zBase: isFocused!=='news', zFocus: isFocused==='news'}">
    </NewsPan>
    <ContactPan
      v-show="isActive.includes('contact')"
      @close="closePannel('contact')"
      @focus="focusPannel('contact')"
      :class="{zBase: isFocused!=='contact', zFocus: isFocused==='contact'}">
    </ContactPan>
    <InstaPan
      v-show="isActive.includes('insta')"
      @close="closePannel('insta')"
      @focus="focusPannel('insta')"
      :class="{zBase: isFocused!=='insta', zFocus: isFocused==='insta'}">
    </InstaPan>
    <MessagePan
      v-show="isActive.includes('msg')"
      @close="closePannel('msg')"
      @focus="focusPannel('msg')"
      :class="{zBase: isFocused!=='msg', zFocus: isFocused==='msg'}">
    </MessagePan>
    <FollowPan
      v-show="isActive.includes('follow')"
      @close="closePannel('follow')"
      @focus="focusPannel('follow')"
      :class="{zBase: isFocused!=='follow', zFocus: isFocused==='follow'}">
    </FollowPan>
    <VisualizerPan
      v-show="isActive.includes('visual')"
      @close="closePannel('visual')"
      @focus="focusPannel('visual')"
      :class="{zBase: isFocused!=='visual', zFocus: isFocused==='visual'}">
    </VisualizerPan>
    <LinkPan
      v-show="isActive.includes('link')"
      @close="closePannel('link')"
      @focus="focusPannel('link')"
      :class="{zBase: isFocused!=='link', zFocus: isFocused==='link'}">
    </LinkPan>
</template>

<style scoped>
  /*================= Mise en page:
    => Mobile First : par défaut, moins de 500px
    => Tablette et PC format haut : de 500 à 1000px
    => PC large : à partir de 1000px
  */

  /*+++++++++++++++++ COPYBOX
      ================ PC HAUT/IPAD
      @media(min-width:500px){}
      ================ PC LARGE
      @media(min-width:1000px){}
  */

  #infoMenuContainer{
    width:100%;
    position:relative;
    height:40%;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-start;
  }

  #btnColumn{
    width:15%;
    height:100%;
    background-color: transparent;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;

  }

  #btnColumn .iconBtnStyle{
    width:100%;
    height:20%;
    margin-left: -13.12%;
    margin-top: 19%;
  }

  #btnColumn .icon{
    width: 33px;
  }

  #welcomeTextContainer{
    width:77%;
    height:100%;
    background-color: transparent;
    position: relative;
    padding: 16.1px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
  }

  #welcomeText{
    overflow-y: scroll;
    height: 73%;
    font-size: 16.1px;
    font-family: 'velvelyne';
    color: var(--main-color);
    font-weight: bold;
    padding-right: 16.1px;
    margin-top: -7.77px;
  }

  #welcomeTextContainer .textBtnStyle{
    height:44.4px;
    width: 70%;
  }

  /*================ MID FORMAT*/
  @media(min-width:500px){
    #welcomeText{
      height:72%;
    }

    #btnColumn .iconBtnStyle{
      height:20%;
      margin-left: 0;
      margin-top: 7.77%;
    }

  }

  /*================ PC LARGE*/
  @media(min-width:1300px){
    #welcomeText{
      height:71%;
    }

    #btnColumn .iconBtnStyle{
      height:20%;
      margin-left: -13.12%;
      margin-top: 13.12%;
    }

  }
</style>

<script>
  export default {
    name : 'InfoMenu',
    data(){
      return{
        isActive: [],
        isFocused: ""
      }
    },
    methods:{
      openPannel(name){
        console.log(name);
        if(!this.isActive.includes(name)){
          this.isActive.push(name);
        }
        this.isFocused = name;
      },
      focusPannel(name){
        if(this.isActive.includes(name)){
          this.isFocused = name;
        }
      },
      closePannel(name){
        const index = this.isActive.indexOf(name)
        if(index !== -1){
          this.isActive.splice(index,1);
        }
        if(this.isFocused === name){
          this.isFocused = null;
        }
      }
    },
    mounted(){
      console.log("Info menu is loaded!");
    }
  };
</script>
