Refactor market components for improved structure and functionality

- Update imports in DashboardOverview.vue to use relative paths for better module organization.
- Modify OrderHistory.vue to replace 'lightningInvoice' with 'paymentRequest' for consistency in payment handling.
- Enhance order event handling in useMarket.ts by adding subscription and decryption logic for order-related DMs.
- Update nostrmarketService.ts to use relative imports, ensuring consistency across the module.
- Introduce error handling and logging for order updates, improving the robustness of the market module.
This commit is contained in:
padreug 2025-09-05 04:38:51 +02:00
parent 36638d1080
commit f5ea2a8d5e
4 changed files with 110 additions and 12 deletions

View file

@ -106,7 +106,7 @@
</div>
<!-- Payment Section -->
<div v-if="order.lightningInvoice" class="mb-4 p-4 bg-muted/50 border border-border rounded-lg">
<div v-if="order.paymentRequest" class="mb-4 p-4 bg-muted/50 border border-border rounded-lg">
<div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2">
<Zap class="w-4 h-4 text-yellow-500" />
@ -127,9 +127,9 @@
Payment Request
</label>
<div class="flex items-center gap-2">
<input :value="order.lightningInvoice?.bolt11 || ''" readonly disabled
<input :value="order.paymentRequest || ''" readonly disabled
class="flex-1 font-mono text-xs bg-muted border border-input rounded-md px-3 py-1 text-foreground" />
<Button @click="copyPaymentRequest(order.lightningInvoice?.bolt11 || '')" variant="outline" size="sm">
<Button @click="copyPaymentRequest(order.paymentRequest || '')" variant="outline" size="sm">
<Copy class="w-3 h-3" />
</Button>
</div>
@ -137,8 +137,8 @@
<!-- Payment Actions -->
<div class="flex gap-2">
<Button @click="openLightningWallet(order.lightningInvoice?.bolt11 || '')" variant="default" size="sm"
class="flex-1" :disabled="!order.lightningInvoice?.bolt11">
<Button @click="openLightningWallet(order.paymentRequest || '')" variant="default" size="sm"
class="flex-1" :disabled="!order.paymentRequest">
<Zap class="w-3 h-3 mr-1" />
Pay with Lightning
</Button>
@ -244,7 +244,15 @@ const router = useRouter()
const marketStore = useMarketStore()
const relayHub = injectService(SERVICE_TOKENS.RELAY_HUB)
// const orderEvents = useOrderEvents() // TODO: Move to market module
const orderEvents = { isSubscribed: ref(false), subscribeToOrderEvents: () => {}, cleanup: () => {} } // Temporary mock
const orderEvents = {
isSubscribed: ref(false),
subscribeToOrderEvents: () => {},
cleanup: () => {},
initialize: () => {
console.log('OrderEvents mock initialize called')
orderEvents.isSubscribed.value = true
}
} // Temporary mock
// Local state
const statusFilter = ref('')