1 line
16 KiB
Plaintext
1 line
16 KiB
Plaintext
{"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,SA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C,EAJX,oBACM,gBAON,cAAC,IAAD,CAEE5C,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<Client, 'has_photos'>) => {\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<Client> => {\n const res = await axios.get<Client>(`/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<Client[]> => {\n const res = await axios.get<Client[]>(`/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<string | null>(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 <Content>\n <PageHeader\n title=\"Dashboard\"\n subTitle=\"Enter the name, email and phone number of the subject\"\n ></PageHeader>\n <Divider />\n <form onSubmit={handleSubmit}>\n <label htmlFor=\"name\">\n Name:\n <input\n minLength={3}\n value={name}\n onChange={(e) => setName(e.target.value)}\n name=\"name\"\n />\n </label>\n <label htmlFor=\"email\">\n Email:\n <input\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n type=\"email\"\n name=\"email\"\n />\n </label>\n <label htmlFor=\"phone\">\n Phone:\n <input\n value={phone}\n onChange={(e) => setPhone(e.target.value)}\n type=\"tel\"\n name=\"phone\"\n />\n </label>\n <Button danger onClick={handleReset}>\n Reset\n </Button>\n <Button htmlType=\"submit\" type=\"primary\">\n Start Session\n </Button>\n {error && <p className=\"error\">{error}</p>}\n </form>\n </Content>\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<string[] | null>(null)\n const [activeUrl, setActiveUrl] = useState<string | null>(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 <Modal\n visible={!!activeUrl}\n onOk={closeModal}\n cancelText={null}\n onCancel={closeModal}\n width=\"50%\"\n >\n <img\n width=\"100%\"\n onClick={closeModal}\n src={`${host}/output/${clientId}/${activeUrl}`}\n alt=\"large image\"\n ></img>\n </Modal>\n <PageHeader\n title=\"Session Pictures\"\n subTitle={`${urls.length}/${89 * 2} loaded`}\n ></PageHeader>\n <div className=\"photo-wall\">\n {urls ? (\n urls\n .sort((a, b) => a.split('_')[0].localeCompare(b.split('_')[0]))\n .map((src) => (\n <Card className=\"photo\" title={src.split('_')[0]}>\n <img\n onClick={() => setActiveUrl(src)}\n key={src}\n id={src}\n src={`${host}/output/${clientId}/${src}`}\n alt=\"lol\"\n />\n </Card>\n ))\n ) : (\n <Spin />\n )}\n </div>\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<Client | null>(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 <Content>\n <PageHeader\n ghost={false}\n onBack={() => history.goBack()}\n title={`Session for ${clientId}`}\n tags={active ? <Tag color=\"lime\">Active</Tag> : <Tag>Inactive</Tag>}\n subTitle={`session has ${active ? 'started' : 'not started'}`}\n extra={[\n <Button\n key=\"startsession\"\n disabled={active}\n type=\"primary\"\n onClick={handleStartSession}\n >\n Capture\n </Button>,\n <Popconfirm\n key=\"retry\"\n title=\"Re-capture set?\"\n onConfirm={handleRestartSession}\n >\n <Button type=\"default\" disabled={!active}>\n Retry Capture\n </Button>\n </Popconfirm>,\n <Popconfirm\n key=\"nuke\"\n title=\"Delete all photos and return to dashboard?\"\n onConfirm={handleNuke}\n >\n <Button danger disabled={!active}>\n Abort Session\n </Button>\n </Popconfirm>,\n <Button\n key=\"finish\"\n ghost\n type=\"primary\"\n disabled={!active}\n onClick={handleExit}\n >\n Finish Session\n </Button>,\n ]}\n ></PageHeader>\n <Divider />\n <Row className=\"controls\">\n {active && <SessionPictures clientId={clientId} />}\n </Row>\n </Content>\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 <BrowserRouter>\n <div className=\"App\">\n <Switch>\n <Route path=\"/sessions/:clientId\" component={Session} />\n <Route exact path=\"/\" component={Dashboard} />\n </Switch>\n </div>\n </BrowserRouter>\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(<App />, 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":""} |