@@ -52,7 +52,9 @@ const emptyState: AgentCommsState = {
5252 todos : [ ] ,
5353} ;
5454
55- const useDemoData = import . meta. env . DEV && new URLSearchParams ( window . location . search ) . get ( "demo" ) === "1" ;
55+ const useDemoData =
56+ import . meta. env . VITE_AGENT_COMMS_DEMO === "1" ||
57+ ( import . meta. env . DEV && new URLSearchParams ( window . location . search ) . get ( "demo" ) === "1" ) ;
5658const themePreferenceKey = "agent-comms-theme-mode" ;
5759
5860const nightModeTheme : Record < string , string > = {
@@ -1508,6 +1510,9 @@ export function App() {
15081510
15091511 const operatorRequest = useCallback (
15101512 async ( path : string , options : RequestInit = { } ) => {
1513+ if ( useDemoData ) {
1514+ throw new Error ( "Demo mode uses public sample data and does not write to an operator API." ) ;
1515+ }
15111516 const controller = new AbortController ( ) ;
15121517 const timeout = window . setTimeout ( ( ) => controller . abort ( ) , 8000 ) ;
15131518 const headers : Record < string , string > = {
@@ -1685,17 +1690,23 @@ export function App() {
16851690 } , [ liveSessions , operatorRequest , operatorToken ] ) ;
16861691
16871692 useEffect ( ( ) => {
1693+ if ( useDemoData ) return ;
16881694 void refreshOperatorData ( ) ;
16891695 } , [ refreshOperatorData ] ) ;
16901696
16911697 useEffect ( ( ) => {
1698+ if ( useDemoData ) return ;
16921699 const timer = window . setInterval ( ( ) => {
16931700 void refreshOperatorData ( ) ;
16941701 } , 1000 ) ;
16951702 return ( ) => window . clearInterval ( timer ) ;
16961703 } , [ refreshOperatorData ] ) ;
16971704
16981705 useEffect ( ( ) => {
1706+ if ( useDemoData ) {
1707+ document . title = defaultBranding . appName ;
1708+ return ;
1709+ }
16991710 let cancelled = false ;
17001711 void loadDeploymentBranding ( ) . then ( ( nextBranding ) => {
17011712 if ( cancelled ) return ;
0 commit comments