Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,10 @@ export function DataImportClient() {
<>
<Upload className="mx-auto mb-4 h-6 w-6 text-re-text-tertiary" strokeWidth={1.75} aria-hidden="true" />
<div className="mb-1 text-ui font-medium text-re-text-primary">
Drag &amp; drop your CSV here, or click to browse
Upload a CSV to get started
</div>
<div className="mb-1 text-small text-re-text-secondary">
Drag and drop your CSV here, or click to browse
</div>
<div className="text-small text-re-text-tertiary">
Supports .csv files up to 5MB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from 'lucide-react';
import { toast } from '@/components/ui/use-toast';
import {
parseCSV, validateRecords, generateSampleCSV, generateCsvTemplate, getScoreColor,
parseCSV, validateRecords, generateCsvTemplate, getScoreColor,
getSeverityColor, getSeverityBadgeColor,
type ValidationResult,
} from '../lib/record-validator';
Expand Down Expand Up @@ -182,13 +182,6 @@ export function DrillSimulatorClient() {
}
};

const handleLoadSampleData = async () => {
const csv = generateSampleCSV();
const blob = new Blob([csv], { type: 'text/csv' });
const file = new File([blob], 'sample-records.csv', { type: 'text/csv' });
setState({ ...state, uploadedFile: file });
};

const handleDownloadTemplate = () => {
const csv = generateCsvTemplate();
const blob = new Blob([csv], { type: 'text/csv' });
Expand Down Expand Up @@ -379,12 +372,12 @@ STATUS: ${
className="mx-auto mb-4 text-re-text-tertiary"
/>
<h3 className="mb-2 text-subheading text-re-text-primary">
{state.uploadedFile ? state.uploadedFile.name : 'Drop your file here'}
{state.uploadedFile ? state.uploadedFile.name : 'Upload a CSV to get started'}
</h3>
<p className="text-ui text-re-text-secondary">
{state.uploadedFile
? `${(state.uploadedFile.size / 1024).toFixed(0)} KB`
: 'or click to browse'}
: 'Drop your file here or click to browse'}
</p>
<p className="mt-2 text-small text-re-text-muted">
CSV, TSV, or XLSX • Max 10MB
Expand Down Expand Up @@ -427,9 +420,10 @@ STATUS: ${
<Button
size="lg"
variant="secondary"
onClick={handleLoadSampleData}
onClick={() => fileInputRef.current?.click()}
leadingIcon={<Upload size={18} strokeWidth={1.75} aria-hidden="true" />}
>
Load Sample Data
Upload CSV
</Button>
</div>
</motion.div>
Expand Down
68 changes: 0 additions & 68 deletions frontend/src/app/tools/drill-simulator/lib/record-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -910,74 +910,6 @@ export function generateCsvTemplate(): string {
return `${CSV_TEMPLATE_HEADERS}\n`;
}

export function generateSampleCSV(): string {
const lines = [
'Event Type,Product,Lot Code,GTIN,Facility GLN,Source GLN,Destination GLN,Timestamp,Quantity,Unit of Measure,Reference Document',
];

// Harvest/Create
lines.push(
'Create,Romaine Lettuce: Head,LOT-2024-001,0123456789012,1234567890128,1234567890128,3456789012345,2024-01-15T08:30:00Z,500,cases,FARM-001-DOC'
);

// First transformation
lines.push(
'Transform,Romaine Lettuce: Packaged,LOT-2024-001,0123456789029,3456789012345,,3456789012345,2024-01-15T12:00:00Z,480,cases,PKG-2024-001'
);

// Ship from packer
lines.push(
'Ship,Romaine Lettuce: Packaged,LOT-2024-001,0123456789029,3456789012345,3456789012345,5678901234567,2024-01-16T14:00:00Z,480,cases,BOL-2024-001'
);

// Receive at distributor
lines.push(
'Receive,Romaine Lettuce: Packaged,LOT-2024-001,0123456789029,5678901234567,3456789012345,5678901234567,2024-01-17T08:30:00Z,475,cases,RCV-2024-001'
);

// Ship from distributor
lines.push(
'Ship,Romaine Lettuce: Packaged,LOT-2024-001,0123456789029,5678901234567,5678901234567,7890123456789,2024-01-18T10:00:00Z,450,cases,BOL-2024-002'
);

// Receive at retailer
lines.push(
'Receive,Romaine Lettuce: Packaged,LOT-2024-001,0123456789029,7890123456789,5678901234567,7890123456789,2024-01-18T15:30:00Z,450,cases,RCV-2024-002'
);

// Different lot - intentionally missing some KDEs
lines.push('Create,Spinach: Bulk,LOT-2024-002,,1234567890135,1234567890135,3456789012352,2024-01-15T07:00:00Z,800,cases,');

lines.push('Ship,Spinach: Bulk,LOT-2024-002,,3456789012352,3456789012352,5678901234574,2024-01-16T16:00:00Z,800,,BOL-2024-003');

lines.push('Receive,Spinach: Bulk,LOT-2024-002,,5678901234574,3456789012352,5678901234574,2024-01-17T09:00:00Z,800,cases,');

// Third lot with time gap
lines.push(
'Create,Tomatoes: Vine Ripe,LOT-2024-003,0123456789036,1234567890142,1234567890142,3456789012359,2024-01-10T06:00:00Z,1200,cases,FARM-003'
);

lines.push(
'Ship,Tomatoes: Vine Ripe,LOT-2024-003,0123456789036,3456789012359,3456789012359,5678901234581,2024-01-10T14:00:00Z,1200,cases,BOL-2024-004'
);

// Large gap here - 3 days
lines.push(
'Receive,Tomatoes: Vine Ripe,LOT-2024-003,0123456789036,5678901234581,3456789012359,5678901234581,2024-01-13T10:30:00Z,1150,cases,RCV-2024-003'
);

// Fourth lot with unmatched ship (no receive)
lines.push(
'Create,Cucumbers,LOT-2024-004,0123456789043,1234567890159,1234567890159,3456789012366,2024-01-14T08:00:00Z,600,cases,FARM-004'
);

lines.push(
'Ship,Cucumbers,LOT-2024-004,0123456789043,3456789012366,3456789012366,5678901234598,2024-01-15T12:00:00Z,600,cases,BOL-2024-005'
);

return lines.join('\n');
}

/**
* Design-system colour helpers.
*
Expand Down
3 changes: 0 additions & 3 deletions scripts/copy-lint/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@
"frontend/src/app/sysadmin/page.tsx": {
"dash-placeholder": 3
},
"frontend/src/app/tools/drill-simulator/components/DrillSimulatorClient.tsx": {
"sample-demo": 1
},
"frontend/src/app/tools/export/page.tsx": {
"empty-render": 2
},
Expand Down
Loading