Skip to content

Lock Provider

Global lock-state provider for the app UI.

Current implementation details:

  • Persists lock state in local storage (app_locked_v1)
  • Syncs lock state across tabs/windows
  • Hides lock screen on auth pages (/login, /logout, /reset-password, /account)
  • Clears lock state when session becomes unauthenticated
import { LockProvider } from "@/context/LockProvider";
export function AppRoot() {
return (
<LockProvider>
<AppShell />
</LockProvider>
);
}
interface LockContextValue {
locked: boolean;
lock: () => void;
unlock: () => void;
}
import { useLock } from "@/context/LockProvider";
function LockButton() {
const { lock } = useLock();
return <button onClick={lock}>Lock</button>;
}