designtopack/src/components/notifications/Comment.vue

55 lines
1.6 KiB
Vue
Raw Normal View History

2024-12-19 10:32:48 +01:00
<template>
<article
class="notification | bg-white rounded-lg | p-16 | flow"
data-type="comment"
@click="router.push(targetUri + '&comments=true')"
2024-12-19 10:32:48 +01:00
>
<header>
<p class="flex">
<strong
class="notification__type | font-medium text-primary"
data-icon="comment"
>Commentaire</strong
>
<span class="notification__client | text-grey-700"
>{{ project.title }}
{{ project?.status === "unlisted" ? "(archivé)" : "" }}</span
>
2024-12-19 10:32:48 +01:00
<time
datetime=""
class="notification__date | text-grey-700 | ml-auto"
>{{ formatDate(notification) }}</time
>
</p>
</header>
<p
v-if="notification.type"
class="notification__body | text-md font-medium | line-clamp"
>
{{
notification.author.name
? notification.author.name
: notification.author.email
}}
: {{ notification.text }}
</p>
</article>
</template>
<script setup>
2024-12-19 10:37:20 +01:00
import { useRouter } from "vue-router";
2024-12-19 10:32:48 +01:00
import { useNotificationsStore } from "../../stores/notifications";
import { useProjectsStore } from "../../stores/projects";
2024-12-19 10:32:48 +01:00
2024-12-19 10:37:20 +01:00
const router = useRouter();
2024-12-19 10:32:48 +01:00
const { notification } = defineProps({ notification: Object });
const { formatDate } = useNotificationsStore();
const { getProjectByUuid } = useProjectsStore();
const project = getProjectByUuid(notification.location.project.uuid);
const targetUri = notification.location.dialoguri.replace(
/\/projects\/([a-z0-9\-]+)/,
"/projects/" + notification.target.slug
);
2024-12-19 10:32:48 +01:00
</script>