feat: finalize academy redesign and production readiness
Align admin, community, search, library, learning and course management with the mockup. Add saved courses, download history, public community feed, instructor directory, backend search, course views, admin content tools and community moderation. Harden API and Nginx for production.
This commit is contained in:
18
hooks/useMediaQuery.ts
Normal file
18
hooks/useMediaQuery.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export const MOBILE_QUERY = '(max-width: 900px)';
|
||||
|
||||
export const useMediaQuery = (query: string) => {
|
||||
const [matches, setMatches] = useState(() => typeof window !== 'undefined' && window.matchMedia(query).matches);
|
||||
useEffect(() => {
|
||||
const media = window.matchMedia(query);
|
||||
const update = () => setMatches(media.matches);
|
||||
update();
|
||||
media.addEventListener('change', update);
|
||||
return () => media.removeEventListener('change', update);
|
||||
}, [query]);
|
||||
return matches;
|
||||
};
|
||||
|
||||
/** Mobile (≤900px) has its own navigation and screens, not the desktop squeezed. */
|
||||
export const useIsMobile = () => useMediaQuery(MOBILE_QUERY);
|
||||
Reference in New Issue
Block a user