>(undefined)
const scene = scenes[sceneIndex]
- useEffect(() => {
- prefersReducedMotion.current = window.matchMedia('(prefers-reduced-motion: reduce)').matches
- setIsMobile(window.innerWidth < 640)
-
- const handleResize = () => setIsMobile(window.innerWidth < 640)
- window.addEventListener('resize', handleResize)
- return () => window.removeEventListener('resize', handleResize)
- }, [])
-
const queryText = isMobile && scene.mobileQuery ? scene.mobileQuery : scene.query
const columns = isMobile && scene.results.mobileColumns ? scene.results.mobileColumns : scene.results.columns
const rows = isMobile && scene.results.mobileRows ? scene.results.mobileRows : scene.results.rows
const handleTypingComplete = useCallback(() => {
- if (prefersReducedMotion.current) {
+ if (prefersReducedMotion) {
setPhase('results')
setVisibleRows(rows.length)
return
@@ -153,7 +177,7 @@ export function HeroTerminal() {
setPhase('results')
setVisibleRows(0)
}, 400)
- }, [rows.length])
+ }, [rows.length, prefersReducedMotion])
const { text: typedQuery, isComplete: typingDone } = useTypewriter({
text: queryText,
@@ -163,10 +187,7 @@ export function HeroTerminal() {
useEffect(() => {
if (phase !== 'results') return
- if (prefersReducedMotion.current) {
- setVisibleRows(rows.length)
- return
- }
+ if (prefersReducedMotion) return
if (visibleRows < rows.length) {
const timer = setTimeout(() => {
@@ -187,10 +208,10 @@ export function HeroTerminal() {
return () => {
if (sceneTimerRef.current) clearTimeout(sceneTimerRef.current)
}
- }, [phase, visibleRows, rows.length])
+ }, [phase, visibleRows, rows.length, prefersReducedMotion])
const showCursor = phase === 'typing' && !typingDone
- const showResults = phase === 'results' || (prefersReducedMotion.current && typingDone)
+ const showResults = phase === 'results' || (prefersReducedMotion && typingDone)
const executingDots = useMemo(() => {
if (phase !== 'executing') return ''
@@ -234,7 +255,7 @@ export function HeroTerminal() {
0 || prefersReducedMotion.current ? 1 : 0,
+ opacity: visibleRows > 0 || prefersReducedMotion ? 1 : 0,
transition: 'opacity 0.2s ease',
}}
>
@@ -280,12 +301,12 @@ export function HeroTerminal() {
className="mt-3 pt-2 border-t border-[--color-border-subtle] text-[--color-text-muted] text-[10px] sm:text-xs"
style={{
opacity: 1,
- animation: prefersReducedMotion.current
+ animation: prefersReducedMotion
? 'none'
: 'fade-in-up 0.3s ease forwards',
}}
>
- {rows.length} row{rows.length !== 1 ? 's' : ''} returned · {(Math.random() * 3 + 0.5).toFixed(1)}ms
+ {rows.length} row{rows.length !== 1 ? 's' : ''} returned · 1.7ms
)}
diff --git a/apps/web/src/instrumentation-client.ts b/apps/web/src/instrumentation-client.ts
index ee74ef8..f77e411 100644
--- a/apps/web/src/instrumentation-client.ts
+++ b/apps/web/src/instrumentation-client.ts
@@ -18,3 +18,5 @@ Sentry.init({
}),
],
})
+
+export const onRouterTransitionStart = Sentry.captureRouterTransitionStart