fix(build): add ScrollTrigger component, fix JSX syntax, dedup i18n

- Add missing ScrollTrigger component for infinite scroll
- Fix JSX placement inside ternary expression
- Remove 290 duplicate i18n keys across 13 translation files
- Fix it.ts duplicate memories.saveError
This commit is contained in:
Maurice
2026-04-13 21:55:59 +02:00
parent 87de60d8de
commit 88e1d075e0
14 changed files with 20 additions and 302 deletions
+20 -11
View File
@@ -1352,6 +1352,24 @@ function WeatherChip({ weather }: { weather: string }) {
)
}
// ── Scroll Trigger ───────────────────────────────────────────────────────
function ScrollTrigger({ onVisible, loading }: { onVisible: () => void; loading: boolean }) {
const ref = useRef<HTMLDivElement>(null)
useEffect(() => {
const el = ref.current
if (!el) return
const obs = new IntersectionObserver(([entry]) => { if (entry.isIntersecting && !loading) onVisible() }, { rootMargin: '200px' })
obs.observe(el)
return () => obs.disconnect()
}, [onVisible, loading])
return (
<div ref={ref} className="flex justify-center py-4 mt-2">
<div className="w-5 h-5 border-2 border-zinc-300 border-t-zinc-900 dark:border-zinc-600 dark:border-t-white rounded-full animate-spin" />
</div>
)
}
// ── Provider Picker ───────────────────────────────────────────────────────
function ProviderPicker({ provider, userId, entries, trips, existingAssetIds, onClose, onAdd }: {
@@ -1698,18 +1716,9 @@ function ProviderPicker({ provider, userId, entries, trips, existingAssetIds, on
</div>
)
})}
{/* Infinite scroll trigger */}
{hasMore && <ScrollTrigger onVisible={loadMorePhotos} loading={loadingMore} />}
</div>
{/* Infinite scroll trigger */}
{hasMore && (
<div className="flex justify-center py-4 mt-2" ref={el => {
if (!el) return
const obs = new IntersectionObserver(([entry]) => { if (entry.isIntersecting) loadMorePhotos() }, { rootMargin: '200px' })
obs.observe(el)
return () => obs.disconnect()
}}>
<div className="w-5 h-5 border-2 border-zinc-300 border-t-zinc-900 dark:border-zinc-600 dark:border-t-white rounded-full animate-spin" />
</div>
)}
)}
</div>