1
0
Fork 0
mirror of https://github.com/voltbonn/profile-picture-generator.git synced 2024-12-23 00:05:09 +00:00
profile.volt.link/static/js/main.8c2fdff3.chunk.js.map
2021-01-21 22:03:42 +00:00

1 line
No EOL
13 KiB
Text

{"version":3,"sources":["frames lazy /^/.//.*/.png$/ groupOptions: {} namespace object","FrameChooser.js","HeaderImage.svg","App.js","reportWebVitals.js","index.js"],"names":["map","webpackAsyncContext","req","__webpack_require__","o","Promise","resolve","then","e","Error","code","ids","id","keys","Object","module","exports","FrameChooser","onFrameChange","useState","frames","setFrames","choosenFrame","setChoosenFrame","useEffect","a","all","frame_filename","name","src","new_frames","default","loadFrames","handleImageChoosing","useCallback","event","target","dataset","className","frame","frame_src_path","isChoosen","alt","data-src","onClick","frameSize","App","frameURL","setFrameURL","originalPhoto","setOriginalPhoto","photo","setPhoto","combinedImage","setCombinedImage","handleFrameURL","newFrameURL","handleReadFile","file","reader","FileReader","onload","reader_event","img","Image","offscreenCanvas","document","createElement","width","height","offscreenCanvas_ctx","getContext","alpha","drawImage","pngUrl","toDataURL","result","readAsDataURL","handleImage","files_event","files","onDrop","acceptedFiles","useDropzone","accept","maxFiles","noKeyboard","isDragActive","getRootProps","mergeImages","b64","HeaderImage","tabIndex","style","outline","onChange","type","display","download","href","rel","reportWebVitals","onPerfEntry","Function","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","render","StrictMode","getElementById"],"mappings":"qJAAA,IAAIA,EAAM,CACT,8BAA+B,CAC9B,GACA,GAED,+BAAgC,CAC/B,GACA,GAED,gCAAiC,CAChC,GACA,GAED,gCAAiC,CAChC,GACA,GAED,4BAA6B,CAC5B,GACA,GAED,8BAA+B,CAC9B,GACA,GAED,8BAA+B,CAC9B,GACA,IAED,gCAAiC,CAChC,GACA,IAED,iCAAkC,CACjC,GACA,KAGF,SAASC,EAAoBC,GAC5B,IAAIC,EAAoBC,EAAEJ,EAAKE,GAC9B,OAAOG,QAAQC,UAAUC,MAAK,WAC7B,IAAIC,EA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\t\"./ProfileFrame Green Bars.png\": [\n\t\t28,\n\t\t6\n\t],\n\t\"./ProfileFrame Mixed Bars.png\": [\n\t\t29,\n\t\t7\n\t],\n\t\"./ProfileFrame Purple.png\": [\n\t\t30,\n\t\t8\n\t],\n\t\"./ProfileFrame R&Y Bars.png\": [\n\t\t31,\n\t\t9\n\t],\n\t\"./ProfileFrame Red Bars.png\": [\n\t\t32,\n\t\t10\n\t],\n\t\"./ProfileFrame White Bars.png\": [\n\t\t33,\n\t\t11\n\t],\n\t\"./ProfileFrame Yellow Bars.png\": [\n\t\t34,\n\t\t12\n\t]\n};\nfunction webpackAsyncContext(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\treturn Promise.resolve().then(function() {\n\t\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\t\te.code = 'MODULE_NOT_FOUND';\n\t\t\tthrow e;\n\t\t});\n\t}\n\n\tvar ids = map[req], id = ids[0];\n\treturn __webpack_require__.e(ids[1]).then(function() {\n\t\treturn __webpack_require__(id);\n\t});\n}\nwebpackAsyncContext.keys = function webpackAsyncContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackAsyncContext.id = 24;\nmodule.exports = webpackAsyncContext;","import { useState, useEffect, useCallback } from 'react'\n\nfunction FrameChooser({onFrameChange}) {\n const [frames, setFrames] = useState([])\n const [choosenFrame, setChoosenFrame] = useState(null)\n\n useEffect(() => {\n async function loadFrames(){\n Promise.all(\n [\n 'ProfileFrame Purple',\n 'ProfileFrame Yellow Bars',\n 'ProfileFrame Red Bars',\n 'ProfileFrame Blue Bars',\n 'ProfileFrame Green Bars',\n 'ProfileFrame White Bars',\n 'ProfileFrame Mixed Bars',\n 'ProfileFrame R&Y Bars',\n 'ProfileFrame B&G Bars',\n ]\n .map(async frame_filename => {\n return {\n name: frame_filename,\n src: await import(`./frames/${frame_filename}.png`),\n }\n })\n )\n .then(new_frames => {\n setFrames(new_frames)\n setChoosenFrame(new_frames[0].src.default)\n })\n }\n loadFrames()\n }, [])\n\n const handleImageChoosing = useCallback(event => {\n setChoosenFrame(event.target.dataset.src)\n }, [setChoosenFrame])\n\n useEffect(() => {\n onFrameChange(choosenFrame)\n }, [onFrameChange, choosenFrame])\n\n return (\n <div className=\"FrameChooser\">\n <h2>Choose a frame:</h2>\n {\n frames.map(frame => {\n const frame_src_path = frame.src.default\n const isChoosen = choosenFrame === frame_src_path\n return <img alt={frame.name} key={frame_src_path} data-src={frame_src_path} src={frame_src_path} className={isChoosen ? 'frame choosen' : 'frame'} onClick={handleImageChoosing}/>\n })\n } \n </div>\n )\n}\n\nexport default FrameChooser\n","export default __webpack_public_path__ + \"static/media/HeaderImage.1f39a672.svg\";","import { useState, useEffect, useCallback } from 'react'\nimport './App.css'\nimport { useDropzone } from 'react-dropzone'\nimport FrameChooser from './FrameChooser.js'\nimport HeaderImage from './HeaderImage.svg'\n\nimport mergeImages from 'merge-images'\n\nconst frameSize = 1080\n\nfunction App() {\n const [frameURL, setFrameURL] = useState(null)\n const [originalPhoto, setOriginalPhoto] = useState(null)\n const [photo, setPhoto] = useState(null)\n const [combinedImage, setCombinedImage] = useState(null)\n\n const handleFrameURL = useCallback(newFrameURL => {\n setFrameURL(newFrameURL)\n }, [setFrameURL])\n\n\n const handleReadFile = useCallback(file => {\n if (!(!!file)) {\n return;\n }\n\n const reader = new FileReader()\n reader.onload = reader_event => {\n const img = new Image()\n img.onload = function () {\n const offscreenCanvas = document.createElement('canvas')\n offscreenCanvas.width = frameSize\n offscreenCanvas.height = frameSize\n\n const offscreenCanvas_ctx = offscreenCanvas.getContext('2d', { alpha: true })\n\n let width, height;\n if (img.width < img.height) {\n height = (img.height / img.width) * frameSize\n width = frameSize\n } else {\n height = frameSize\n width = (img.width / img.height) * frameSize\n }\n \n offscreenCanvas_ctx.drawImage(\n img,\n (frameSize - width) / 2,\n (frameSize - height) / 2,\n width,\n height,\n )\n\n const pngUrl = offscreenCanvas.toDataURL()\n setPhoto(pngUrl)\n }\n img.src = reader_event.target.result\n setOriginalPhoto(reader_event.target.result)\n }\n reader.readAsDataURL(file)\n }, [])\n\n const handleImage = useCallback(files_event => {\n handleReadFile(files_event.target.files[0])\n }, [handleReadFile])\n\n const onDrop = useCallback(acceptedFiles => {\n handleReadFile(acceptedFiles[0])\n }, [handleReadFile])\n\n const { isDragActive, getRootProps } = useDropzone({\n onDrop,\n accept: 'image/*',\n maxFiles: 1,\n noKeyboard: true,\n })\n\n\n useEffect(() => {\n mergeImages([\n ...(photo ? [photo] : []),\n ...(frameURL ? [frameURL] : []),\n ])\n .then(b64 => setCombinedImage(b64))\n }, [photo, frameURL])\n\n\n return (\n <div className=\"App\" {...getRootProps()}>\n <img src={HeaderImage} className=\"HeaderImage\" alt=\"Volt Logo\" />\n\n <div className={isDragActive ? 'droparea active' : 'droparea'}>\n Drop your photo here ...\n </div>\n\n <h2>Choose your Photo:</h2>\n <p>It should best be a square image or your face in the middle. The photo is not saved and never leaves your computer.</p>\n\n <label className=\"labelButton\" tabIndex=\"0\" style={{outline:'none'}}>\n {!!photo ? <img src={originalPhoto} alt=\"Preview\" /> : null}\n <span>{!!photo ? 'Change Photo' : 'Load Photo'}</span>\n <input onChange={handleImage} type=\"file\" accept=\"image/*\" style={{display: 'none'}} />\n </label>\n\n <FrameChooser onFrameChange={handleFrameURL} />\n\n <h2>Download your Photo:</h2>\n <img src={combinedImage} className=\"FinishedFrame\" alt=\"Finished Frame\" />\n <a download=\"volt-profile-picture.png\" href={combinedImage} target=\"_blank\" rel=\"noreferrer\">\n <button>Download Profile Picture</button>\n </a>\n </div>\n )\n}\n\nexport default App\n","const reportWebVitals = onPerfEntry => {\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 App from './App'\nimport reportWebVitals from './reportWebVitals'\n\nReactDOM.render(\n <React.StrictMode>\n <App />\n </React.StrictMode>,\n document.getElementById('root')\n)\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":""}