3Dshock/client/build/static/js/main.4388b0cf.chunk.js.map
Elijah Lucian 104d39b4c6 🐛🔨
2021-03-24 00:04:04 -07:00

1 line
23 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","timings","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","onFinish","labelCol","span","wrapperCol","Paragraph","style","textAlign","label","minLength","type","justify","danger","onClick","resetFields","htmlType","ScrollToTop","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","Text","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","lightTime","setLightTime","handleTimingUpdate","n","toString","handleStartSession","loading","light_time","handleRestartSession","handleExit","handleNuke","success","has_photos","disabled","onConfirm","e","target","min","max","step","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,IAR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AAW/B,IAC7C,cAAC,IAAD,CAAOgC,OAAK,EAACF,KAAK,IAAIC,UAAWrI,YCD5BuI,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.4388b0cf.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, Timings } 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.114: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, timings: Timings) => {\n try {\n const res = await axios.post(`/api/clients/${clientId}/session`, timings)\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, timings: Timings) => {\n await killSession(clientId)\n await startSession(clientId, timings)\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 React from 'react'\nimport { Button, Divider, Form, Input, message, Row, Typography } from 'antd'\nimport FormItem from 'antd/lib/form/FormItem'\nimport { Content } from 'antd/lib/layout/layout'\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 <Divider />\n <Form\n form={form}\n className=\"dashboard-form\"\n onFinish={handleSubmit}\n labelCol={{ span: 8 }}\n wrapperCol={{ span: 16 }}\n >\n <Typography.Paragraph style={{ textAlign: 'center' }}>\n Enter the name, email and phone number of the subject\n </Typography.Paragraph>\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 {\n Button,\n Input,\n InputNumber,\n message,\n Popconfirm,\n Row,\n Typography,\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 const [lightTime, setLightTime] = useState(\n parseInt(window.localStorage.getItem('lightTime') || '5000'),\n )\n\n const handleTimingUpdate = (n: number) => {\n window.localStorage.setItem('lightTime', n.toString())\n setLightTime(n)\n }\n\n const handleStartSession = async () => {\n message.loading('Photo sequence starting! Stand by...')\n await startSession(clientId, { light_time: lightTime })\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, { light_time: lightTime })\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 className=\"client-info\">\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 <div className=\"toolbar\">\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 <Row className=\"session-toolbar\">\n <h3>Light Duration (ms)</h3>\n <InputNumber value={lightTime} onChange={handleTimingUpdate} />\n <Input\n className=\"slider\"\n type=\"range\"\n onChange={(e) => handleTimingUpdate(parseInt(e.target.value))}\n value={lightTime}\n min={500}\n max={10000}\n step={500}\n />\n </Row>\n </div>\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":""}