Connect comment data to ui

This commit is contained in:
marzban-dev
2026-05-18 16:02:50 +03:30
parent e97580b212
commit 3b3bbc1bfa
+20 -11
View File
@@ -1,24 +1,33 @@
<script setup lang="ts">
// type
type Props = {
title: string,
date: string,
username: string,
content: string,
rate : number
}
title: string;
date: string;
first_name: string;
last_name: string;
content: string;
rate: number;
};
// props
const props = defineProps<Props>();
const { date } = toRefs(props);
const { date, first_name, last_name } = toRefs(props);
// state
const formattedDate = useDateFormat(date.value, "YYYY/MM/DD");
// computed
const username = computed(() => {
if (first_name.value.length === 0 || last_name.value.length === 0) {
return "کاربر هیملز";
}
return `${first_name.value} ${last_name.value}`;
});
</script>
<template>
@@ -26,7 +35,7 @@ const formattedDate = useDateFormat(date.value, "YYYY/MM/DD");
<div class="flex justify-between items-start w-full max-sm:flex-col gap-4">
<div class="flex flex-col gap-3">
<span class="text-lg font-semibold sm:typo-h-6 text-black">
{{ title }}
{{ title }}
</span>
<span class="typo-p-xs sm:typo-p-sm text-slate-500">
{{ username }}
@@ -34,10 +43,10 @@ const formattedDate = useDateFormat(date.value, "YYYY/MM/DD");
{{ formattedDate }}
</span>
</div>
<Rating :rate="rate"/>
<Rating :rate="rate" />
</div>
<div class="typo-p-md">
{{ content }}
</div>
</div>
</template>
</template>