import { useState, useEffect } from 'react' import { type Experiment, type ExperimentRepetition, type User, type ExperimentPhase } from '../lib/supabase' import { RepetitionPhaseSelector } from './RepetitionPhaseSelector' import { PhaseDataEntry } from './PhaseDataEntry' import { RepetitionLockManager } from './RepetitionLockManager' interface RepetitionDataEntryInterfaceProps { experiment: Experiment repetition: ExperimentRepetition currentUser: User onBack: () => void } export function RepetitionDataEntryInterface({ experiment, repetition, currentUser, onBack }: RepetitionDataEntryInterfaceProps) { const [selectedPhase, setSelectedPhase] = useState(null) const [loading, setLoading] = useState(true) const [currentRepetition, setCurrentRepetition] = useState(repetition) useEffect(() => { // Skip loading old data entries - go directly to phase selection setLoading(false) }, [repetition.id, currentUser.id]) const handlePhaseSelect = (phase: ExperimentPhase) => { setSelectedPhase(phase) } const handleBackToPhases = () => { setSelectedPhase(null) } const handleRepetitionUpdated = (updatedRepetition: ExperimentRepetition) => { setCurrentRepetition(updatedRepetition) } if (loading) { return (

Loading...

) } return (
{/* Header */}

Experiment #{experiment.experiment_number} - Repetition #{repetition.repetition_number}

Soaking: {experiment.soaking_duration_hr}h • Air Drying: {experiment.air_drying_time_min}min
Frequency: {experiment.plate_contact_frequency_hz}Hz • Throughput: {experiment.throughput_rate_pecans_sec}/sec
{repetition.scheduled_date && (
Scheduled: {new Date(repetition.scheduled_date).toLocaleString()}
)}
{/* No additional controls needed - phase-specific draft management is handled within each phase */}
{/* Admin Controls */} {/* Main Content */} {selectedPhase ? ( { // Data is automatically saved in the new phase-specific system }} /> ) : ( )}
) }