Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/bills/invoice/[invoiceId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ArrowLeft, ShieldCheck, Zap } from 'lucide-react'
import { motion } from 'framer-motion'
import { Button } from '@/components/ui/button'
import { decodeInvoice } from '@/lib/bills/qr-invoice'
import { formatCurrency } from '@/lib/onramp/formatters'
import { formatCurrency } from '@/lib/calculations'
import type { FiatCurrency } from '@/types/onramp'
import { BILLER_SCHEMAS } from '@/lib/biller-schemas'
import { PaymentForm } from '@/components/bills/payment-form'
Expand Down
6 changes: 6 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ export const metadata: Metadata = {
'Aframp',
],
generator: 'v0.app',
manifest: '/manifest.json',
appleWebApp: {
capable: true,
statusBarStyle: 'default',
title: 'Aframp',
},
}

export const viewport: Viewport = {
Expand Down
25 changes: 25 additions & 0 deletions app/manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { MetadataRoute } from 'next'

export default function manifest(): MetadataRoute.Manifest {
return {
name: 'Aframp',
short_name: 'Aframp',
description: 'Africa\'s premier cNGN stablecoin payment platform',
start_url: '/',
display: 'standalone',
background_color: '#000000',
theme_color: '#10b981',
icons: [
{
src: '/icon-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: '/icon-512x512.png',
sizes: '512x512',
type: 'image/png',
},
],
}
}
2 changes: 1 addition & 1 deletion app/offramp/success/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
Loader2,
} from 'lucide-react'
import { Button } from '@/components/ui/button'
import { formatCurrency } from '@/lib/onramp/formatters'
import { formatCurrency } from '@/lib/calculations'
import { generateReceiptPDF } from '@/lib/offramp/pdf-generator'
import { toast } from 'sonner'
import { OfframpWalletGuard } from '@/components/offramp/offramp-wallet-guard'
Expand Down
2 changes: 1 addition & 1 deletion components/bills/bills-receipt-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { Copy, Download, Mail, PhoneCall, Printer, RefreshCw, Share2 } from 'lucide-react'
import QRCode from 'react-qr-code'
import { Button } from '@/components/ui/button'
import { formatCurrency } from '@/lib/onramp/formatters'
import { formatCurrency } from '@/lib/calculations'
import type { FiatCurrency } from '@/types/onramp'
import { generateReceiptPDF } from '@/lib/offramp/pdf-generator'
import { exportReceiptPNG, exportReceiptCSV } from '@/lib/bills/export'
Expand Down Expand Up @@ -380,7 +380,7 @@
<div className="rounded-3xl border border-border bg-muted/20 p-6">
<h3 className="text-sm font-semibold text-foreground">Need help?</h3>
<p className="mt-2 text-sm text-muted-foreground">
If your transaction failed or needs review, contact support and we'll help quickly.

Check failure on line 383 in components/bills/bills-receipt-client.tsx

View workflow job for this annotation

GitHub Actions / Code Quality

`'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`
</p>
<div className="mt-4 flex flex-col gap-2">
<Button variant="outline" className="w-full" asChild>
Expand All @@ -400,7 +400,7 @@
<div className="rounded-3xl border border-destructive/20 bg-destructive/10 p-6 text-sm text-destructive">
<p className="font-semibold">Payment failed</p>
<p className="mt-2">
We couldn't complete this payment. Please retry or contact support.

Check failure on line 403 in components/bills/bills-receipt-client.tsx

View workflow job for this annotation

GitHub Actions / Code Quality

`'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`
</p>
<Button variant="outline" className="mt-4 w-full" asChild>
<Link href="/bills">Retry payment</Link>
Expand Down
2 changes: 1 addition & 1 deletion components/bills/qr-invoice-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Copy, Download, Share2, X } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { toast } from 'sonner'
import { buildInvoiceUrl, encodeInvoice, type QRInvoiceData } from '@/lib/bills/qr-invoice'
import { formatCurrency } from '@/lib/onramp/formatters'
import { formatCurrency } from '@/lib/calculations'
import type { FiatCurrency } from '@/types/onramp'

interface QRInvoiceModalProps {
Expand Down
2 changes: 1 addition & 1 deletion components/offramp/asset-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useMemo, useState } from 'react'
import { ChevronDown } from 'lucide-react'
import { cn } from '@/lib/utils'
import { formatNumber } from '@/lib/onramp/formatters'
import { formatNumber } from '@/lib/calculations'
import type { OfframpAssetOption } from '@/types/offramp'
import { CryptoAssetBadge } from '@/components/icons/finance-icons'

