From b14a616ef4483db1bb0fc12514afcb495d378970 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Fri, 26 Apr 2024 21:39:26 -1000 Subject: [PATCH] feat: :sparkles: Timeline refactors, timelines now auto-refresh --- components/social-elements/notes/note.vue | 40 +++++++++++---- components/timelines/Account.vue | 21 ++++++++ components/timelines/Local.vue | 16 ++++++ components/timelines/Public.vue | 41 ++------------- components/timelines/timeline.vue | 62 +++++++++++++++++++++++ pages/[username]/index.vue | 46 +---------------- pages/local.vue | 44 +--------------- 7 files changed, 135 insertions(+), 135 deletions(-) create mode 100644 components/timelines/Account.vue create mode 100644 components/timelines/Local.vue create mode 100644 components/timelines/timeline.vue diff --git a/components/social-elements/notes/note.vue b/components/social-elements/notes/note.vue index 94fa0b4..a20ceba 100644 --- a/components/social-elements/notes/note.vue +++ b/components/social-elements/notes/note.vue @@ -70,10 +70,16 @@ - + Copy Link + + + Delete + + @@ -89,6 +95,10 @@ const props = defineProps<{ small?: boolean; }>(); +const emits = defineEmits<{ + delete: []; +}>(); + // Handle reblogs const note = computed(() => props.note?.reblog ?? props.note); const noteClosed = ref( @@ -96,25 +106,26 @@ const noteClosed = ref( ); const { copy } = useClipboard(); -const client = useMegalodon(); +const tokenData = useTokenData(); +const client = useMegalodon(tokenData); const mentions = await useResolveMentions( note.value?.mentions ?? [], client.value, ); const eventualReblogAccountName = props.note?.reblog ? useParsedContent( - props.note?.account.display_name, - props.note?.account.emojis, - mentions.value, - ).value + props.note?.account.display_name, + props.note?.account.emojis, + mentions.value, + ).value : null; const content = note.value && process.client ? useParsedContent( - note.value.content, - note.value.emojis, - mentions.value, - ) + note.value.content, + note.value.emojis, + mentions.value, + ) : ""; const numberFormat = (number = 0) => new Intl.NumberFormat(undefined, { @@ -124,6 +135,15 @@ const numberFormat = (number = 0) => }).format(number); const attachments = note.value?.media_attachments ?? []; const noteUrl = note.value && `/@${note.value.account.acct}/${note.value.id}`; + +const deleteNote = async () => { + const result = await client.value?.deleteStatus(note.value?.id ?? ""); + + if (result?.data) { + console.log("Status deleted", result.data); + emits('delete') + } +};