Merge pull request #40 from vgcman16/codex/check-for-errors-and-bugs

Fix lint and typecheck issues
This commit is contained in:
vgcman16 2025-06-05 21:49:40 -05:00 committed by GitHub
commit 1da8c6d248
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 7 deletions

View File

@ -4,8 +4,7 @@ import { useState, useEffect } from 'react';
* Determine the current viewport width in both browser and server contexts. * Determine the current viewport width in both browser and server contexts.
* When `window` is not available (e.g. during SSR), a fallback width is used. * When `window` is not available (e.g. during SSR), a fallback width is used.
*/ */
const getWidth = (fallback: number): number => const getWidth = (fallback: number): number => (typeof window !== 'undefined' ? window.innerWidth : fallback);
typeof window !== 'undefined' ? window.innerWidth : fallback;
/** /**
* Returns `true` if the viewport width is less than the provided threshold. * Returns `true` if the viewport width is less than the provided threshold.
@ -13,15 +12,16 @@ const getWidth = (fallback: number): number =>
* is undefined. * is undefined.
*/ */
const useViewport = (threshold = 1024, fallbackWidth = 1024) => { const useViewport = (threshold = 1024, fallbackWidth = 1024) => {
const [isSmallViewport, setIsSmallViewport] = useState( const [isSmallViewport, setIsSmallViewport] = useState(getWidth(fallbackWidth) < threshold);
getWidth(fallbackWidth) < threshold,
);
useEffect(() => { useEffect(() => {
if (typeof window === 'undefined') return; if (typeof window === 'undefined') {
return () => {};
}
const handleResize = () => const handleResize = (): void => {
setIsSmallViewport(window.innerWidth < threshold); setIsSmallViewport(window.innerWidth < threshold);
};
window.addEventListener('resize', handleResize); window.addEventListener('resize', handleResize);

View File

@ -76,6 +76,7 @@ class LogStore {
// Migrate from cookies if localStorage is empty but cookie data exists // Migrate from cookies if localStorage is empty but cookie data exists
if (!savedLogs) { if (!savedLogs) {
const cookieLogs = Cookies.get('eventLogs'); const cookieLogs = Cookies.get('eventLogs');
if (cookieLogs) { if (cookieLogs) {
savedLogs = cookieLogs; savedLogs = cookieLogs;
localStorage.setItem('eventLogs', cookieLogs); localStorage.setItem('eventLogs', cookieLogs);

View File

@ -175,6 +175,7 @@
"@types/react": "^18.3.12", "@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1", "@types/react-dom": "^18.3.1",
"@types/react-window": "^1.8.8", "@types/react-window": "^1.8.8",
"@types/unist": "^3.0.3",
"@vitejs/plugin-react": "^4.3.4", "@vitejs/plugin-react": "^4.3.4",
"concurrently": "^8.2.2", "concurrently": "^8.2.2",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",

View File

@ -399,6 +399,9 @@ importers:
'@types/react-window': '@types/react-window':
specifier: ^1.8.8 specifier: ^1.8.8
version: 1.8.8 version: 1.8.8
'@types/unist':
specifier: ^3.0.3
version: 3.0.3
'@vitejs/plugin-react': '@vitejs/plugin-react':
specifier: ^4.3.4 specifier: ^4.3.4
version: 4.3.4(vite@5.4.15(@types/node@22.13.14)(sass-embedded@1.86.0)) version: 4.3.4(vite@5.4.15(@types/node@22.13.14)(sass-embedded@1.86.0))