Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

709 B
Raw Blame
import { isDemoAccountEmail } from '@trek/shared';
import { useAuthStore } from '../../store/authStore';

/**
 * Whether the account signed in here is the shared demo account of a demo
 * instance. Every visitor signs in as that one account, so its Account tab,
 * API keys, MCP configuration, own AI connection and language sit under a
 * DemoLock; the server refuses the same writes (`demo-write.ts`). The admin
 * of a demo instance, and every account of a real one, see the sections as
 * they are.
 */
export function useDemoAccountLock(): boolean {
  const demoMode = useAuthStore((s) => s.demoMode);
  const email = useAuthStore((s) => s.user?.email);
  return demoMode && isDemoAccountEmail(email);
}