<template>
  <div
    v-if="
      ((tools.getLinkUserTelegramByUser(myuser) ||
        (myuser.email && tools.isEmailVerifiedByUser(myuser))) &&
        tools.isUserOk(true)) ||
      showBtnActivities
    "
    class=""
  >
    <q-inner-loading id="spinner" :showing="loading">
      <q-spinner-tail color="primary" size="4em"> </q-spinner-tail>
    </q-inner-loading>
    <div class="row justify-center items-center q-ma-xs">
      <div class="q-pa-xs">
        <q-btn
          v-if="
            showBtnActivities && site.confpages && site.confpages.showCompetenze
          "
          icon="fas fa-house-user"
          size="md"
          color="orange"
          rounded
          :label="$t('profile.myactivities')"
          :to="`/my/` + myuser.username"
        >
        </q-btn>
      </div>
      <div class="q-pa-xs">
        <q-btn
          v-if="showBtnRis"
          icon-right="img: /images/1ris_rosso_100.png"
          color="green"
          size="md"
          :label="$t('circuit.sendcoins')"
          rounded
          @click="showsendCoinTo = true"
        >
        </q-btn>
      </div>
      <div class="q-pa-xs">
        <q-btn
          v-if="tools.getLinkUserTelegramByUser(myuser) && tools.isUserOk(true)"
          icon="fab fa-telegram"
          color="blue"
          :type="tools.isUserOk(true) ? 'a' : 'btn'"
          size="md"
          rounded
          :label="$t('dialog.contact')"
          :href="
            tools.isUserOk(true) ? tools.getLinkUserTelegramByUser(myuser) : null
          "
          @click="
            !tools.isUserOk(true) ? (showingtooltip = !showingtooltip) : false
          "
          target="__blank"
        >
        </q-btn>
        <div
          v-else-if="myuser.email && !tools.isUsernameTelegOkByUser(myuser)"
          class="row justify-center q-ma-sx"
        >
          <div>
            <CLabel
              v-bind="$attrs"
              :copy="true"
              :value="
                !tools.isUsernameTelegOkByUser(myuser) ? myuser.email : ''
              "
              :label="$t('reg.email')"
            />
          </div>
          <div>
            <q-btn
              outline
              icon="fas fa-envelope"
              :color="$q.dark.isActive ? `white` : `black`"
              :type="tools.isUserOk() ? 'a' : 'btn'"
              size="md"
              :label="$t('msgs.write_email')"
              :href="tools.isUserOk() ? tools.getemailto(myuser.email) : null"
              @click="
                !tools.isUserOk() ? (showingtooltip = !showingtooltip) : false
              "
              target="__blank"
            >
            </q-btn>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div v-if="showsendCoinTo || sendRIS">
    <CSendCoins
      :showprop="showsendCoinTo"
      :to_user="myuser"
      :sendRIS="sendRIS"
      :causalDest="causalDest"
      :circuitname="circuitSel"
      @close="
        showsendCoinTo = false;
        loading = false;
      "
      @showed="showed"
    >
    </CSendCoins>
  </div>
</template>

<script lang="ts" src="./CContactUser.ts">
</script>

<style lang="scss" scoped>
@import "./CContactUser.scss";
</style>
