import { useCallback, useEffect, useState } from 'react' import { api, isDesktop, message } from './bridge.js' import { usePolled } from './hooks.js' import * as Icon from './ui/icons.jsx' import logo from './assets/loyaly-mark.png' import Login from './views/Login.jsx' import Setup from './views/Setup.jsx' import Live from './views/Live.jsx' import Customers from './views/Customers.jsx' import Cameras from './views/Cameras.jsx' // Three screens, and the trim is by AUDIENCE rather than by taste. // // This window runs on a PC behind a counter, and the person in front of it can // act on exactly three things: is it working, who is this customer, and is the // camera set up. Footfall and Sales answer a different person's questions - an // owner comparing shops, who is not standing in one - and they now live on the // head-office platform where a comparison across sites is even possible. A // month-on-month chart on a shop PC was a report nobody there could act on, // competing for the attention of somebody with a customer waiting. // // `cloud` marks a screen that cannot work without head office. A PC set up on // its own hides those rather than showing a screen that can only ever fail: // the customer record lives on the server, the cameras and what this PC is // seeing do not. const VIEWS = [ { id: 'live', label: 'Live', Glyph: Icon.Live, View: Live }, { id: 'customers', label: 'Customers', Glyph: Icon.People, View: Customers, cloud: true }, { id: 'cameras', label: 'Cameras', Glyph: Icon.Camera, View: Cameras }, ] export default function App() { const [session, setSession] = useState(null) const [view, setView] = useState('live') const [booting, setBooting] = useState(true) // A standalone PC can join head office later. That is the same Setup screen, // reached deliberately rather than because the app will not open otherwise. const [linking, setLinking] = useState(false) useEffect(() => { (async () => { try { setSession(await api.session()) } catch { setSession(null) } setBooting(false) })() }, []) if (!isDesktop()) { // The frontend can be served by `npm run dev` for styling work, where the // Go bindings do not exist. Saying so beats a blank screen and a console // error nobody will read. return (
This is the Behavision window running outside the app, so it has no connection to the recognition engine. Launch the Behavision application instead.
Starting…