From dacec7133882bd4f5987ceab255adf55b479bdeb Mon Sep 17 00:00:00 2001 From: AfonsoCMSousa Date: Thu, 22 Jan 2026 18:51:14 +0000 Subject: [PATCH] feat: profile publications in page --- app/pages/profile/index.vue | 85 +++++++++++++++++++++++++++++++------ 1 file changed, 73 insertions(+), 12 deletions(-) diff --git a/app/pages/profile/index.vue b/app/pages/profile/index.vue index 2b46ab2..37682bc 100644 --- a/app/pages/profile/index.vue +++ b/app/pages/profile/index.vue @@ -382,18 +382,6 @@ leave-from-class="transform opacity-100 translate-y-0" leave-to-class="transform opacity-0 translate-y-2">
- -
-

- Biography -

-

- {{ userProfile.biography }} -

-
-

Recent Publications @@ -457,6 +445,8 @@ class="group bg-white dark:bg-gray-900 border dark:border-gray-800 rounded-xl p-5 shadow-sm hover:border-blue-500/50 transition-all cursor-pointer mb-4" @click="fetchPostDetail(post.id)"> + +
@@ -489,10 +479,58 @@

+
+ + +
+ +
+ + +
+ + +
@@ -809,6 +847,29 @@ const votePost = async (targetPost, direction) => { } }; +const confirmHide = async (post) => { + if (!post) return; + + const confirmed = confirm(`Are you sure you want to hide the post titled "${post.title}"?`); + + if (!confirmed) return; + + try { + await $fetch(`${api}/publications/${post.id}`, { + method: 'DELETE', + headers: { Authorization: `Bearer ${token.value}` } + }); + + userProfile.value.publications = userProfile.value.publications.filter(p => p.id !== post.id); + + alert("Post deleted successfully."); + + } catch (error) { + console.error("Delete failed", error); + alert("Failed to delete the post."); + } +}; + // --- Redirects --- const goToCreatePost = () => { console.log("Navigating to create post modal...");