fix dual device and calendar display bug
This commit is contained in:
@@ -18,11 +18,16 @@ export default function DayColumn({
|
||||
const dayName = DAY_NAMES[date.getDay()]
|
||||
const dayNum = date.getDate()
|
||||
const dateKey = date.toISOString().slice(0, 10)
|
||||
const nextDateKey = new Date(date.getTime() + (24 * 60 * 60 * 1000)).toISOString().slice(0, 10)
|
||||
|
||||
function getWindowForShift(shiftIndex) {
|
||||
return windowLookup.get(`${dateKey}::shift${shiftIndex}`) ?? null
|
||||
}
|
||||
|
||||
function getNextDayShift1Window() {
|
||||
return windowLookup.get(`${nextDateKey}::shift1`) ?? null
|
||||
}
|
||||
|
||||
const shift2Visible = showShift2 || shifts.shift2.length > 0 || Boolean(getWindowForShift(2))
|
||||
|
||||
return (
|
||||
@@ -65,7 +70,7 @@ export default function DayColumn({
|
||||
tests={nextDayShift1}
|
||||
visible={true}
|
||||
active={nextDayShift1Active}
|
||||
windowDetails={null}
|
||||
windowDetails={getNextDayShift1Window()}
|
||||
minContentRows={shiftMinRows.nextDayShift1}
|
||||
slotHeightPx={slotHeights.nextDayShift1}
|
||||
onWindowSelect={onWindowSelect}
|
||||
|
||||
@@ -259,9 +259,9 @@ export default function SettingsModal({ isOpen, onClose, settings, onSave }) {
|
||||
Holidays
|
||||
</p>
|
||||
<Field label="Holiday Dates" hint="(comma-separated, YYYY-MM-DD)">
|
||||
<input
|
||||
type="text"
|
||||
<textarea
|
||||
className={INPUT_CLS}
|
||||
rows={4}
|
||||
placeholder="2026-07-04, 2026-12-25…"
|
||||
value={form.holidays ?? ''}
|
||||
onChange={(e) => set('holidays', e.target.value)}
|
||||
|
||||
@@ -42,7 +42,12 @@ export default function ShiftSlot({
|
||||
style={{ minHeight: `${minContentHeightPx}px` }}
|
||||
>
|
||||
{tests.length === 0 ? null : (
|
||||
tests.map((test) => <TestCard key={`${test.test_id}-${test.device}`} test={test} />)
|
||||
tests.map((test, index) => (
|
||||
<TestCard
|
||||
key={`${test.test_id}-${test.device}-${test.scheduled_date ?? 'na'}-${test.shift_index ?? 'na'}-${test.sequence_in_shift ?? index}`}
|
||||
test={test}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -183,6 +183,10 @@ function TestRow({ test }) {
|
||||
|
||||
export default function TestWindowDetailsPanel({ isOpen, windowDetails, onClose }) {
|
||||
const [showConfigMap, setShowConfigMap] = useState(false)
|
||||
const windowTests = useMemo(
|
||||
() => (Array.isArray(windowDetails?.tests) ? windowDetails.tests : []),
|
||||
[windowDetails],
|
||||
)
|
||||
const windowTestConfig = useMemo(() => getWindowTestConfig(windowDetails), [windowDetails])
|
||||
const windowConfigMapKey = useMemo(
|
||||
() => (windowTestConfig.length > 0 ? String(windowTestConfig[0]).toUpperCase() : null),
|
||||
@@ -311,12 +315,15 @@ export default function TestWindowDetailsPanel({ isOpen, windowDetails, onClose
|
||||
<div className="mt-5">
|
||||
<div className="flex items-center justify-between gap-3 mb-3">
|
||||
<p className="text-sm font-semibold text-white">Tests Scheduled In This Window</p>
|
||||
<span className="text-xs text-gray-500">{windowDetails.tests?.length ?? 0} tests</span>
|
||||
<span className="text-xs text-gray-500">{windowTests.length} tests</span>
|
||||
</div>
|
||||
{windowDetails.tests?.length ? (
|
||||
{windowTests.length ? (
|
||||
<div className="flex flex-col gap-3">
|
||||
{windowDetails.tests.map((test) => (
|
||||
<TestRow key={`${test.test_id}-${test.device}-${test.scheduled_date}-${test.shift_index}`} test={test} />
|
||||
{windowTests.map((test, index) => (
|
||||
<TestRow
|
||||
key={`${test.test_id}-${test.device}-${test.scheduled_date ?? 'na'}-${test.shift_index ?? 'na'}-${test.sequence_in_shift ?? index}`}
|
||||
test={test}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user