diff --git a/src/app/(dashboard)/[portSlug]/expenses/scan/page.tsx b/src/app/(dashboard)/[portSlug]/expenses/scan/page.tsx index a7d86ab..825c911 100644 --- a/src/app/(dashboard)/[portSlug]/expenses/scan/page.tsx +++ b/src/app/(dashboard)/[portSlug]/expenses/scan/page.tsx @@ -1,9 +1,11 @@ 'use client'; -import { useState, useRef } from 'react'; +import { useEffect, useRef, useState } from 'react'; import { useParams, useRouter } from 'next/navigation'; import { useMutation } from '@tanstack/react-query'; -import { Upload, Loader2, ScanLine } from 'lucide-react'; +import { Camera, Loader2, ScanLine, Upload } from 'lucide-react'; + +import { useMobileChrome } from '@/components/layout/mobile/mobile-layout-provider'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; @@ -33,9 +35,16 @@ export default function ScanReceiptPage() { const router = useRouter(); const fileInputRef = useRef(null); + const cameraInputRef = useRef(null); const [scanResult, setScanResult] = useState(null); const [previewUrl, setPreviewUrl] = useState(null); + const { setChrome } = useMobileChrome(); + useEffect(() => { + setChrome({ title: 'Scan Receipt', showBackButton: true }); + return () => setChrome({ title: null, showBackButton: false }); + }, [setChrome]); + // Editable fields from scan const [establishment, setEstablishment] = useState(''); const [amount, setAmount] = useState(''); @@ -94,7 +103,7 @@ export default function ScanReceiptPage() { return (
-
+

Scan Receipt

Upload a receipt image and we will extract the expense details automatically. @@ -109,28 +118,44 @@ export default function ScanReceiptPage() { -

fileInputRef.current?.click()} - > - {previewUrl ? ( + {previewUrl ? ( +
fileInputRef.current?.click()} + > Receipt preview - ) : ( -
- -

- Click to upload or drag and drop -

-

- JPEG, PNG, WebP up to 10MB -

-
- )} -
+
+ ) : ( +
+ + +

+ JPEG, PNG, WebP up to 10MB +

+
+ )} + {scanMutation.isPending && (
@@ -222,25 +255,18 @@ export default function ScanReceiptPage() {
{saveMutation.isError && ( -

- {(saveMutation.error as Error).message} -

+

{(saveMutation.error as Error).message}

)}
-
diff --git a/src/app/(dashboard)/[portSlug]/invoices/new/page.tsx b/src/app/(dashboard)/[portSlug]/invoices/new/page.tsx index a3c2cb3..62f55c3 100644 --- a/src/app/(dashboard)/[portSlug]/invoices/new/page.tsx +++ b/src/app/(dashboard)/[portSlug]/invoices/new/page.tsx @@ -1,12 +1,14 @@ 'use client'; -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { useParams, useRouter } from 'next/navigation'; import { useForm, FormProvider } from 'react-hook-form'; import { zodResolver } from '@hookform/resolvers/zod'; import { useMutation } from '@tanstack/react-query'; import { ChevronLeft, ChevronRight, Check, Loader2 } from 'lucide-react'; +import { useMobileChrome } from '@/components/layout/mobile/mobile-layout-provider'; + import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; @@ -46,6 +48,12 @@ export default function NewInvoicePage() { const [step, setStep] = useState(1); + const { setChrome } = useMobileChrome(); + useEffect(() => { + setChrome({ title: 'New Invoice', showBackButton: true }); + return () => setChrome({ title: null, showBackButton: false }); + }, [setChrome]); + const methods = useForm({ resolver: zodResolver(createInvoiceSchema), defaultValues: { @@ -117,8 +125,8 @@ export default function NewInvoicePage() { return (
- {/* Header */} -
+ {/* Header — desktop only; mobile gets the title from the topbar */} +