import { Suspense } from "react"; import Link from "next/link"; import { HydrateClient } from "~/trpc/server"; import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card"; import { Button } from "~/components/ui/button"; import { Badge } from "~/components/ui/badge"; import { PageHeader } from "~/components/layout/page-header"; import { CSVImportPage } from "~/components/csv-import-page"; import { ArrowLeft, Upload, FileText, Download, CheckCircle, AlertCircle, Info, FileSpreadsheet, } from "lucide-react"; // File Upload Instructions Component function FormatInstructions() { return (
{/* Required Format */} Required CSV Format

DATE,DESCRIPTION,HOURS,RATE,AMOUNT

Required Columns:

{[ { field: "DATE", desc: "Date of work (M/DD/YY format)" }, { field: "DESCRIPTION", desc: "Description of work performed" }, { field: "HOURS", desc: "Number of hours worked" }, { field: "RATE", desc: "Hourly rate (decimal)" }, { field: "AMOUNT", desc: "Total amount (calculated from hours × rate)", }, ].map((col) => (
{col.field} {col.desc}
))}

File Naming:

Name your CSV files in{" "} YYYY-MM-DD.csv {" "} format for automatic date detection.

{/* Sample Data & Download */} Sample Template

Download our sample CSV template to see the exact format required for importing time entries.

Pro Tip

The template includes sample data and formatting examples to help you get started quickly.

Sample Row:

1/15/24,"Web development work",8,75.00,600.00

Sample Filename:

2024-01-15.csv

); } // Important Notes Section function ImportantNotes() { return ( Important Notes

Before Importing:

  • • Use M/DD/YY format for dates (e.g., 1/15/24)
  • • Ensure rates are in decimal format (e.g., 75.50)
  • • File names should follow YYYY-MM-DD.csv format
  • • Select a client before importing

What Happens:

  • • Each CSV file creates one invoice
  • • Invoice dates are derived from filename
  • • Invoices are created in "draft" status
  • • You can review and edit before sending
); } // File Format Help Section function FileFormatHelp() { return ( Supported File Formats

CSV Files

Comma-separated values from Excel, Google Sheets, or any CSV editor

Max Size

Up to 10MB per file with no limit on number of rows

Validation

Real-time validation with clear error messages and feedback

); } export default async function ImportPage() { return (
{/* Main CSV Import Component */} {/* File Format Help */} {/* Format Instructions */} {/* Important Notes */}
); }