<template>
  <div class="card" v-if="isShownNodePopover">
    <div class="card-content">
      <ul>
        <li>ID: {{ node.id }}</li>
        <li>Name: {{ node.name }}</li>
        <li>Type: {{ node.dataClass }}</li>
      </ul>
    </div>
  </div>
</template>

<script>
import { mapState, mapGetters } from 'vuex'

export default {
  computed: {
    node() {
      return this.$store.getters['data/getNodeById'](this.hoveredNode)
    },
    ...mapState('interaction', ['hoveredNode']),
    ...mapGetters('interaction', ['isShownNodePopover'])
  }
}
</script>

<style lang="sass" scoped>
@import ../_workspace

$popover-width: 220px

.card
  width: $popover-width
  position: absolute
  margin-left: auto
  margin-right: auto
  left: 0
  right: 0
  top: $workspace-margin
</style>
