<script lang='ts' setup>
import { chevronForwardOutline, copyOutline, qrCodeOutline } from "ionicons/icons";

const { user } = useAuth();
</script>

<template>
  <div class="user-info-container">
    <div class="user-info">
      <ion-avatar>
        <img alt="User avatar" :src="user?.image || 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg'">
      </ion-avatar>
      <div>
        <div class="user-name">
          {{ user?.email }}
        </div>
        <div class="user-uid">
          uid: xxxxxxxx <ion-icon :icon="copyOutline" />
        </div>
      </div>
    </div>
    <div class="link" @click="$router.push('/onchain-address')">
      <ion-icon :icon="qrCodeOutline" class="qr-code" />
      <ion-icon :icon="chevronForwardOutline" />
    </div>
  </div>
</template>

<style scoped>
.user-info-container {
  display: flex;
  align-items: center;
  gap: 16px;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.user-name {
  font-weight: 600;
  font-size: 1.3em;
}
.user-uid {
  color: var(--ion-text-secondary);
  font-size: 0.9em;
  display: flex;
  align-items: end;
  gap: 4px;
}
.link {
  display: flex;
  align-items: center;
  gap: 12px;
}
.qr-code {
  font-size: 1.5em;
}
ion-icon {
  font-size: 1em;
}
</style>
