{"version":3,"sources":["api/index.ts","pages/Dashboard.tsx","pages/SessionPictures.tsx","pages/Session.tsx","App.tsx","reportWebVitals.ts","index.tsx"],"names":["createClient","body","a","axios","post","res","data","client_id","getClient","id","get","startSession","clientId","getSession","killSession","delete","restartSession","Dashboard","history","useHistory","useState","error","setError","name","setName","email","setEmail","phone","setPhone","handleSubmit","e","preventDefault","length","message","parseInt","push","title","subTitle","onSubmit","htmlFor","minLength","value","onChange","target","type","danger","onClick","htmlType","className","SessionPictures","urls","setUrls","activeUrl","setActiveUrl","setLoading","useEffect","interval","setInterval","photos","clearInterval","closeModal","visible","onOk","cancelText","onCancel","width","src","alt","sort","b","split","localeCompare","map","Session","props","match","params","setClient","active","setActive","handleStartSession","loading","handleRestartSession","handleExit","handleNuke","success","client","has_photos","ghost","onBack","goBack","tags","color","extra","disabled","onConfirm","console","log","process","App","path","component","exact","reportWebVitals","onPerfEntry","Function","then","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","render","document","getElementById"],"mappings":"qTAQaA,EAAY,uCAAG,WAAOC,GAAP,eAAAC,EAAA,sEACRC,IAAMC,KAAN,eAAkDH,GAD1C,cACpBI,EADoB,yBAEnBA,EAAIC,KAAKC,WAFU,2CAAH,sDAKZC,EAAS,uCAAG,WAAOC,GAAP,eAAAP,EAAA,sEACLC,IAAMO,IAAN,uBAAkCD,IAD7B,cACjBJ,EADiB,yBAEhBA,EAAIC,MAFY,2CAAH,sDAITK,EAAY,uCAAG,WAAOC,GAAP,eAAAV,EAAA,sEACRC,IAAMC,KAAN,uBAA2BQ,EAA3B,aADQ,cACpBP,EADoB,yBAEnBA,EAAIC,MAFe,2CAAH,sDAKZO,EAAU,uCAAG,WAAOD,GAAP,eAAAV,EAAA,sEACNC,IAAMO,IAAN,uBACAE,EADA,aADM,cAClBP,EADkB,yBAIjBA,EAAIC,MAJa,2CAAH,sDAOVQ,EAAW,uCAAG,WAAOF,GAAP,SAAAV,EAAA,sEACnBC,IAAMY,OAAN,uBAA6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C,MAAM,kBACN2D,UAAWb,EAHb,SAKE,cAAC,IAAD,CAAQtC,KAAK,UAAUkD,UAAWhB,EAAlC,4BAJI,SAQN,cAAC,IAAD,CAEE1C,MAAM,6CACN2D,UAAWX,EAHb,SAKE,cAAC,IAAD,CAAQvC,QAAM,EAACiD,UAAWhB,EAA1B,4BAJI,QAQN,cAAC,IAAD,CAEEU,OAAK,EACL5C,KAAK,UACLkD,UAAWhB,EACXhC,QAASqC,EALX,2BACM,aAUV,cAAC,IAAD,IACA,cAAC,IAAD,CAAKnC,UAAU,WAAf,SACG8B,GAAU,cAAC,EAAD,CAAiBlE,SAAUA,UCpG9CoF,QAAQC,IAAI,MAAOC,cAeJC,MAbf,WACE,OACE,cAAC,IAAD,UACE,qBAAKnD,UAAU,MAAf,SACE,eAAC,IAAD,WACE,cAAC,IAAD,CAAOoD,KAAK,sBAAsBC,UAAW5B,IAC7C,cAAC,IAAD,CAAO6B,OAAK,EAACF,KAAK,IAAIC,UAAWpF,YCD5BsF,EAZS,SAACC,GACnBA,GAAeA,aAAuBC,UACxC,8BAAqBC,MAAK,YAAkD,IAA/CC,EAA8C,EAA9CA,OAAQC,EAAsC,EAAtCA,OAAQC,EAA8B,EAA9BA,OAAQC,EAAsB,EAAtBA,OAAQC,EAAc,EAAdA,QAC3DJ,EAAOH,GACPI,EAAOJ,GACPK,EAAOL,GACPM,EAAON,GACPO,EAAQP,OCFdQ,IAASC,OAAO,cAAC,EAAD,IAASC,SAASC,eAAe,SAKjDZ,M","file":"static/js/main.eb0b3235.chunk.js","sourcesContent":["import { Client } from '../types'\nimport axios from 'axios'\n\nif (process.env.NODE_ENV === 'development') {\n const host = 'http://192.168.1.107:5000'\n axios.defaults.baseURL = host\n}\n\nexport const createClient = async (body: Omit) => {\n const res = await axios.post<{ client_id: string }>(`/api/clients`, body)\n return res.data.client_id\n}\n\nexport const getClient = async (id: string): Promise => {\n const res = await axios.get(`/api/clients/${id}`)\n return res.data\n}\nexport const startSession = async (clientId: string) => {\n const res = await axios.post(`/api/clients/${clientId}/session`)\n return res.data // session data\n}\n\nexport const getSession = async (clientId: string) => {\n const res = await axios.get<{ photos: string[] }>(\n `/api/clients/${clientId}/session`,\n )\n return res.data // session data\n}\n\nexport const killSession = async (clientId: string) => {\n await axios.delete(`/api/clients/${clientId}/session`)\n}\n\nexport const restartSession = async (clientId: string) => {\n await killSession(clientId)\n await startSession(clientId)\n}\n\n// TOOD: Get status\n\n// Someday\n\nexport const getClients = async (): Promise => {\n const res = await axios.get(`/api/clients`)\n return res.data\n}\n\nexport const cleanup = () => {\n // send\n}\n","import { Button, Divider, message, PageHeader } from 'antd'\nimport { Content } from 'antd/lib/layout/layout'\nimport React, { FormEvent } from 'react'\nimport { useState } from 'react'\nimport { useHistory } from 'react-router-dom'\nimport { createClient } from '../api'\n\nexport const Dashboard = () => {\n const history = useHistory()\n const [error, setError] = useState(null)\n const [name, setName] = useState('')\n const [email, setEmail] = useState('')\n const [phone, setPhone] = useState('')\n\n const handleReset = () => {\n //\n setName('')\n setEmail('')\n setPhone('')\n }\n\n const handleSubmit = async (e: FormEvent) => {\n e.preventDefault()\n\n if (phone.length < 10) {\n // helpful message\n message.error('Check all fields!')\n setError('Phone number needs to be a length of at least 10')\n return\n }\n\n const client_id = await createClient({\n name,\n email,\n phone: parseInt(phone),\n })\n\n history.push(`/sessions/${client_id}`)\n }\n\n return (\n \n \n \n
\n \n \n \n \n \n {error &&

{error}

}\n
\n
\n )\n}\n","import React, { useEffect, useState } from 'react'\nimport { Card, message, Modal, PageHeader, Spin } from 'antd'\nimport { getSession } from '../api'\n\ntype Props = {\n clientId: string\n}\n\nexport const SessionPictures = ({ clientId }: Props) => {\n const [urls, setUrls] = useState(null)\n const [activeUrl, setActiveUrl] = useState(null)\n const [loading, setLoading] = useState(true)\n\n const handleSync = async () => {\n message.info('Syncing photos...')\n const { photos } = await getSession(clientId)\n if (photos.length) setUrls(photos)\n }\n\n useEffect(() => {\n const get = async () => {\n if (urls && urls.length >= 89 * 2) {\n setLoading(false)\n return\n }\n\n const { photos } = await getSession(clientId)\n if (photos.length) setUrls(photos)\n }\n\n const interval = setInterval(get, 250)\n\n return () => clearInterval(interval)\n }, [clientId, urls])\n\n const closeModal = () => setActiveUrl(null)\n\n const host =\n process.env.NODE_ENV === 'development' ? 'http://192.168.1.107:5000' : ''\n\n if (!urls?.length) return null\n\n return (\n <>\n \n \n \n \n
\n {urls ? (\n urls\n .sort((a, b) => a.split('_')[0].localeCompare(b.split('_')[0]))\n .map((src) => (\n \n setActiveUrl(src)}\n key={src}\n id={src}\n src={`${host}/output/${clientId}/${src}`}\n alt=\"lol\"\n />\n \n ))\n ) : (\n \n )}\n
\n \n )\n}\n","import React, { useEffect, useState } from 'react'\nimport { RouteComponentProps, useHistory } from 'react-router-dom'\nimport { getClient, killSession, restartSession, startSession } from '../api'\nimport { SessionPictures } from './SessionPictures'\nimport {\n Button,\n Divider,\n message,\n PageHeader,\n Popconfirm,\n Row,\n Tag,\n} from 'antd'\nimport { Content } from 'antd/lib/layout/layout'\nimport { Client } from '../types'\n\ntype Props = RouteComponentProps<{ clientId: string }>\n\nexport const Session = (props: Props) => {\n const history = useHistory()\n const { clientId } = props.match.params\n const [client, setClient] = useState(null)\n const [active, setActive] = useState(false)\n\n const handleStartSession = async () => {\n message.loading('Photo sequence starting! Stand by...')\n await startSession(clientId)\n setActive(true)\n }\n\n const handleRestartSession = async () => {\n setActive(false)\n message.loading(\n 'Deleting photos & restarting capture sequence! Stand by...',\n )\n await restartSession(clientId)\n setActive(true)\n }\n\n const handleExit = async () => {\n history.push('/')\n }\n\n const handleNuke = async () => {\n await killSession(clientId)\n message.success('Photos Deleted! Going back to dashboard')\n history.push('/')\n }\n\n useEffect(() => {\n const get = async () => {\n const client = await getClient(clientId)\n setClient(client)\n if (client.has_photos) setActive(true)\n }\n\n get()\n }, [clientId])\n\n return (\n \n history.goBack()}\n title={`Session for ${clientId}`}\n tags={active ? Active : Inactive}\n subTitle={`session has ${active ? 'started' : 'not started'}`}\n extra={[\n \n Capture\n ,\n \n \n ,\n \n \n ,\n \n Finish Session\n ,\n ]}\n >\n \n \n {active && }\n \n \n )\n}\n","import React from 'react'\nimport './App.css'\n\nimport { BrowserRouter, Switch, Route } from 'react-router-dom'\nimport { Dashboard } from './pages/Dashboard'\nimport { Session } from './pages/Session'\n\nconsole.log('ENV', process.env.NODE_ENV)\n\nfunction App() {\n return (\n \n
\n \n \n \n \n
\n
\n )\n}\n\nexport default App\n","import { ReportHandler } from 'web-vitals';\n\nconst reportWebVitals = (onPerfEntry?: ReportHandler) => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from 'react'\nimport ReactDOM from 'react-dom'\nimport './index.css'\nimport 'antd/dist/antd.css'\nimport App from './App'\nimport reportWebVitals from './reportWebVitals'\n\nReactDOM.render(, document.getElementById('root'))\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals()\n"],"sourceRoot":""}