{"version":3,"sources":["components/StatusChip.tsx","api/index.ts","pages/Dashboard.tsx","components/SessionPictures.tsx","pages/Session.tsx","App.tsx","reportWebVitals.ts","index.tsx"],"names":["Status","createClient","body","a","axios","post","res","data","client_id","getClient","id","get","startSession","clientId","message","error","getSession","killSession","delete","restartSession","getStatus","status","Dashboard","history","useHistory","useState","setError","handleSubmit","values","phone","length","name","email","parseInt","replace","push","title","subTitle","className","onFinish","labelCol","span","wrapperCol","label","minLength","type","justify","danger","onClick","htmlType","SessionPictures","urls","setUrls","activeUrl","setActiveUrl","useEffect","interval","setInterval","photos","clearInterval","closeModal","visible","onOk","cancelText","onCancel","width","src","alt","sort","b","split","localeCompare","map","colors","StatusChip","poll","setStatus","color","style","display","margin","Session","props","match","params","client","setClient","active","setActive","handleStartSession","loading","handleRestartSession","handleExit","handleNuke","success","has_photos","Title","Text","disabled","onConfirm","ghost","console","log","process","App","path","component","exact","reportWebVitals","onPerfEntry","Function","then","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","render","document","getElementById"],"mappings":"yJAKYA,E,0MCSCC,EAAY,uCAAG,WAAOC,GAAP,eAAAC,EAAA,4FAERC,IAAMC,KAAN,eAAkDH,GAF1C,cAEpBI,EAFoB,yBAGnBA,EAAIC,KAAKC,WAHU,2CAAH,sDAMZC,EAAS,uCAAG,WAAOC,GAAP,eAAAP,EAAA,4FAQLC,IAAMO,IAAN,uBAAkCD,IAR7B,cAQjBJ,EARiB,yBAShBA,EAAIC,MATY,2CAAH,sDAWTK,EAAY,uCAAG,WAAOC,GAAP,eAAAV,EAAA,+EAENC,IAAMC,KAAN,uBAA2BQ,EAA3B,aAFM,cAElBP,EAFkB,yBAGjBA,EAAIC,MAHa,uCAKxBO,IAAQC,MAAM,2DALU,iFAAH,sDAUZC,EAAU,uCAAG,WAAOH,GAAP,eAAAV,EAAA,sEACNC,IAAMO,IAAN,uBACAE,EADA,aADM,cAClBP,EADkB,yBAIjBA,EAAIC,MAJa,2CAAH,sDAOVU,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Af,SACGiD,GAAU,cAAC,EAAD,CAAiB1E,SAAUA,UCzG9CwF,QAAQC,IAAI,MAAOC,cAeJC,MAbf,WACE,OACE,cAAC,IAAD,UACE,qBAAKlE,UAAU,MAAf,SACE,eAAC,IAAD,WACE,cAAC,IAAD,CAAOmE,KAAK,sBAAsBC,UAAWzB,IAC7C,cAAC,IAAD,CAAO0B,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.4a4e0606.chunk.js","sourcesContent":["import { Tag } from 'antd'\nimport { PresetColorType } from 'antd/lib/_util/colors'\nimport { useEffect, useState } from 'react'\nimport { getStatus } from '../api'\n\nexport enum Status {\n 'Standing By...',\n 'Warming Up...',\n 'Capturing Photo',\n 'Capturing Grid',\n 'Writing To Disk',\n 'Downloading!',\n}\n\nconst colors: Partial[] = [\n 'lime',\n 'gold',\n 'volcano',\n 'magenta',\n 'geekblue',\n]\n\ntype Props = {\n poll: boolean\n}\n\nexport const StatusChip = ({ poll }: Props) => {\n const [status, setStatus] = useState(Status['Standing By...'])\n\n useEffect(() => {\n const get = async () => {\n if (!poll) return\n const status = await getStatus()\n setStatus(status)\n }\n\n const interval = setInterval(get, 1000 / 4)\n\n return () => clearInterval(interval)\n }, [])\n\n return (\n \n {Status[status]}\n \n )\n}\n","import { Client } from '../types'\nimport axios from 'axios'\nimport { message } from 'antd'\nimport { Status } from '../components/StatusChip'\n\nconst dev = process.env.NODE_ENV === 'development'\n\nif (dev) {\n const host = 'http://192.168.1.107:5000'\n axios.defaults.baseURL = host\n}\n\nconst mock = false\n\nexport const createClient = async (body: Omit) => {\n if (mock) return 'test'\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 if (mock)\n return {\n name: 'Test Client',\n has_photos: false,\n email: 'test@test.test',\n phone: 1234567890,\n }\n const res = await axios.get(`/api/clients/${id}`)\n return res.data\n}\nexport const startSession = async (clientId: string) => {\n try {\n const res = await axios.post(`/api/clients/${clientId}/session`)\n return res.data\n } catch (err) {\n message.error('Something went wrong, check connection with the machine')\n return err\n }\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\nexport const getStatus = async (): Promise => {\n const res = await axios.get<{ status: Status }>('/api/status')\n return res.data.status\n}\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, Form, Input, message, PageHeader, Row } from 'antd'\nimport FormItem from 'antd/lib/form/FormItem'\nimport { Store } from 'antd/lib/form/interface'\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\n const handleReset = () => {}\n\n const handleSubmit = async (values: Store) => {\n if (values.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: values.name,\n email: values.email,\n phone: parseInt(values.phone.replace(/\\D/g, '')),\n })\n\n history.push(`/sessions/${client_id}`)\n }\n\n return (\n \n \n \n \n \n \n \n \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 useEffect(() => {\n const get = async () => {\n if (urls && urls.length >= 89 * 1) {\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
\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 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 '../components/SessionPictures'\nimport { StatusChip } from '../components/StatusChip'\n\nimport { Button, Divider, message, Popconfirm, Row, Typography } 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 \n Client: {client?.name}\n \n\n \n \n email: {client?.email}\n \n \n phone: {client?.phone}\n \n \n \n\n \n \n Capture\n \n \n \n \n \n \n \n \n Finish Session\n \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":""}