Show bookmark heart to all users, redirect to login if not authenticated

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-04-20 08:34:47 +02:00
commit ced192b65e

View file

@ -1,5 +1,6 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useRouter } from 'vue-router'
import { Button } from '@/components/ui/button'
import { Heart } from 'lucide-vue-next'
import { useAuth } from '@/composables/useAuthService'
@ -15,6 +16,7 @@ const props = defineProps<{
kind?: number
}>()
const router = useRouter()
const { isAuthenticated } = useAuth()
const { isBookmarked, toggleBookmark } = useBookmarks()
@ -22,13 +24,16 @@ const activityKind = computed(() => props.kind ?? NIP52_KINDS.CALENDAR_TIME_EVEN
const bookmarked = computed(() => isBookmarked(activityKind.value, props.pubkey, props.dTag))
function handleToggle() {
if (!isAuthenticated.value) {
router.push('/login')
return
}
toggleBookmark(activityKind.value, props.pubkey, props.dTag)
}
</script>
<template>
<Button
v-if="isAuthenticated"
variant="ghost"
size="icon"
class="h-8 w-8"