nidus-sync/ts/components/ListCardActivityLog.vue

44 lines
1.1 KiB
Vue
Raw Normal View History

2026-04-28 05:15:01 +00:00
<template>
<div>
<div class="text-muted">
2026-04-28 07:45:51 +00:00
<i class="bi" :class="typeToIcon()" /> {{ typeToTitle() }}
2026-04-28 05:15:01 +00:00
</div>
<div>{{ entry.message }}</div>
<small class="text-muted">{{ formatDate(entry.created) }}</small>
</div>
</template>
<script setup lang="ts">
import { LogEntry } from "@/type/api";
interface Props {
entry: LogEntry;
}
const props = defineProps<Props>();
function formatDate(date: Date) {
return date.toLocaleString();
}
function typeToIcon(): string {
if (props.entry.type == "message-text-incoming") {
return "bi-box-arrow-in-left";
} else if (props.entry.type == "message-text-outgoing") {
2026-04-28 07:45:51 +00:00
return "bi-box-arrow-right";
2026-04-28 05:15:01 +00:00
} else if (props.entry.type == "created") {
return "bi-stars";
} else {
return "bi-question";
}
}
function typeToTitle(): string {
if (props.entry.type == "message-text-incoming") {
return "Incoming Text";
} else if (props.entry.type == "message-text-outgoing") {
return "Outgoing Text";
} else if (props.entry.type == "created") {
return "Report Created";
} else {
return props.entry.type;
}
}
</script>