Clean up build errors

This commit is contained in:
2025-09-06 23:40:45 -04:00
parent 6c9fd062e9
commit 459c5092d2
9 changed files with 14 additions and 35 deletions

View File

@@ -203,7 +203,7 @@ export function QuickOrderBuilder({
const [showExcludedOnly, setShowExcludedOnly] = useState<boolean>(false); const [showExcludedOnly, setShowExcludedOnly] = useState<boolean>(false);
const [parsed, setParsed] = useState<boolean>(false); const [parsed, setParsed] = useState<boolean>(false);
const [showMapping, setShowMapping] = useState<boolean>(false); const [showMapping, setShowMapping] = useState<boolean>(false);
const [isPending, startTransition] = useTransition(); const [, startTransition] = useTransition();
const [initialCategories, setInitialCategories] = useState<CategorySummary[] | null>(null); const [initialCategories, setInitialCategories] = useState<CategorySummary[] | null>(null);
// Local storage draft persistence // Local storage draft persistence

View File

@@ -303,7 +303,7 @@ const ValidationCell = React.memo(({
copyDown, copyDown,
rowIndex, rowIndex,
totalRows = 0, totalRows = 0,
editingCells, // editingCells not used; keep setEditingCells for API compatibility
setEditingCells setEditingCells
}: ValidationCellProps) => { }: ValidationCellProps) => {
// Use the CopyDown context // Use the CopyDown context

View File

@@ -564,7 +564,7 @@ const ValidationContainer = <T extends string>({
// Handle supplier + UPC validation - using the most recent values // Handle supplier + UPC validation - using the most recent values
if (key === 'supplier' && value) { if (key === 'supplier' && value) {
// Get the latest UPC value from the updated row // Get the latest UPC value from the updated row
const upcValue = updatedRow.upc || updatedRow.barcode; const upcValue = (data[rowIndex] as any)?.upc || (data[rowIndex] as any)?.barcode;
if (upcValue) { if (upcValue) {
console.log(`Validating UPC: rowIndex=${rowIndex}, supplier=${value}, upc=${upcValue}`); console.log(`Validating UPC: rowIndex=${rowIndex}, supplier=${value}, upc=${upcValue}`);
@@ -661,7 +661,7 @@ const ValidationContainer = <T extends string>({
// Handle UPC/barcode + supplier validation // Handle UPC/barcode + supplier validation
if ((key === 'upc' || key === 'barcode') && value) { if ((key === 'upc' || key === 'barcode') && value) {
// Get latest supplier from the updated row // Get latest supplier from the updated row
const supplier = updatedRow.supplier; const supplier = (data[rowIndex] as any)?.supplier;
if (supplier) { if (supplier) {
console.log(`Validating UPC from UPC change: rowIndex=${rowIndex}, supplier=${supplier}, upc=${value}`); console.log(`Validating UPC from UPC change: rowIndex=${rowIndex}, supplier=${supplier}, upc=${value}`);

View File

@@ -25,7 +25,8 @@ type ErrorType = {
} }
// Stable empty errors array to prevent unnecessary re-renders // Stable empty errors array to prevent unnecessary re-renders
const EMPTY_ERRORS: ErrorType[] = Object.freeze([]); // Use a mutable empty array to satisfy the ErrorType[] type
const EMPTY_ERRORS: ErrorType[] = [];
interface ValidationTableProps<T extends string> { interface ValidationTableProps<T extends string> {
data: RowData<T>[] data: RowData<T>[]

View File

@@ -1,4 +1,4 @@
import React, { useState, useCallback, useTransition, useRef, useEffect, useMemo } from 'react' import React, { useState, useCallback, useMemo } from 'react'
import { Field } from '../../../../types' import { Field } from '../../../../types'
import { Input } from '@/components/ui/input' import { Input } from '@/components/ui/input'
import { cn } from '@/lib/utils' import { cn } from '@/lib/utils'
@@ -17,27 +17,7 @@ interface InputCellProps<T extends string> {
className?: string className?: string
} }
// Add efficient price formatting utility with null safety // (removed unused formatPrice helper)
const formatPrice = (value: any): string => {
// Handle undefined, null, or non-string values
if (value === undefined || value === null) {
return '';
}
// Convert to string if not already
const stringValue = String(value);
// Remove any non-numeric characters except decimal point
const numericValue = stringValue.replace(/[^\d.]/g, '');
// Parse as float and format to 2 decimal places
const numValue = parseFloat(numericValue);
if (!isNaN(numValue)) {
return numValue.toFixed(2);
}
return numericValue;
};
const InputCell = <T extends string>({ const InputCell = <T extends string>({
field, field,

View File

@@ -84,8 +84,6 @@ export const useRowOperations = <T extends string>(
if (rowsWithUniqueErrors.has(rowIdx)) return; if (rowsWithUniqueErrors.has(rowIdx)) return;
if ((rowErrs as any)[fieldKey]) { if ((rowErrs as any)[fieldKey]) {
// Also clear uniqueness errors when the current value is empty
const currentValue = (dataForCalc[rowIdx] as any)?.[fieldKey];
const filtered = (rowErrs as any)[fieldKey].filter((e: ValidationError) => e.type !== ErrorType.Unique); const filtered = (rowErrs as any)[fieldKey].filter((e: ValidationError) => e.type !== ErrorType.Unique);
if (filtered.length > 0) (rowErrs as any)[fieldKey] = filtered; if (filtered.length > 0) (rowErrs as any)[fieldKey] = filtered;
else delete (rowErrs as any)[fieldKey]; else delete (rowErrs as any)[fieldKey];

View File

@@ -142,7 +142,7 @@ export const useValidationState = <T extends string>({
const hasEditingCells = editingCells.size > 0; const hasEditingCells = editingCells.size > 0;
const initialValidationDoneRef = useRef(false); const initialValidationDoneRef = useRef(false);
const isValidatingRef = useRef(false); // isValidatingRef unused; remove to satisfy TS
// Track last seen item_number signature to drive targeted uniqueness checks // Track last seen item_number signature to drive targeted uniqueness checks
const lastItemNumberSigRef = useRef<string | null>(null); const lastItemNumberSigRef = useRef<string | null>(null);

View File

@@ -40,7 +40,7 @@ interface SearchResult {
} }
export function Chat() { export function Chat() {
const { user: currentUser, token } = useContext(AuthContext); const { user: currentUser } = useContext(AuthContext);
const [users, setUsers] = useState<User[]>([]); const [users, setUsers] = useState<User[]>([]);
const [selectedUserId, setSelectedUserId] = useState<string>(''); const [selectedUserId, setSelectedUserId] = useState<string>('');
const [selectedRoomId, setSelectedRoomId] = useState<string | null>(null); const [selectedRoomId, setSelectedRoomId] = useState<string | null>(null);

File diff suppressed because one or more lines are too long