<template>

  <div class="row justify-evenly items-center q-pa-sm q-ma-sm">
    <div class="q-ma-sx">
      <q-btn
        v-if="getLinkUserTelegram()"
        icon="fab fa-telegram"
        color="blue"
        :type="tools.isUserOk() ? 'a' : 'btn'"
        size="md"
        rounded
        :label="$t('msgs.telegrammsg')"
        :href="tools.isUserOk() ? getLinkUserTelegram() : null"
        @click="!tools.isUserOk() ? (showingtooltip = !showingtooltip) : false"
        target="__blank"
      >
      </q-btn>
      <div v-else-if="myuser.email" class="row q-ma-sx">
        <CLabel
          v-bind="$attrs"
          :copy="true"
          :value="tools.isUserOk() ? myuser.email : ''"
          :label="$t('reg.email')"
        />

        <q-btn
          outline
          icon="fas fa-envelope"
          :color="$q.dark.isActive ? `shite` : `black`"
          :type="tools.isUserOk() ? 'a' : 'btn'"
          size="md"
          :label="$t('msgs.send_email')"
          :href="tools.isUserOk() ? tools.getemailto(myuser.email) : null"
          @click="
            !tools.isUserOk() ? (showingtooltip = !showingtooltip) : false
          "
          target="__blank"
        >
        </q-btn>
      </div>
    </div>
    <div class="q-ma-sx">
      <q-btn
        v-if="
            userStore.getMyCircuitsInCommonByUser(myuser).length > 0 &&
            ((myuser.username !== userStore.my.username) || userStore.hoContiCollettiviDaAmministrare())
        "
        icon="fas fa-coins"
        color="green"
        size="md"
        rounded
        :label="$t('circuit.sendcoins')"
        @click="showsendCoinTo = true"
      >
      </q-btn>
    </div>
    <div v-if="myuser._id" class="q-ma-sx">
      <q-btn
        v-if="getLinkWebSite()"
        icon="fas fa-globe"
        color="blue"
        type="a"
        size="md"
        rounded
        :label="$t('reg.website')"
        :href="tools.isUserOk() ? getLinkWebSite() : null"
        @click="!tools.isUserOk() ? (showingtooltip = !showingtooltip) : false"
        target="__blank"
      >
      </q-btn>
    </div>
  </div>
  <div class="myrow justify-evenly items-center q-pa-sm q-ma-sm">
    <div v-if="myuser._id" class="col-12">
      <q-btn
        v-if="myuser.username === myusername()"
        icon="fas fa-link"
        color="blue"
        size="md"
        rounded
        :label="$t('reg.link_reg_and_msg')"
        @click="
          tools.sendMsgTelegramCmd(
            $q,
            $t,
            shared_consts.MsgTeleg.SHARE_MSGREG,
            true
          );
        "
      >
      </q-btn>
    </div>
    <div
      v-if="showBtnActivities"
      class="col-md-6 col-sm-6 q-ma-xs col-xs-12 text-center"
    >
      <q-btn
        icon="fas fa-house-user"
        size="md"
        color="orange"
        :label="$t('profile.myactivities')"
        :to="`/attivita/` + myuser.username"
      >
      </q-btn>
    </div>
    <q-tooltip v-if="showingtooltip" class="bg-red text-body2 text-bold" :offset="[10, 10]" v-model="showingtooltip"
      >Per contattare la persona:<br />Entra ed Accedi a RISO</q-tooltip
    >
  </div>
  <div v-if="showsendCoinTo">
    <CSendCoins
      :showprop="showsendCoinTo"
      :to_user="myuser"
      @close="showsendCoinTo = false"
    >
    </CSendCoins>
  </div>
</template>

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

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