<template>
  <div class="col-12">
    <span class="badge-motive">
      <div>
        {{ localizeString(props.motiveHistory.motive.label) }}
      </div>
    </span>
    <peloton-component
      :stored-objects="motive ? motive.storedObjects : null"
      pelotonBtnClass="float-end"
    />
  </div>
</template>

<script lang="ts" setup>
import { computed, ComputedRef } from "vue";
import { useStore } from "vuex";

//utils
import { localizeString } from "ChillMainAssets/lib/localizationHelper/localizationHelper";

// Types
import { Motive, MotiveHistory } from "../../../../types";

//Components
import PelotonComponent from "../PelotonComponent.vue";

const props = defineProps<{ motiveHistory: MotiveHistory }>();

const store = useStore();
const motive: ComputedRef<Motive | null> = computed(() =>
  store.getters.getMotiveById(props.motiveHistory.motive.id),
);
</script>

<style lang="scss" scoped>
span.badge-motive {
  margin: 0.2rem 0.1rem;
  display: inline-block;
  padding: 0 0.5em !important;
  background-color: #fff;
  color: #2c2d2f;
  border: 1px solid #dee2e6;
  border-bottom-width: 1px;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-style: solid;
  border-radius: 6px;
}
</style>
