2024-06-29 05:05:50 +02:00
|
|
|
<template>
|
2024-12-02 11:17:25 +01:00
|
|
|
<component :is="itemComponent" :note="type === 'status' ? item : undefined" :notification="type === 'notification' ? item : undefined" @update="$emit('update', $event)"
|
2024-06-29 05:05:50 +02:00
|
|
|
@delete="$emit('delete', item?.id)" />
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2024-08-28 00:23:29 +02:00
|
|
|
import type { Notification, Status } from "@versia/client/types";
|
2024-06-29 05:05:50 +02:00
|
|
|
import { computed } from "vue";
|
2024-12-02 11:17:25 +01:00
|
|
|
import Note from "../notes/note.vue";
|
|
|
|
|
import NotificationItem from "../notifications/notification.vue";
|
2024-06-29 05:05:50 +02:00
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
item?: Status | Notification;
|
|
|
|
|
type: "status" | "notification";
|
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
const itemComponent = computed(() => {
|
|
|
|
|
if (props.type === "status") {
|
2024-12-02 11:17:25 +01:00
|
|
|
return Note;
|
2024-06-29 05:05:50 +02:00
|
|
|
}
|
|
|
|
|
if (props.type === "notification") {
|
|
|
|
|
return NotificationItem;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
</script>
|