<template>
  <div class="consensus-node" style="background: #fafbfc;">
    <div
      class="box"
      :style="{
        backgroundColor:
          type === 'package' ? 'rgba(248, 164, 87, 0.05)' : 'white',
      }"
    >
      <div class="flex items-center justify-between" style="margin-top: 4px;">
        <div class="text-darkBlue text-sm font-bold">
          {{
            type === 'package'
              ? $t('lang.block.packingNode')
              : $t('lang.block.votingNode')
          }}
        </div>
        <Count :time="time" class="text-text-color text-xs"></Count>
      </div>
      <div class="flex justify-between items-center" style="margin-top: 5px;">
        <div>
          <span class="text-text-color text-xs">
            {{ $t('lang.block.consensusAddress') }}:
          </span>
          <span
            class="text-text-color text-xs"
            :class="[
              type === 'package' ? ' text-orange' : ' text-footer-color',
            ]"
          >
            <router-link
              :to="{
                path: '/address',
                query: {
                  address,
                },
              }"
            >
              {{ address | filterHash(6) }}
            </router-link>
          </span>
        </div>
        <div>
          <span class="text-text-color text-xs">
            {{ $t('lang.block.blockReward') }}:
          </span>
          <span class="font-bold text-darkBlue text-xs">
            {{ reward | filterAmount }}YCC
          </span>
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts">
import Vue, { PropType } from 'vue'
import Count from '../pc/BlockChainBrowser/Count.vue'
export default Vue.extend({
  components: {
    Count,
  },
  props: {
    type: {
      type: String as PropType<'package' | 'vote'>,
      default: 'package',
    },
    height: [Number, String],
    address: String,
    reward: Number,
    time: Number,
  },
})
</script>
<style lang="scss" scoped>
.consensus-node {
  .box {
    padding: 10px;
    margin: 5px;
    height: 70px;
    border-radius: 2px;
  }
}
</style>
