1 line
22 KiB
Plaintext
1 line
22 KiB
Plaintext
{"version":3,"sources":["components/StatusChip.tsx","api/index.ts","pages/Dashboard.tsx","components/ScrollToTop.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","Form","useForm","form","handleSubmit","values","phone","length","name","email","parseInt","replace","push","Title","className","level","Text","onFinish","labelCol","span","wrapperCol","label","minLength","type","justify","danger","onClick","resetFields","htmlType","ScrollToTop","style","position","right","bottom","window","scrollTo","console","log","SessionPictures","urls","setUrls","activeUrl","setActiveUrl","JSON","parse","localStorage","getItem","focusPhotos","setFocusPhotos","useEffect","interval","setInterval","photos","clearInterval","closeModal","sort","b","split","localeCompare","u","filteredPhotos","filter","num","includes","visible","onOk","footer","onCancel","width","src","alt","align","display","margin","mode","allowClear","placeholder","defaultValue","value","onChange","v","setItem","stringify","map","val","Option","background","Math","floor","marginTop","title","colors","StatusChip","poll","setStatus","color","Session","props","match","params","client","setClient","active","setActive","handleStartSession","loading","handleRestartSession","handleExit","handleNuke","success","has_photos","disabled","onConfirm","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,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,CAEEI,SAAUT,EACV/E,KAAK,UACLG,QAAS8E,EAJX,oBACM,gBAON,cAAC,IAAD,CACEO,UAAWT,EAEXZ,MAAM,kBACNsB,UAAWN,EAJb,SAME,cAAC,IAAD,CAAQnF,KAAK,UAAUwF,UAAWT,EAAlC,4BAJI,SAQN,cAAC,IAAD,CAEES,UAAWT,EACXZ,MAAM,6CACNsB,UAAWJ,EAJb,SAME,cAAC,IAAD,CAAQnF,QAAM,EAACsF,UAAWT,EAA1B,4BALI,QAUN,cAAC,EAAD,CAAYT,MAAM,OAGpB,cAAC,IAAD,IACA,cAAC,IAAD,CAAK/E,UAAU,WAAf,SACGwF,GAAU,cAAC,EAAD,CAAiBnH,SAAUA,UCvG9CiD,QAAQC,IAAI,MAAO4E,cAeJC,MAbf,WACE,OACE,cAAC,IAAD,UACE,qBAAKpG,UAAU,MAAf,SACE,eAAC,IAAD,WACE,cAAC,IAAD,CAAOqG,KAAK,sBAAsBC,UAAWpB,IAC7C,cAAC,IAAD,CAAOqB,OAAK,EAACF,KAAK,IAAIC,UAAWxH,YCD5B0H,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.f6d60162.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<PresetColorType>[] = [\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>(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 }, [poll])\n\n return (\n <Tag color={colors[status]} style={{ display: 'flex' }}>\n <span style={{ margin: 'auto' }}>{Status[status]}</span>\n </Tag>\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<Client, 'has_photos'>) => {\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<Client> => {\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<Client>(`/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<Status> => {\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<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, Form, Input, message, Row, Typography } from 'antd'\nimport FormItem from 'antd/lib/form/FormItem'\nimport { Content } from 'antd/lib/layout/layout'\nimport React from 'react'\nimport { useState } from 'react'\nimport { useHistory } from 'react-router-dom'\nimport { createClient } from '../api'\n\ntype FormData = {\n name: string\n email: string\n phone: string\n}\n\nexport const Dashboard = () => {\n const history = useHistory()\n const [error, setError] = useState<string | null>(null)\n const [form] = Form.useForm<FormData>()\n\n const handleReset = () => {\n form.resetFields()\n }\n\n const handleSubmit = async (values: FormData) => {\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 <Content>\n <Typography.Title className=\"page-head\" level={3}>\n Dashboard\n </Typography.Title>\n <Typography.Text>\n Enter the name, email and phone number of the subject\n </Typography.Text>\n <Divider />\n <Form\n form={form}\n className=\"dashboard-form\"\n onFinish={handleSubmit}\n labelCol={{ span: 8 }}\n wrapperCol={{ span: 16 }}\n >\n <FormItem label=\"name\" name=\"name\">\n <Input minLength={3} />\n </FormItem>\n <FormItem label=\"email\" name=\"email\">\n <Input type=\"email\" />\n </FormItem>\n <FormItem label=\"phone\" name=\"phone\">\n <Input type=\"tel\" minLength={10} />\n </FormItem>\n <Row justify=\"space-between\">\n <Button danger onClick={handleReset}>\n Reset\n </Button>\n <Button htmlType=\"submit\" type=\"primary\">\n Start Session\n </Button>\n </Row>\n {error && <p className=\"error\">{error}</p>}\n </Form>\n </Content>\n )\n}\n","import { Button } from 'antd'\nimport React from 'react'\n\nexport const ScrollToTop = () => {\n const handleClick = () => {\n window.scrollTo(0, 0)\n console.log('')\n }\n\n return (\n <Button\n type=\"link\"\n style={{\n position: 'fixed',\n right: 20,\n bottom: 20,\n }}\n onClick={handleClick}\n >\n ⤴️ Scroll To Top\n </Button>\n )\n}\n","import React, { useEffect, useState } from 'react'\nimport { Card, Modal, Row, Select, Typography } from 'antd'\nimport { getSession } from '../api'\nimport { ScrollToTop } from './ScrollToTop'\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 [focusPhotos, setFocusPhotos] = useState<string[]>(\n JSON.parse(window.localStorage.getItem('focusPhotos') || '[]'),\n )\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 const photos = urls.sort((a, b) =>\n a.split('_')[0].localeCompare(b.split('_')[0]),\n )\n\n const u = urls.length / 89\n\n const handleSelect = (v: string[]) => {\n console.log('SEelcted', v)\n window.localStorage.setItem('focusPhotos', JSON.stringify(v))\n setFocusPhotos(v)\n }\n\n const filteredPhotos = photos.filter((name) => {\n const num = name.split('_')[0]\n return focusPhotos.includes(num)\n })\n\n return (\n <>\n <Modal\n visible={!!activeUrl}\n onOk={closeModal}\n footer={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 modal\"\n ></img>\n </Modal>\n <Row\n align=\"middle\"\n justify=\"space-around\"\n style={{ display: 'flex', width: '100%' }}\n >\n <Typography.Title style={{ margin: '0.5rem 1rem 0.7rem' }} level={3}>\n Session Pictures\n </Typography.Title>\n <Typography.Text>{urls.length}/ 89 loaded</Typography.Text>\n <Typography.Text>Select Featured Photos:</Typography.Text>\n\n <Select\n mode=\"multiple\"\n allowClear\n placeholder=\"Please select featured\"\n style={{ width: '35%' }}\n defaultValue={focusPhotos}\n value={focusPhotos}\n onChange={handleSelect}\n >\n {photos.map((name) => {\n const val = name.split('_')[0]\n return <Select.Option value={val}>{val}</Select.Option>\n })}\n </Select>\n </Row>\n\n <div className=\"loading-bar-container\">\n <div\n className=\"loading-bar\"\n style={{\n width: `${u * 100}%`,\n background: `hsl(${Math.floor(u * 120)}, 90%, 70%)`,\n }}\n ></div>\n </div>\n <div className=\"featured-photos\" style={{ marginTop: '2rem' }}>\n {filteredPhotos.map((src) => (\n <img\n onClick={() => setActiveUrl(src)}\n src={`${host}/output/${clientId}/${src}`}\n alt=\"lol\"\n />\n ))}\n </div>\n <div className=\"photo-wall\">\n {photos.map((src) => (\n <Card key={src} className=\"photo\" title={src.split('_')[0]}>\n <img\n onClick={() => setActiveUrl(src)}\n src={`${host}/output/${clientId}/${src}`}\n alt=\"lol\"\n />\n </Card>\n ))}\n </div>\n <ScrollToTop />\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<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 <Typography.Title className=\"page-head\" level={3}>\n Session View\n </Typography.Title>\n\n <Row justify=\"space-around\" style={{ width: '60%', margin: 'auto' }}>\n <Typography.Text>\n <strong>Name:</strong> {client?.name}\n </Typography.Text>\n <Typography.Text>\n <strong>Email:</strong> {client?.email}\n </Typography.Text>\n <Typography.Text>\n <strong>Phone:</strong> {client?.phone}\n </Typography.Text>\n </Row>\n <Divider />\n\n <Row justify=\"center\" className=\"session-toolbar\">\n <Button key=\"finish\" onClick={handleExit}>\n Back To Dashboard\n </Button>\n <Button\n key=\"startsession\"\n disabled={active}\n type=\"primary\"\n onClick={handleStartSession}\n >\n Capture\n </Button>\n <Popconfirm\n disabled={!active}\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 disabled={!active}\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\n <StatusChip poll={true} />\n </Row>\n\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":""} |