Clean up build errors
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -545,4 +545,4 @@ const ValidationCell = React.memo(({
|
|||||||
|
|
||||||
ValidationCell.displayName = 'ValidationCell';
|
ValidationCell.displayName = 'ValidationCell';
|
||||||
|
|
||||||
export default ValidationCell;
|
export default ValidationCell;
|
||||||
|
|||||||
@@ -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}`);
|
||||||
|
|||||||
@@ -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>[]
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -232,4 +212,4 @@ export default React.memo(InputCell, (prev, next) => {
|
|||||||
prev.hasErrors === next.hasErrors &&
|
prev.hasErrors === next.hasErrors &&
|
||||||
prev.disabled === next.disabled &&
|
prev.disabled === next.disabled &&
|
||||||
prev.field === next.field;
|
prev.field === next.field;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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];
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
@@ -319,4 +319,4 @@ export function Chat() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user