feat: add debug logging and improve proof-of-payment icon styling
Changes: - Add console.log statements for shareId validation failures in locationActions - Replace DocumentIcon with TicketIcon for proof-of-payment downloads (consistency) - Add teal color to all proof-of-payment icons for visual distinction - Adjust vertical alignment of icons for better visual alignment with text Debug logging helps troubleshoot: - shareId extraction failures - Checksum validation failures - Location not found errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -659,12 +659,14 @@ export const uploadUtilBillsProofOfPayment = async (
|
|||||||
// 1. EXTRACT AND VALIDATE CHECKSUM (stateless, fast)
|
// 1. EXTRACT AND VALIDATE CHECKSUM (stateless, fast)
|
||||||
const extracted = extractShareId(shareId);
|
const extracted = extractShareId(shareId);
|
||||||
if (!extracted) {
|
if (!extracted) {
|
||||||
|
console.log('shareID extraction failed');
|
||||||
return { success: false, error: 'Invalid share link' };
|
return { success: false, error: 'Invalid share link' };
|
||||||
}
|
}
|
||||||
|
|
||||||
const { locationId: locationID, checksum } = extracted;
|
const { locationId: locationID, checksum } = extracted;
|
||||||
|
|
||||||
if (!validateShareChecksum(locationID, checksum)) {
|
if (!validateShareChecksum(locationID, checksum)) {
|
||||||
|
console.log('shareID checksum validation failed');
|
||||||
return { success: false, error: 'Invalid share link' };
|
return { success: false, error: 'Invalid share link' };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -803,6 +805,7 @@ export async function validateShareAccess(
|
|||||||
// 1. Extract locationId and checksum from combined ID
|
// 1. Extract locationId and checksum from combined ID
|
||||||
const extracted = extractShareId(shareId);
|
const extracted = extractShareId(shareId);
|
||||||
if (!extracted) {
|
if (!extracted) {
|
||||||
|
console.log('shareID extraction failed');
|
||||||
return { valid: false, error: 'Invalid share link' };
|
return { valid: false, error: 'Invalid share link' };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -810,6 +813,7 @@ export async function validateShareAccess(
|
|||||||
|
|
||||||
// 2. Validate checksum FIRST (before DB query - stateless validation)
|
// 2. Validate checksum FIRST (before DB query - stateless validation)
|
||||||
if (!validateShareChecksum(locationId, checksum)) {
|
if (!validateShareChecksum(locationId, checksum)) {
|
||||||
|
console.log('shareID checksum validation failed');
|
||||||
return { valid: false, error: 'Invalid share link' };
|
return { valid: false, error: 'Invalid share link' };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -821,6 +825,7 @@ export async function validateShareAccess(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!location) {
|
if (!location) {
|
||||||
|
console.log('Location not found for shareID');
|
||||||
return { valid: false, error: 'Invalid share link' };
|
return { valid: false, error: 'Invalid share link' };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ export const BillEditForm: FC<BillEditFormProps> = ({ location, bill }) => {
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
className='text-center w-full max-w-[20rem] text-nowrap truncate inline-block'
|
className='text-center w-full max-w-[20rem] text-nowrap truncate inline-block'
|
||||||
>
|
>
|
||||||
<TicketIcon className="h-[1em] w-[1em] text-2xl inline-block mr-1 text-teal-500" />
|
<TicketIcon className="h-[1em] w-[1em] text-2xl inline-block mr-1 mt-[-.2em] text-teal-500" />
|
||||||
{decodeURIComponent(proofOfPayment.fileName)}
|
{decodeURIComponent(proofOfPayment.fileName)}
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ export const ViewBillCard: FC<ViewBillCardProps> = ({ location, bill, shareId })
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
className='text-center w-full max-w-[20rem] text-nowrap truncate inline-block'
|
className='text-center w-full max-w-[20rem] text-nowrap truncate inline-block'
|
||||||
>
|
>
|
||||||
<TicketIcon className="h-[1em] w-[1em] text-2xl inline-block mr-1" />
|
<TicketIcon className="h-[1em] w-[1em] text-2xl inline-block mr-1 mt-[-.1em] text-teal-500" />
|
||||||
{ decodeURIComponent(proofOfPaymentFilename) }
|
{ decodeURIComponent(proofOfPaymentFilename) }
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,9 +10,10 @@ import { ViewBillBadge } from "./ViewBillBadge";
|
|||||||
import { Pdf417Barcode } from "./Pdf417Barcode";
|
import { Pdf417Barcode } from "./Pdf417Barcode";
|
||||||
import { EncodePayment, PaymentParams } from "hub-3a-payment-encoder";
|
import { EncodePayment, PaymentParams } from "hub-3a-payment-encoder";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { DocumentIcon, LinkIcon } from "@heroicons/react/24/outline";
|
import { LinkIcon } from "@heroicons/react/24/outline";
|
||||||
import { uploadUtilBillsProofOfPayment } from "../lib/actions/locationActions";
|
import { uploadUtilBillsProofOfPayment } from "../lib/actions/locationActions";
|
||||||
import QRCode from "react-qr-code";
|
import QRCode from "react-qr-code";
|
||||||
|
import { TicketIcon } from "@heroicons/react/24/solid";
|
||||||
|
|
||||||
export interface ViewLocationCardProps {
|
export interface ViewLocationCardProps {
|
||||||
location: BillingLocation;
|
location: BillingLocation;
|
||||||
@@ -199,7 +200,7 @@ export const ViewLocationCard: FC<ViewLocationCardProps> = ({ location, userSett
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
className='text-center w-full max-w-[20rem] text-nowrap truncate inline-block'
|
className='text-center w-full max-w-[20rem] text-nowrap truncate inline-block'
|
||||||
>
|
>
|
||||||
<DocumentIcon className="h-[1em] w-[1em] text-2xl inline-block mr-1" />
|
<TicketIcon className="h-[1em] w-[1em] text-2xl inline-block mr-1 mt-[-.1em] text-teal-500" />
|
||||||
{decodeURIComponent(attachmentFilename)}
|
{decodeURIComponent(attachmentFilename)}
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user