Expand Down
2 changes: 1 addition & 1 deletion components/offramp/offramp-calculator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Button } from '@/components/ui/button'
import { AmountInput } from '@/components/onramp/amount-input'
import { CurrencySelector } from '@/components/onramp/currency-selector'
import { AssetSelector } from '@/components/offramp/asset-selector'
import { formatCurrency, formatNumber } from '@/lib/onramp/formatters'
import { formatCurrency, formatNumber } from '@/lib/calculations'
import { formatRateCountdown, formatUsd } from '@/lib/offramp/formatters'
import type { FiatCurrency } from '@/types/onramp'
import type { OfframpAssetOption } from '@/types/offramp'
Expand Down
2 changes: 1 addition & 1 deletion components/offramp/offramp-page-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useOfframpRate } from '@/hooks/use-offramp-rate'
import { useOfframpForm } from '@/hooks/use-offramp-form'
import { useOfframpBalances } from '@/hooks/use-offramp-balances'
import { Skeleton } from '@/components/ui/skeleton'
import { formatCurrency } from '@/lib/onramp/formatters'
import { formatCurrency } from '@/lib/calculations'
import { formatUsd, formatRateCountdown } from '@/lib/offramp/formatters'
import type { OfframpOrder } from '@/types/offramp'

Expand Down
2 changes: 1 addition & 1 deletion components/onramp/onramp-calculator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ExchangeRateDisplay } from '@/components/onramp/exchange-rate-display'
import { PaymentMethodCard } from '@/components/onramp/payment-method-card'
import { WalletDisplay } from '@/components/onramp/wallet-display'
import { Button } from '@/components/ui/button'
import { formatCurrency, formatNumber } from '@/lib/onramp/formatters'
import { formatCurrency, formatNumber } from '@/lib/calculations'
import { PaymentMethodGlyph } from '@/components/icons/finance-icons'
import type { CryptoAsset, FiatCurrency, PaymentMethod } from '@/types/onramp'

Expand Down
3 changes: 1 addition & 2 deletions components/onramp/onramp-page-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import { useOnrampForm } from '@/hooks/use-onramp-form'
import { useWalletConnection } from '@/hooks/use-wallet-connection'
import { OnrampTestUtils } from '@/components/onramp/onramp-test-utils'
import type { CryptoAsset, FiatCurrency } from '@/types/onramp'
import { formatCurrency } from '@/lib/onramp/formatters'
import { isValidStellarAddress } from '@/lib/onramp/validation'
import { formatCurrency, isValidStellarAddress } from '@/lib/calculations'
import type { OnrampOrder } from '@/types/onramp'
import { Button } from '@/components/ui/button' // Added missing import for Button
import { Skeleton } from '@/components/ui/skeleton'
Expand Down
2 changes: 1 addition & 1 deletion components/onramp/onramp-payment-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Button } from '@/components/ui/button'
import { LoadingSpinner } from '@/components/ui/loading-spinner'
import { OrderStatus } from '@/types/onramp'
import { useOrderTracking } from '@/hooks/use-order-tracking'
import { formatCurrency, truncateAddress } from '@/lib/onramp/formatters'
import { formatCurrency, truncateAddress } from '@/lib/calculations'

