Refactor wallet module components for improved code organization and performance

- Updated import paths in the wallet module to enhance clarity and maintainability.
- Removed unused imports in ReceiveDialog and SendDialog components to streamline the code.
- Introduced a computed property in WalletPage to extract the base domain from the payment service configuration, improving readability and error handling.

These changes contribute to a cleaner codebase and enhance the overall performance of the wallet module.
This commit is contained in:
padreug 2025-09-15 00:54:01 +02:00
parent cdd00bf747
commit d5a90c793b
4 changed files with 14 additions and 17 deletions

View file

@ -5,10 +5,8 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/com
import { Button } from '@/components/ui/button'
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
import { Badge } from '@/components/ui/badge'
import { Separator } from '@/components/ui/separator'
import { ScrollArea } from '@/components/ui/scroll-area'
import { RefreshCw, Send, QrCode, ArrowUpRight, ArrowDownLeft, Clock, Wallet } from 'lucide-vue-next'
import CurrencyDisplay from '@/components/ui/CurrencyDisplay.vue'
import ReceiveDialog from '../components/ReceiveDialog.vue'
import SendDialog from '../components/SendDialog.vue'
import { format } from 'date-fns'
@ -40,6 +38,14 @@ const totalBalance = computed(() => {
const payLinks = computed(() => walletService?.payLinks?.value || [])
const firstPayLink = computed(() => payLinks.value[0] || null)
const baseDomain = computed(() => {
try {
const baseUrl = paymentService?.config?.baseUrl || 'http://localhost'
return new URL(baseUrl).hostname
} catch {
return 'localhost'
}
})
// Get transactions grouped by date
const groupedTransactions = computed(() => {
@ -447,7 +453,7 @@ onMounted(async () => {
<div class="flex items-center gap-4 mt-2 text-sm text-muted-foreground">
<span>{{ link.min }}-{{ link.max }} sats</span>
<Badge v-if="link.username" variant="secondary">
{{ link.username }}@{{ new URL(paymentService?.config?.baseUrl || 'http://localhost').hostname }}
{{ link.username }}@{{ baseDomain }}
</Badge>
</div>