GoScrobble/web/node_modules/.cache/babel-loader/16bab3e8008f28f20af1dc1969131666.json

1 line
16 KiB
JSON
Raw Permalink Normal View History

2022-04-25 02:47:15 +00:00
{"ast":null,"code":"var _jsxFileName = \"/app/src/Pages/Track.js\",\n _s = $RefreshSig$();\n\nimport React, { useContext, useState, useEffect } from 'react';\nimport '../App.css';\nimport './Track.css';\nimport TopUserTable from '../Components/TopUserTable';\nimport ScaleLoader from 'react-spinners/ScaleLoader';\nimport { getTrack } from '../Api/index';\nimport { Link } from 'react-router-dom';\nimport AuthContext from '../Contexts/AuthContext';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Track = route => {\n _s();\n\n const {\n user\n } = useContext(AuthContext);\n const [loading, setLoading] = useState(true);\n const [track, setTrack] = useState({});\n let trackUUID = false;\n\n if (route && route.match && route.match.params && route.match.params.uuid) {\n trackUUID = route.match.params.uuid;\n } else {\n trackUUID = false;\n }\n\n useEffect(() => {\n if (!trackUUID) {\n return false;\n }\n\n getTrack(trackUUID).then(data => {\n setTrack(data);\n setLoading(false);\n });\n }, [trackUUID]);\n\n if (loading) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageWrapper\",\n children: /*#__PURE__*/_jsxDEV(ScaleLoader, {\n color: \"#6AD7E5\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 38,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 37,\n columnNumber: 7\n }, this);\n }\n\n if (!trackUUID || !track) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageWrapper\",\n children: \"Unable to fetch user\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 45,\n columnNumber: 7\n }, this);\n }\n\n let length = \"0\";\n\n if (track.length && track.length !== '') {\n length = new Date(track.length * 1000).toISOString().substr(11, 8);\n }\n\n let artists = [];\n\n for (let artist of track.artists) {\n const row = /*#__PURE__*/_jsxDEV(Link, {\n to: \"/artist/\" + artist.uuid,\n children: [artist.name, \" \"]\n }, artist.uuid, true, {\n fileName: _jsxFileName,\n lineNumber: 59,\n columnNumber: 7\n }, this);\n\n artists.push(row);\n }\n\n let albums = [];\n\n for (let album of track.albums) {\n const row = /*#__PURE__*/_jsxDEV(Link, {\n to: \"/album/\" + album.uuid,\n children: [album.name, \" \"]\n }, album.uuid, true, {\n fileName: _jsxFileName,\n lineNumber: 70,\n columnNumber: 7\n }, this);\n\n albums.push(row);\n }\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageWrapper\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n style: {\n margin: 0\n },\n children: [track.name, \" \", user && false && /*#__PURE__*/_jsxDEV(Link, {\n to: \"/track/\" + track.uuid + \"/edit\",\n children: \"edit\"\n }, \"editbuttonomg\", false, {\n fileName: _jsxFileName,\n lineNumber: 81,\n columnNumber: 40\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 80,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageBody\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n style: {\n display: `flex`,\n flexWrap: `wrap`,\n textAlign: `center`\n },\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n style: {\n width: `300px`,\n padding: `0 10px 10px 10px`,\n textAlign: `left`\n },\n children: /*#__PURE__*/_jsxDEV(\"img\", {\n src: process.env.REACT_APP_API_URL + \"/img/\" + track.img + \"_full.jpg\",\n alt: track.name,\n style: {\n maxWidth: `300px`,\n maxHeight: `300px`\n }\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFil