feat: profile publications in page
This commit is contained in:
+73
-12
@@ -382,18 +382,6 @@
|
|||||||
leave-from-class="transform opacity-100 translate-y-0"
|
leave-from-class="transform opacity-100 translate-y-0"
|
||||||
leave-to-class="transform opacity-0 translate-y-2">
|
leave-to-class="transform opacity-0 translate-y-2">
|
||||||
<div v-if="activeTab === 'overview'" key="overview" class="space-y-6">
|
<div v-if="activeTab === 'overview'" key="overview" class="space-y-6">
|
||||||
|
|
||||||
<div
|
|
||||||
class="bg-white dark:bg-slate-900 p-6 rounded-2xl shadow-sm border border-slate-200 dark:border-slate-800 transition-colors">
|
|
||||||
<h2
|
|
||||||
class="text-xs font-bold text-slate-400 dark:text-slate-500 uppercase tracking-wider mb-3">
|
|
||||||
Biography
|
|
||||||
</h2>
|
|
||||||
<p class="text-slate-700 dark:text-slate-300 leading-relaxed text-sm">
|
|
||||||
{{ userProfile.biography }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-center justify-between pt-2 px-1">
|
<div class="flex items-center justify-between pt-2 px-1">
|
||||||
<h2 class="text-lg font-bold text-slate-900 dark:text-white flex items-center gap-2">
|
<h2 class="text-lg font-bold text-slate-900 dark:text-white flex items-center gap-2">
|
||||||
Recent Publications
|
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"
|
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)">
|
@click="fetchPostDetail(post.id)">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
<div
|
<div
|
||||||
class="flex flex-col items-center gap-1 text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-800/50 p-2 rounded-lg h-fit">
|
class="flex flex-col items-center gap-1 text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-800/50 p-2 rounded-lg h-fit">
|
||||||
@@ -489,10 +479,58 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="flex items-center justify-end gap-2 group-hover/row:opacity-100 transition-opacity duration-200">
|
||||||
|
<button
|
||||||
|
class="p-2.5 text-slate-400 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-all transform hover:scale-110 active:scale-95"
|
||||||
|
title="Edit" @click.stop="openEditModal(user)">
|
||||||
|
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24"
|
||||||
|
stroke="currentColor">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round"
|
||||||
|
stroke-width="2"
|
||||||
|
d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="p-2.5 text-slate-400 hover:text-amber-600 hover:bg-white-50 dark:hover:bg-white-900/20 rounded-lg transition-all transform hover:scale-110 active:scale-95"
|
||||||
|
title="Hide" @click.stop="confirmHide(post)">
|
||||||
|
<svg width="16px" height="16px" viewBox="0 0 16 16"
|
||||||
|
xmlns="http://www.w3.org/2000/svg" fill="currentColor"
|
||||||
|
class="bi bi-eye">
|
||||||
|
<path
|
||||||
|
d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z" />
|
||||||
|
<path
|
||||||
|
d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<td class="p-6 pr-8 text-right">
|
||||||
|
<div
|
||||||
|
class="flex items-center justify-end gap-2 opacity-0 group-hover/row:opacity-100 transition-opacity duration-200">
|
||||||
|
<button
|
||||||
|
class="p-2.5 text-slate-400 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-all transform hover:scale-110 active:scale-95"
|
||||||
|
title="Edit" @click.stop="openEditModal(user)">
|
||||||
|
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||||
|
d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="p-2.5 text-slate-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-all transform hover:scale-110 active:scale-95"
|
||||||
|
title="Delete" @click.stop="confirmHide(user)">
|
||||||
|
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||||
|
d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="activeTab === 'activity'" key="activity" class="space-y-4">
|
<div v-else-if="activeTab === 'activity'" key="activity" class="space-y-4">
|
||||||
@@ -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 ---
|
// --- Redirects ---
|
||||||
const goToCreatePost = () => {
|
const goToCreatePost = () => {
|
||||||
console.log("Navigating to create post modal...");
|
console.log("Navigating to create post modal...");
|
||||||
|
|||||||
Reference in New Issue
Block a user