<template>
  <div class="c-perf py-2">
    <div class="h-full">
      <div
        v-for="(item, i) in list"
        :key="i"
        class="h-1/4 pt-2.5"
        style="margin-left: 10px"
      >
        <div class="text-text-color text-xs" style="margin-bottom: 2px">
          {{ item.name }}
        </div>
        <div class="text-title-color text-sm font-bold">
          {{ item.value }}
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts">
import { filterNum } from "@/utils/utils";
import Vue from "vue";
export default Vue.extend({
  props: {
    speed: Number,
    tps: Number,
    txNumber: Number,
    addressNumber: Number,
  },
  computed: {
    list(): { name: string; value: string | number }[] {
      return [
        {
          name: this.$t("lang.chainPerf.speed") as string,
          value: this.speed + "s",
        },
        {
          name: this.$t("lang.chainPerf.tps") as string,
          value: 1000,
        },
        {
          name: this.$t("lang.chainPerf.txNumber") as string,
          value: filterNum(this.txNumber),
        },
        {
          name: this.$t("lang.chainPerf.addressNumber") as string,
          value: filterNum(this.addressNumber),
        },
      ];
    },
  },
});
</script>
<style lang="scss" scoped>
.c-perf {
  height: 240px;
  background: #ffffff;
  box-shadow: 0px 1px 8px 0px rgba(31, 52, 112, 0.06);
  border-radius: 2px;
}
</style>
