feat: recreate dashboard page from previous version

This commit is contained in:
Sonny
2024-05-03 02:10:15 +02:00
committed by Sonny
parent 2cc490b611
commit 2cf8c5ae02
66 changed files with 2087 additions and 86 deletions

View File

@@ -0,0 +1,24 @@
import { useEffect, useState } from 'react';
export function useMediaQuery(query: string): boolean {
const [matches, setMatches] = useState<boolean>(false);
const handleMediaChange = () => setMatches(getMediaMatches(query));
useEffect(() => {
const matchMedia = window.matchMedia(query);
handleMediaChange();
matchMedia.addEventListener('change', handleMediaChange);
return () => matchMedia.removeEventListener('change', handleMediaChange);
}, [query]);
return matches;
}
function getMediaMatches(query: string): boolean {
if (typeof window !== 'undefined') {
return window.matchMedia(query).matches;
}
return false;
}