<script setup>
  import i18n from "@/i18n.js"
  import {getSelf, getUser} from '../rest/Users.js'
  import {ref} from "vue";

  const user = await getSelf();

  function getPP(){
    if(user.value.profilePictureUrl === null){
      return "/Clyde.png"
    }
    return user.profilePictureUrl
  }
</script>

<template>
  <div class="body">
    <div class="container">
      <div class="profilPic">
        <img class="subContainter" :src=getPP()>
      </div>
      <div class = "globalInfos">
        <div class="infosContainer">
          <div>
            {{user.firstName}} {{user.lastName}}
          </div>
          <div>
            E-mail: {{user.email}}
          </div>
        </div>
      </div>
    </div>
  </div>

</template>


<style>
.container{

  display:grid;
  grid-template-columns:200px 900px;
  grid-template-rows:200px auto;
  column-gap:30px;
  row-gap:45px;
  grid-template-areas:
  "profilPic globalInfos"
  "minfos minfos";
}

.profilPic{
  grid-area:profilPic;
}

.globalInfos {
  grid-area:globalInfos;
  align-self :center;

}

.body {
  width:100%;
  margin-bottom:10px;
}

.subContainter{
  width:100%;
  background-color:rgb(50,50,50);
  border-radius:20px;
  border:4px solid black;
}

.infosContainer {
  padding-bottom:50px;
  border:2px solid black;
  font-size:25px;
  color:white;
  padding:20px;
  background-color:rgb(50,50,50);
  border-radius:20px;
}
</style>