- Add 115+ unit, component, and E2E tests - Add Vitest configuration with coverage thresholds - Add validation schema tests (validations.test.ts) - Add sanitizer utility tests (sanitizer.test.ts) - Add WhatsApp service tests (whatsapp.test.ts) - Add component tests for UnifiedTypography and UnifiedSurface - Add E2E tests for admin auth and public pages - Add testing documentation (docs/TESTING.md) - Add sanitizer and WhatsApp utilities - Add centralized validation schemas - Refactor state management (admin/public separation) - Fix security issues (OTP via POST, session password validation) - Update AGENTS.md with testing guidelines Test Coverage: 50%+ target achieved All tests passing: 115/115 Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
48 lines
982 B
TypeScript
48 lines
982 B
TypeScript
/**
|
|
* Admin Navigation State
|
|
*
|
|
* State management untuk navigasi admin dashboard
|
|
* Menggunakan Valtio untuk reactive state
|
|
*/
|
|
|
|
import { proxy } from "valtio";
|
|
import type { MenuItem } from "../../../types/menu-item";
|
|
|
|
export const adminNavState = proxy<{
|
|
hover: boolean;
|
|
item: MenuItem[] | null;
|
|
isSearch: boolean;
|
|
module: string | null;
|
|
mobileOpen: boolean;
|
|
clear: () => void;
|
|
setModule: (module: string | null) => void;
|
|
toggleMobile: () => void;
|
|
}>({
|
|
hover: false,
|
|
item: null,
|
|
isSearch: false,
|
|
module: null,
|
|
mobileOpen: false,
|
|
|
|
clear() {
|
|
adminNavState.hover = false;
|
|
adminNavState.item = null;
|
|
adminNavState.isSearch = false;
|
|
},
|
|
|
|
setModule(module: string | null) {
|
|
adminNavState.module = module;
|
|
},
|
|
|
|
toggleMobile() {
|
|
adminNavState.mobileOpen = !adminNavState.mobileOpen;
|
|
},
|
|
});
|
|
|
|
// Helper hook untuk React components
|
|
export const useAdminNav = () => {
|
|
return adminNavState;
|
|
};
|
|
|
|
export default adminNavState;
|