<script setup lang="ts">
import type { type_dyaw_xlfw_zxhd_log } from '~/types';
import { formatTimestamp } from '~/utils/time';
const props = defineProps<{
  left: boolean,
  d: type_dyaw_xlfw_zxhd_log
}>()

const id2name = {
  [props.d.dxzl_stu_user_id]: props.d.dxzl_stu_user_realname,
  [props.d.dxzl_tea_user_id]: props.d.dxzl_tea_user_realname,
}


const showMsg = decodeURIComponent(props.d.dxzl_last_msg_content!)
</script>

<template>
  <div class="w-full" :class="left ? 'left' : 'right'">
    <div class="flex items-end r_flex-row-reverse gap-4">
      <div>{{ id2name[d.create_user_id] }}</div>
      <div class="text-sm text-hex-AFB2B6">{{ formatTimestamp(d.create_dateline) }}</div>
    </div>
    <div class="flex mt-2 r_flex-row-reverse">
      <div class=" py-10px px-25px rounded-3xl min-h-44px bg-white text_wrapper" v-html="showMsg">
      </div>
    </div>

  </div>
</template>

<style scoped lang="scss">
.text_wrapper :deep(p) {
  margin: 0;
  padding: 0;
}


.left {
  .text_wrapper {
    border-radius: 2px 24px 24px 24px;
  }
}

.right {
  .r_flex-row-reverse {
    flex-direction: row-reverse;
  }

  .text_wrapper {
    background-color: #F9A7BE;
    color: white;
    border-radius: 24px 2px 24px 24px;
  }
}
</style>
