refactor: ♻️ Reimplement Notes

This commit is contained in:
Jesse Wierzbinski 2024-11-30 02:19:32 +01:00
parent 9ced2c98e4
commit d29f181000
No known key found for this signature in database
21 changed files with 335 additions and 30 deletions

View file

@ -1,11 +1,12 @@
<template>
<component :is="itemComponent" :element="item" @update="$emit('update', $event)"
<component :is="itemComponent" :note="item" @update="$emit('update', $event)"
@delete="$emit('delete', item?.id)" />
</template>
<script lang="ts" setup>
import type { Notification, Status } from "@versia/client/types";
import { computed } from "vue";
import NewNoteItem from "../notes/note.vue";
import NoteItem from "../social-elements/notes/note.vue";
import NotificationItem from "../social-elements/notifications/notif.vue";
@ -16,7 +17,7 @@ const props = defineProps<{
const itemComponent = computed(() => {
if (props.type === "status") {
return NoteItem;
return NewNoteItem;
}
if (props.type === "notification") {
return NotificationItem;

View file

@ -1,12 +1,12 @@
<!-- Timeline.vue -->
<template>
<div class="timeline rounded overflow-hidden">
<TransitionGroup name="timeline-item" tag="div" class="timeline-items">
<div class="timeline rounded overflow-hidden ring-1 ring-ring/15">
<TransitionGroup name="timeline-item" tag="div" class="timeline-items *:!border-b *:last:border-0">
<TimelineItem :type="type" v-for="item in items" :key="item.id" :item="item" @update="updateItem"
@delete="removeItem" />
</TransitionGroup>
<TimelineItem v-if="isLoading" :type="type" v-for="_ in 5" />
<!-- <TimelineItem v-if="isLoading" :type="type" v-for="_ in 5" /> -->
<div v-if="error" class="timeline-error">
{{ error.message }}