diff --git a/src/modules/nostr-feed/components/ScheduledEventCard.vue b/src/modules/nostr-feed/components/ScheduledEventCard.vue index 15270fe..51c8102 100644 --- a/src/modules/nostr-feed/components/ScheduledEventCard.vue +++ b/src/modules/nostr-feed/components/ScheduledEventCard.vue @@ -17,6 +17,8 @@ import { } from '@/components/ui/collapsible' import { Calendar, MapPin, Clock, CheckCircle, PlayCircle, Hand } from 'lucide-vue-next' import type { ScheduledEvent, EventCompletion, TaskStatus } from '../services/ScheduledEventService' +import { injectService, SERVICE_TOKENS } from '@/core/di-container' +import type { AuthService } from '@/modules/base/auth/auth-service' interface Props { event: ScheduledEvent @@ -39,6 +41,9 @@ const props = withDefaults(defineProps(), { const emit = defineEmits() +// Get auth service to check current user +const authService = injectService(SERVICE_TOKENS.AUTH_SERVICE) + // Confirmation dialog state const showConfirmDialog = ref(false) @@ -66,6 +71,15 @@ const isCompletable = computed(() => props.event.eventType === 'task') // Get completion data const completion = computed(() => props.getCompletion(eventAddress.value, occurrence.value)) +// Get current user's pubkey +const currentUserPubkey = computed(() => authService?.user.value?.pubkey) + +// Check if current user can unclaim (only if they created the current status) +const canUnclaim = computed(() => { + if (!completion.value || !currentUserPubkey.value) return false + return completion.value.pubkey === currentUserPubkey.value +}) + // Status badges configuration const statusConfig = computed(() => { switch (taskStatus.value) { @@ -394,6 +408,7 @@ const dialogContent = computed(() => { Mark Complete