feat: auto-open LitterForm with prefill when navigated from BreedingCalendar
This commit is contained in:
@@ -14,6 +14,17 @@ function LitterList() {
|
||||
|
||||
useEffect(() => {
|
||||
fetchLitters()
|
||||
// Auto-open form with prefill from BreedingCalendar "Record Litter" CTA
|
||||
const stored = sessionStorage.getItem('prefillLitter')
|
||||
if (stored) {
|
||||
try {
|
||||
const data = JSON.parse(stored)
|
||||
setPrefill(data)
|
||||
setEditingLitter(null)
|
||||
setShowForm(true)
|
||||
} catch (e) { /* ignore */ }
|
||||
sessionStorage.removeItem('prefillLitter')
|
||||
}
|
||||
}, [])
|
||||
|
||||
const fetchLitters = async () => {
|
||||
@@ -96,7 +107,7 @@ function LitterList() {
|
||||
<div style={{ display: 'flex', gap: '1.5rem', flexWrap: 'wrap', color: 'var(--text-secondary)', fontSize: '0.9rem' }}>
|
||||
<span>📅 Bred: {new Date(litter.breeding_date).toLocaleDateString()}</span>
|
||||
{litter.whelping_date && (
|
||||
<span>🐕 Whelped: {new Date(litter.whelping_date).toLocaleDateString()}</span>
|
||||
<span>💕 Whelped: {new Date(litter.whelping_date).toLocaleDateString()}</span>
|
||||
)}
|
||||
<span style={{ color: 'var(--accent)', fontWeight: 600 }}>
|
||||
{litter.actual_puppy_count ?? litter.puppies?.length ?? litter.puppy_count ?? 0} puppies
|
||||
|
||||
Reference in New Issue
Block a user