TypeScript and ESLint fixes: - Fixed unescaped quotes in report-timeline.tsx (ESLint error) - Restored database.types.ts from git history (was empty) - Added reports table type definition to database.types.ts - Fixed missing getCookieHeader import in intakes/actions.ts - Fixed use-media-query.ts ternary operator (TypeScript error) - Simplified z.enum() in report.ts (removed unsupported error options) All type checking and linting now passes successfully. Build tested locally and ready for Vercel deployment. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
24 lines
664 B
TypeScript
24 lines
664 B
TypeScript
'use client';
|
|
|
|
import { useEffect, useState } from 'react';
|
|
|
|
export function useMediaQuery(query: string) {
|
|
const [matches, setMatches] = useState(false);
|
|
|
|
useEffect(() => {
|
|
if (typeof window === 'undefined') return;
|
|
const mediaQuery = window.matchMedia(query);
|
|
const handleChange = (event: MediaQueryListEvent | MediaQueryList) => {
|
|
setMatches(event.matches);
|
|
};
|
|
|
|
setMatches(mediaQuery.matches);
|
|
|
|
const listener = (event: MediaQueryListEvent) => handleChange(event);
|
|
mediaQuery.addEventListener?.('change', listener);
|
|
return () => mediaQuery.removeEventListener?.('change', listener);
|
|
}, [query]);
|
|
|
|
return matches;
|
|
}
|