<template>
  <div class="home-page-container">
    <HomepageHeromodule />

    <TemplateContainer size="l">
      <HomepageDashboard />
    </TemplateContainer>
  </div>
</template>

<script>
import { storage } from '@inside-library/helpers/Storage'

import HomepageHeromodule from '../components/homepage/HomepageHeromodule'
import HomepageDashboard from '../components/homepage/HomepageDashboard'
import TemplateContainer from '@inside-commons/components/lib/TemplateContainer'

export default {
  name: 'HomePage',
  $_i18nRootPath: 'customs.HOMEPAGE',
  components: {
    HomepageHeromodule,
    HomepageDashboard,
    TemplateContainer
  },
  created() {
    if (
      !storage.get('toaster') &&
      this.getStore('getUserInformation', 'client') &&
      this.getUserInfos.is_key_account_manager
    ) {
      const client = this.getStore('getUserInformation', 'client')
      const clientTitle = typeof client === 'string' ? client : client.title

      this.$_triggerSuccessToast({
        title: this.$_tr('client', [clientTitle]),
        text: this.$_tr('site', [
          this.getStore('getUserInformation', 'site').title
        ]),
        duration: -100
      })

      storage.set('toaster', 'true')
    }
  }
}
</script>
