Description
All authenticated users who navigate to an invoice detail URL can see and interact with action buttons regardless of whether they are the creator, a recipient, or an unrelated party. Role-based UI gating must ensure only authorized parties see the correct actions and data.
Technical Context
src/app/invoice/[id]/page.tsx fetches the invoice and compares invoice.creatorPublicKey and invoice.recipients[].publicKey against the connected wallet's public key from src/context/WalletContext.tsx. A src/hooks/useInvoiceRole.ts (new) hook returns 'creator' | 'recipient' | 'viewer'. Action buttons, edit links, and sensitive financial breakdowns are conditionally rendered based on the role. Unauthorized direct API calls are blocked server-side in src/app/api/invoices/[id]/route.ts.
Acceptance Criteria
Description
All authenticated users who navigate to an invoice detail URL can see and interact with action buttons regardless of whether they are the creator, a recipient, or an unrelated party. Role-based UI gating must ensure only authorized parties see the correct actions and data.
Technical Context
src/app/invoice/[id]/page.tsxfetches the invoice and comparesinvoice.creatorPublicKeyandinvoice.recipients[].publicKeyagainst the connected wallet's public key fromsrc/context/WalletContext.tsx. Asrc/hooks/useInvoiceRole.ts(new) hook returns'creator' | 'recipient' | 'viewer'. Action buttons, edit links, and sensitive financial breakdowns are conditionally rendered based on the role. Unauthorized direct API calls are blocked server-side insrc/app/api/invoices/[id]/route.ts.Acceptance Criteria
creatorsee edit, clone, cancel, and release actionsrecipientsee their own payment status and a "Pay my share" actionviewersee only publicly available invoice metadata with no action buttons