Select and upload templates

This commit is contained in:
adilallo
2026-02-09 19:05:28 -07:00
parent 2e1538770c
commit 4bb6fe0a89
9 changed files with 606 additions and 9 deletions
+4 -9
View File
@@ -42,23 +42,18 @@ export function useMediaQuery(
mediaQuery = query;
}
// Initialize state with current match if available (SSR safety)
const [matches, setMatches] = useState(() => {
if (typeof window === "undefined") {
return false;
}
return window.matchMedia(mediaQuery).matches;
});
// Always start with false so server and first client render match (avoids hydration mismatch).
// Real value is set in useEffect after mount.
const [matches, setMatches] = useState(false);
useEffect(() => {
// Check if window is available (SSR safety)
if (typeof window === "undefined") {
return;
}
const media = window.matchMedia(mediaQuery);
setMatches(media.matches);
// Create listener for changes
const listener = (event: MediaQueryListEvent) => {
setMatches(event.matches);
};