<!-- component template -->
<template>
  <div data-name="endgame5_stickers" class="page">

    <div class="navbar">
      <div class="navbar-inner">
        <div class="title">{{ $root.appdict.endgame5_title }}</div>
        <div class="right"><i class="fas fa-wifi" style="margin-right: 0.5rem"></i> http://{{publicurl}}</div>
      </div>
    </div>

    <div class="page-content">

      <div class="block-title">{{ $root.appdict.endgame5_title }}</div>
      <div class="block">

        <div class="row">
          <div class="col-40">
            {{ $root.appdict.endgame5_info }}
          </div>
          <div class="col-60">
            {{ screenshot }}
          </div>

        </div>

      </div>

      <div class="block block-strong">
        <div class="row">
          <div class="col-45">
            <button @click="stopSticker" class="button button-large button-outline">{{ $root.appdict.endgame5_btn_stopstickers }}</button>
          </div>

          <div class="col-10"></div>

          <div class="col-45">
            <button @click="endGame" class="button button-large button-outline">{{ $root.appdict.endgame5_btn_endgame }}</button>

          </div>
        </div>
      </div>

    </div>

  </div>
</template>


<style>

</style>


<script>
  // script must return component object
  return {
    data: function () {
      return {
        publicurl: ui.publicUrl,
        screenshot: ui.tmp.screenShot
      }
    },
    methods: {
      endGame: function () {

        framework.dialog.confirm(framework.data.appdict.endgame5_confirm_endgame, framework.data.appdict.endgame5_btn_endgame, function () {
          ipcRenderer.send('ipcF2M_closeApp')
        })

      },
      stopSticker: function () {

        framework.dialog.confirm(framework.data.appdict.endgame5_confirm_stopstickers, framework.data.appdict.endgame5_btn_stopstickers, function () {
          ipcRenderer.send('ipcF2M_stopStickerPlacement')
        })

      }
    },
    on: {
      pageAfterIn: function () {

        ui.timerPause = true

        ui.lastUpdate = Date.now()
        ui.timer += 0.9


        function updatePage() {
          let timerVal = ui.fn.timerUpdate()

        }

        updatePage()
        ipcRenderer.send('ipcF2M_setGameState', 'Endgame5')
        ipcRenderer.send('ipcF2M_endgameInitStickerBoard_pushToClients')



        ui.update = setInterval(updatePage, 500)
        ui.shotUpdate = setInterval(ui.fn.updateScreenShot, 5000)

      },
    }
  }
</script>