Initial commit: Complete NodeJS-native setup

- Migrated from Python pre-commit to NodeJS-native solution
- Reorganized documentation structure
- Set up Husky + lint-staged for efficient pre-commit hooks
- Fixed Dockerfile healthcheck issue
- Added comprehensive documentation index
This commit is contained in:
William Valentin
2025-09-06 01:42:48 -07:00
commit e48adbcb00
159 changed files with 24405 additions and 0 deletions

29
hooks/useLocalStorage.ts Normal file
View File

@@ -0,0 +1,29 @@
// FIX: This file was empty. Added a standard implementation for the useLocalStorage hook.
import { useState, useEffect, Dispatch, SetStateAction } from 'react';
function getStoredValue<T>(key: string, defaultValue: T): T {
if (typeof window === 'undefined') {
return defaultValue;
}
const saved = localStorage.getItem(key);
try {
return saved ? JSON.parse(saved) : defaultValue;
} catch (e) {
return defaultValue;
}
}
export function useLocalStorage<T>(
key: string,
defaultValue: T
): [T, Dispatch<SetStateAction<T>>] {
const [value, setValue] = useState<T>(() =>
getStoredValue(key, defaultValue)
);
useEffect(() => {
localStorage.setItem(key, JSON.stringify(value));
}, [key, value]);
return [value, setValue];
}