diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 38bb64a..daeb845 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -57,7 +57,6 @@ const messages: LocaleMessages = { tomorrow: 'Tomorrow', thisWeek: 'This Week', thisMonth: 'This Month', - myTickets: 'My tickets', }, categories: { concert: 'Concert', @@ -97,11 +96,6 @@ const messages: LocaleMessages = { when: 'When', tickets: 'Tickets', ticketsAvailable: '{count} tickets available', - ticketsOwned: 'You have {count} ticket | You have {count} tickets', - unlimitedTickets: 'Unlimited tickets', - buyTicket: 'Buy ticket', - buyAnotherTicket: 'Buy another ticket', - viewMyTickets: 'View in My Tickets', soldOut: 'Sold Out', free: 'Free', }, diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index b2603e9..76a5f56 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -57,7 +57,6 @@ const messages: LocaleMessages = { tomorrow: 'Mañana', thisWeek: 'Esta semana', thisMonth: 'Este mes', - myTickets: 'Mis boletos', }, categories: { concert: 'Concierto', @@ -97,11 +96,6 @@ const messages: LocaleMessages = { when: 'Cuándo', tickets: 'Boletos', ticketsAvailable: '{count} boletos disponibles', - ticketsOwned: 'Tienes {count} boleto | Tienes {count} boletos', - unlimitedTickets: 'Boletos ilimitados', - buyTicket: 'Comprar boleto', - buyAnotherTicket: 'Comprar otro boleto', - viewMyTickets: 'Ver en Mis boletos', soldOut: 'Agotado', free: 'Gratis', }, diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index 388f602..19b8ece 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -57,7 +57,6 @@ const messages: LocaleMessages = { tomorrow: 'Demain', thisWeek: 'Cette semaine', thisMonth: 'Ce mois-ci', - myTickets: 'Mes billets', }, categories: { concert: 'Concert', @@ -97,11 +96,6 @@ const messages: LocaleMessages = { when: 'Quand', tickets: 'Billets', ticketsAvailable: '{count} billets disponibles', - ticketsOwned: 'Vous avez {count} billet | Vous avez {count} billets', - unlimitedTickets: 'Billets illimités', - buyTicket: 'Acheter un billet', - buyAnotherTicket: 'Acheter un autre billet', - viewMyTickets: 'Voir dans Mes billets', soldOut: 'Épuisé', free: 'Gratuit', }, diff --git a/src/i18n/types.ts b/src/i18n/types.ts index d44f236..0ca44dd 100644 --- a/src/i18n/types.ts +++ b/src/i18n/types.ts @@ -58,7 +58,6 @@ export interface LocaleMessages { tomorrow: string thisWeek: string thisMonth: string - myTickets: string } categories: Record detail: { @@ -72,11 +71,6 @@ export interface LocaleMessages { when: string tickets: string ticketsAvailable: string - ticketsOwned: string - unlimitedTickets: string - buyTicket: string - buyAnotherTicket: string - viewMyTickets: string soldOut: string free: string } diff --git a/src/modules/activities/components/ActivityCard.vue b/src/modules/activities/components/ActivityCard.vue index d16c376..d021b10 100644 --- a/src/modules/activities/components/ActivityCard.vue +++ b/src/modules/activities/components/ActivityCard.vue @@ -4,10 +4,9 @@ import { useI18n } from 'vue-i18n' import { format } from 'date-fns' import { Card, CardContent } from '@/components/ui/card' import { Badge } from '@/components/ui/badge' -import { MapPin, Calendar, Ticket, User, CheckCircle2 } from 'lucide-vue-next' +import { MapPin, Calendar, Ticket, User } from 'lucide-vue-next' import BookmarkButton from './BookmarkButton.vue' import { useDateLocale } from '../composables/useDateLocale' -import { useOwnedTickets } from '../composables/useOwnedTickets' import type { Activity } from '../types/activity' const props = defineProps<{ @@ -20,9 +19,6 @@ const emit = defineEmits<{ const { t } = useI18n() const { dateLocale } = useDateLocale() -const { paidCount } = useOwnedTickets() - -const ownedCount = computed(() => paidCount(props.activity.id)) const dateDisplay = computed(() => { const a = props.activity @@ -159,38 +155,19 @@ const placeholderBg = computed(() => { {{ activity.location }} - +
- - {{ t('activities.detail.unlimitedTickets', 'Unlimited tickets') }} - - + {{ t('activities.detail.ticketsAvailable', { count: activity.ticketInfo.available }) }} {{ t('activities.detail.soldOut') }}
- - -
- - - {{ t('activities.detail.ticketsOwned', { count: ownedCount }, ownedCount) }} - -
diff --git a/src/modules/activities/components/PurchaseTicketDialog.vue b/src/modules/activities/components/PurchaseTicketDialog.vue index b5b5d3f..22eb1b8 100644 --- a/src/modules/activities/components/PurchaseTicketDialog.vue +++ b/src/modules/activities/components/PurchaseTicketDialog.vue @@ -7,7 +7,7 @@ import { useTicketPurchase } from '../composables/useTicketPurchase' import { useAuth } from '@/composables/useAuthService' import { injectService, SERVICE_TOKENS } from '@/core/di-container' import type { TicketApiService } from '../services/TicketApiService' -import { User, Wallet, CreditCard, Zap, Ticket, ExternalLink, Landmark, Minus, Plus, Copy, Check, Loader2 } from 'lucide-vue-next' +import { User, Wallet, CreditCard, Zap, Ticket, ExternalLink, Landmark } from 'lucide-vue-next' import { formatEventPrice, formatWalletBalance } from '@/lib/utils/formatting' import PaymentMethodSelector, { type PaymentMethod as PaymentMethodEntry, @@ -41,7 +41,6 @@ const { isLoading, error, paymentHash, - paymentRequest, qrCode, isPaymentPending, isPayingWithWallet, @@ -49,39 +48,14 @@ const { userWallets, hasWalletWithBalance, purchaseTicketForEvent, - payCurrentInvoiceWithWallet, handleOpenLightningWallet, resetPaymentState, cleanup, - purchasedTicketIds, + ticketQRCode, + purchasedTicketId, showTicketQR } = useTicketPurchase() -const MAX_QUANTITY = 10 -const quantity = ref(1) -const copiedInvoice = ref(false) - -function decreaseQuantity() { - if (quantity.value > 1) quantity.value -= 1 -} -function increaseQuantity() { - if (quantity.value < MAX_QUANTITY) quantity.value += 1 -} - -const totalPrice = computed(() => props.event.price_per_ticket * quantity.value) - -async function copyInvoice() { - if (!paymentRequest.value) return - try { - await navigator.clipboard.writeText(paymentRequest.value) - copiedInvoice.value = true - setTimeout(() => (copiedInvoice.value = false), 1500) - } catch { - // Older browsers / insecure contexts; the Open-in-wallet button - // still works as a fallback. - } -} - const { providers, providerMeta } = useFiatProviders() const { convert } = usePriceConversion() @@ -173,13 +147,10 @@ async function handlePurchase() { const method = selectedMethod.value if (!method) return - // Lightning path: the composable just creates the invoice + starts - // polling. The buyer picks "Pay with my LNbits wallet" or "Open in - // external wallet" on the invoice screen (restaurant pattern), so - // no auto-pay here. + // Lightning path: existing composable handles QR + wallet auto-pay. if (method.rail === 'lightning') { try { - await purchaseTicketForEvent(props.event.id, { quantity: quantity.value }) + await purchaseTicketForEvent(props.event.id) } catch (err) { console.error('Error purchasing ticket:', err) } @@ -206,11 +177,7 @@ async function handlePurchase() { props.event.id, userId, accessToken, - { - paymentMethod: 'fiat', - fiatProvider: method.provider, - quantity: quantity.value, - }, + { paymentMethod: 'fiat', fiatProvider: method.provider }, ) if (!invoice.isFiat || !invoice.fiatPaymentRequest) { fiatError.value = 'Fiat provider did not return a checkout URL.' @@ -239,8 +206,6 @@ function handleClose() { fiatRedirectUrl.value = null fiatProviderLabel.value = null fiatError.value = null - quantity.value = 1 - copiedInvoice.value = false } onUnmounted(() => { @@ -250,20 +215,14 @@ onUnmounted(() => {