export function OnrampPaymentClient() {
const router = useRouter()
Expand Down
2 changes: 1 addition & 1 deletion components/onramp/onramp-processing-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { OrderSummaryCard } from '@/components/onramp/order-summary-card'
import { TransactionDetails } from '@/components/onramp/transaction-details'
import { ProcessingTestUtils } from '@/components/onramp/processing-test-utils'
import { Skeleton } from '@/components/ui/skeleton'
import { formatCurrency, formatNumber } from '@/lib/onramp/formatters'
import { formatCurrency, formatNumber } from '@/lib/calculations'

interface OnrampProcessingClientProps {
orderId: string
Expand Down
2 changes: 1 addition & 1 deletion components/onramp/onramp-success-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import { Button } from '@/components/ui/button'
import { LoadingSpinner } from '@/components/ui/loading-spinner'
import { OnrampOrder } from '@/types/onramp'
import { formatCurrency } from '@/lib/onramp/formatters'
import { formatCurrency } from '@/lib/calculations'
import { generateReceiptPDF } from '@/lib/onramp/receipt'

export function OnrampSuccessClient() {
Expand Down
2 changes: 1 addition & 1 deletion components/onramp/order-summary-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Button } from '@/components/ui/button'
import { Separator } from '@/components/ui/separator'
import { Badge } from '@/components/ui/badge'
import { formatCurrency, formatNumber, truncateAddress } from '@/lib/onramp/formatters'
import { formatCurrency, formatNumber, truncateAddress } from '@/lib/calculations'
import type { OnrampOrder } from '@/types/onramp'

interface OrderSummaryCardProps {
Expand Down
3 changes: 1 addition & 2 deletions components/onramp/wallet-display.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import {
DialogTitle,
} from '@/components/ui/dialog'
import { cn } from '@/lib/utils'
import { isValidStellarAddress } from '@/lib/onramp/validation'
import { truncateAddress } from '@/lib/onramp/formatters'
import { isValidStellarAddress, truncateAddress } from '@/lib/calculations'

interface WalletDisplayProps {
address: string
Expand Down
2 changes: 1 addition & 1 deletion hooks/use-exchange-rate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
ExchangeRateState,
FiatCurrency,
} from '@/types/onramp'
import { formatRate } from '@/lib/onramp/formatters'
import { formatRate } from '@/lib/calculations'

const API_URL = '/api/exchange-rate'

Expand Down
2 changes: 1 addition & 1 deletion hooks/use-offramp-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import type { FiatCurrency } from '@/types/onramp'
import type { OfframpAssetOption, OfframpFormState } from '@/types/offramp'
import { calculateFiatAmount, calculateFees, getMinMax } from '@/lib/offramp/calculations'
import { formatAmountInput, parseAmountInput } from '@/lib/onramp/formatters'
import { formatAmountInput, parseAmountInput, formatCurrency } from '@/lib/calculations'

const STORAGE_KEY = 'offramp:form'
const EXPIRY_MS = 15 * 60 * 1000
Expand Down Expand Up @@ -108,7 +108,7 @@
}

Promise.resolve().then(() => setErrors(nextErrors))
}, [debouncedAmount, fiatAmount, limits.max, limits.min, state.amountInput])

Check warning on line 111 in hooks/use-offramp-form.ts

View workflow job for this annotation

GitHub Actions / Code Quality

React Hook useEffect has a missing dependency: 'remainingCents'. Either include it or remove the dependency array

const setAmountInput = useCallback((value: string) => {
const sanitized = value.replace(/[^0-9.]/g, '')
Expand Down
2 changes: 1 addition & 1 deletion hooks/use-onramp-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useCallback, useEffect, useMemo, useState } from 'react'
import type { CryptoAsset, FiatCurrency, OnrampFormState, PaymentMethod } from '@/types/onramp'
import { calculateCryptoAmount, calculateFeeBreakdown } from '@/lib/onramp/calculations'
import { formatAmountInput, parseAmountInput } from '@/lib/onramp/formatters'
import { formatAmountInput, parseAmountInput, formatCurrency } from '@/lib/calculations'
import { getLimits, validateAmount } from '@/lib/onramp/validation'

const STORAGE_KEY = 'onramp:form'
Expand Down
2 changes: 1 addition & 1 deletion hooks/use-wallet-connection.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import { useCallback, useEffect, useState } from 'react'
import { isValidStellarAddress } from '@/lib/onramp/validation'
import { isValidStellarAddress } from '@/lib/calculations'
import { useWallet } from '@/hooks/useWallet'
import { walletSession } from '@/lib/wallet/session'

Expand Down
2 changes: 1 addition & 1 deletion lib/onramp/validation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FiatCurrency } from '@/types/onramp'
import { formatCurrency } from '@/lib/onramp/formatters'
import { formatCurrency } from '@/lib/calculations'

const limitsMap: Record<FiatCurrency, { min: number; max: number }> = {
NGN: { min: 1000, max: 500000 },
Expand Down
11 changes: 10 additions & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import withPWAInit from 'next-pwa'

const withPWA = withPWAInit({
dest: 'public',
register: true,
skipWaiting: true,
disable: process.env.NODE_ENV === 'development',
})

/** @type {import('next').NextConfig} */
const nextConfig = {
typescript: {
Expand All @@ -10,4 +19,4 @@ const nextConfig = {
output: 'standalone',
}

export default nextConfig
export default withPWA(nextConfig)
Loading
Loading