initial commit

This commit is contained in:
Sone
2026-05-19 18:46:16 +02:00
parent a92d70ca74
commit 7e67fa8ea0
33 changed files with 6316 additions and 3952 deletions
+2 -6
View File
@@ -1,16 +1,12 @@
import { useState, useEffect } from "react";
import { debounce } from "lodash";
export const useDebounce = <T>(value: T, delay = 300): T => {
const [debouncedValue, setDebouncedValue] = useState(value);
useEffect(() => {
const handler = debounce(() => setDebouncedValue(value), delay);
const handler = setTimeout(() => setDebouncedValue(value), delay);
handler();
return () => {
handler.cancel();
};
return () => clearTimeout(handler);
}, [value, delay]);
return debouncedValue;
+1
View File
@@ -17,6 +17,7 @@ export const useRoleAccess = () => {
isManager,
hasAccess: (level: RoleEnum) => {
const hierarchy = [RoleEnum.USER, RoleEnum.ADMIN, RoleEnum.MANAGER];
return (
currentRole !== undefined &&
hierarchy.indexOf(currentRole) >= hierarchy.indexOf(level)