From 2dc7ad27bf06eeb6b53080060bdf3b930f667271 Mon Sep 17 00:00:00 2001 From: Tuur Martens Date: Sun, 9 Apr 2023 21:11:37 +0200 Subject: [PATCH] feat: personal notes (#1960) --- components/account/AccountHeader.vue | 39 +++++++++++++++++++++++- components/account/AccountMoreButton.vue | 33 ++++++++++++++++++++ locales/en.json | 3 ++ 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/components/account/AccountHeader.vue b/components/account/AccountHeader.vue index 167ed2b6..df7f330b 100644 --- a/components/account/AccountHeader.vue +++ b/components/account/AccountHeader.vue @@ -20,6 +20,7 @@ const relationship = $(useRelationship(account)) const namedFields = ref([]) const iconFields = ref([]) +const isEditingPersonalNote = ref(false) const hasHeader = $computed(() => !account.header.endsWith('/original/missing.png')) function getFieldIconTitle(fieldName: string) { @@ -80,6 +81,19 @@ watchEffect(() => { iconFields.value = icons }) +async function editNote(event: Event) { + if (!event.target || !('value' in event.target) || !relationship) + return + + const newNote = event.target?.value as string + + if (relationship.note?.trim() === newNote.trim()) + return + + const newNoteApiResult = await client.v1.accounts.createNote(account.id, { comment: newNote }) + relationship.note = newNoteApiResult.note +} + const isSelf = $(useSelfAccount(() => account)) const isNotifiedOnPost = $computed(() => !!relationship?.notifying) @@ -107,7 +121,11 @@ const isNotifiedOnPost = $computed(() => !!relationship?.notifying) - +