2024-06-29 05:05:50 +02:00
|
|
|
<template>
|
2025-05-26 11:19:15 +02:00
|
|
|
<component :is="itemComponent" :note="type === 'status' ? item : undefined" :notification="type === 'notification' ? item : (undefined as any)" @update="$emit('update', $event)"
|
2024-06-29 05:05:50 +02:00
|
|
|
@delete="$emit('delete', item?.id)" />
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2025-05-26 11:19:15 +02:00
|
|
|
import type { Notification, Status } from "@versia/client/schemas";
|
|
|
|
|
import type { z } from "zod";
|
2024-12-29 14:51:21 +01:00
|
|
|
import Thread from "../notes/thread.vue";
|
2024-12-02 11:17:25 +01:00
|
|
|
import NotificationItem from "../notifications/notification.vue";
|
2024-06-29 05:05:50 +02:00
|
|
|
|
|
|
|
|
const props = defineProps<{
|
2025-05-26 11:19:15 +02:00
|
|
|
item?: z.infer<typeof Status> | z.infer<typeof Notification>;
|
2024-06-29 05:05:50 +02:00
|
|
|
type: "status" | "notification";
|
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
const itemComponent = computed(() => {
|
|
|
|
|
if (props.type === "status") {
|
2024-12-29 14:51:21 +01:00
|
|
|
return Thread;
|
2024-06-29 05:05:50 +02:00
|
|
|
}
|
2025-05-26 11:19:15 +02:00
|
|
|
|
2024-06-29 05:05:50 +02:00
|
|
|
if (props.type === "notification") {
|
|
|
|
|
return NotificationItem;
|
|
|
|
|
}
|
2025-05-26 11:19:15 +02:00
|
|
|
|
2024-06-29 05:05:50 +02:00
|
|
|
return null;
|
|
|
|
|
});
|
2024-12-29 14:51:21 +01:00
|
|
|
</script>
|