comments working

This commit is contained in:
isUnknown 2025-01-15 14:18:48 +01:00
parent 375bed1d01
commit 0b472988a2
14 changed files with 107 additions and 59 deletions

View file

@ -2,7 +2,7 @@
<article
class="notification | bg-white rounded-lg | p-16 | flow"
data-type="comment"
@click="router.push(targetUri + '&comments=true')"
@click="router.push(href)"
>
<header>
<p class="flex">
@ -12,8 +12,10 @@
>Commentaire</strong
>
<span class="notification__client | text-grey-700"
>{{ project.title }}
{{ project?.status === "unlisted" ? "(archivé)" : "" }}</span
>{{ notification.project.title }}
{{
notification.project?.status === "unlisted" ? "(archivé)" : ""
}}</span
>
<time
datetime=""
@ -39,16 +41,29 @@
<script setup>
import { useRouter } from "vue-router";
import { useNotificationsStore } from "../../stores/notifications";
import { useProjectsStore } from "../../stores/projects";
const router = useRouter();
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
);
const href = getTargetPath();
// Functions
function getTargetPath() {
const uri = notification.location.page.uri;
const isDocumentBrief =
notification.location.page.template === "client-brief" &&
notification.location?.file.type === "document";
if (isDocumentBrief) {
return notification.project.uri + "?dialog=client-brief&comments=true";
}
if (notification.location.page.template === "track") {
return notification.project.uri + "?dialog=virtual-sample&comments=true";
}
return uri;
}
</script>