mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
1 line
16 KiB
JSON
1 line
16 KiB
JSON
{"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: _jsxFileName,\n lineNumber: 88,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n style: {\n width: `290px`,\n padding: `0 10px 10px 10px`,\n margin: `0 5px 0 5px`,\n textAlign: `left`\n },\n children: [/*#__PURE__*/_jsxDEV(\"span\", {\n style: {\n fontSize: '14pt'\n },\n children: artists\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 92,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"span\", {\n style: {\n fontSize: '14pt',\n textDecoration: 'none'\n },\n children: albums\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 99,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 99,\n columnNumber: 18\n }, this), track.mbid && /*#__PURE__*/_jsxDEV(\"a\", {\n rel: \"noreferrer\",\n target: \"_blank\",\n href: \"https://musicbrainz.org/track/\" + track.mbid,\n children: [\"Open on MusicBrainz\", /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 136\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 28\n }, this), track.spotify_id && /*#__PURE__*/_jsxDEV(\"a\", {\n rel: \"noreferrer\",\n target: \"_blank\",\n href: \"https://open.spotify.com/track/\" + track.spotify_id,\n children: [\"Open on Spotify\", /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 101,\n columnNumber: 145\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 101,\n columnNumber: 34\n }, this), length && /*#__PURE__*/_jsxDEV(\"span\", {\n children: [\"Track Length: \", length]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 102,\n columnNumber: 24\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n style: {\n width: `290px`,\n padding: `0 10px 10px 10px`\n },\n children: [/*#__PURE__*/_jsxDEV(\"h3\", {\n children: \"Top 10 Scrobblers\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 105,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(TopUserTable, {\n trackuuid: track.uuid\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 106,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 104,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 86,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 79,\n columnNumber: 5\n }, this);\n};\n\n_s(Track, \"GJD5fyEnrzIydc5puP1sWPwWDMI=\");\n\n_c = Track;\nexport default Track;\n\nvar _c;\n\n$RefreshReg$(_c, \"Track\");","map":{"version":3,"sources":["/app/src/Pages/Track.js"],"names":["React","useContext","useState","useEffect","TopUserTable","ScaleLoader","getTrack","Link","AuthContext","Track","route","user","loading","setLoading","track","setTrack","trackUUID","match","params","uuid","then","data","length","Date","toISOString","substr","artists","artist","row","name","push","albums","album","margin","display","flexWrap","textAlign","width","padding","process","env","REACT_APP_API_URL","img","maxWidth","maxHeight","fontSize","textDecoration","mbid","spotify_id"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,QAA5B,EAAsCC,SAAtC,QAAuD,OAAvD;AACA,OAAO,YAAP;AACA,OAAO,aAAP;AACA,OAAOC,YAAP,MAAyB,4BAAzB;AACA,OAAOC,WAAP,MAAwB,4BAAxB;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,IAAT,QAAqB,kBAArB;AACA,OAAOC,WAAP,MAAwB,yBAAxB;;;AAEA,MAAMC,KAAK,GAAIC,K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AAAoB,YAAA,MAAM,EAAC,QAA3B;AAAoC,YAAA,IAAI,EAAE,mCAAmCjC,KAAK,CAACiC,IAAnF;AAAA,2DAA4G;AAAA;AAAA;AAAA;AAAA,oBAA5G;AAAA;AAAA;AAAA;AAAA;AAAA,kBATjB,EAUGjC,KAAK,CAACkC,UAAN,iBAAoB;AAAG,YAAA,GAAG,EAAC,YAAP;AAAoB,YAAA,MAAM,EAAC,QAA3B;AAAoC,YAAA,IAAI,EAAE,oCAAoClC,KAAK,CAACkC,UAApF;AAAA,uDAA+G;AAAA;AAAA;AAAA;AAAA,oBAA/G;AAAA;AAAA;AAAA;AAAA;AAAA,kBAVvB,EAWG1B,MAAM,iBAAI;AAAA,yCAAqBA,MAArB;AAAA;AAAA;AAAA;AAAA;AAAA,kBAXb;AAAA;AAAA;AAAA;AAAA;AAAA,gBAJF,eAiBE;AAAK,UAAA,KAAK,EAAE;AAACe,YAAAA,KAAK,EAAG,OAAT;AAAiBC,YAAAA,OAAO,EAAG;AAA3B,WAAZ;AAAA,kCACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBADF,eAEE,QAAC,YAAD;AAAc,YAAA,SAAS,EAAExB,KAAK,CAACK;AAA/B;AAAA;AAAA;AAAA;AAAA,kBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAjBF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YAPF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAkCD,CAtGD;;GAAMV,K;;KAAAA,K;AAwGN,eAAeA,KAAf","sourcesContent":["import 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';\n\nconst Track = (route) => {\n const { user } = useContext(AuthContext);\n\n const [loading, setLoading] = useState(true);\n const [track, setTrack] = useState({});\n\n let trackUUID = false;\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)\n .then(data => {\n setTrack(data);\n setLoading(false);\n })\n }, [trackUUID])\n\n if (loading) {\n return (\n <div className=\"pageWrapper\">\n <ScaleLoader color=\"#6AD7E5\" />\n </div>\n )\n }\n\n if (!trackUUID || !track) {\n return (\n <div className=\"pageWrapper\">\n Unable to fetch user\n </div>\n )\n }\n\n let length = \"0\";\n if (track.length && track.length !== '') {\n length = new Date(track.length * 1000).toISOString().substr(11, 8)\n }\n\n let artists = [];\n for (let artist of track.artists) {\n const row = (\n <Link\n key={artist.uuid}\n to={\"/artist/\" + artist.uuid}\n >{artist.name} </Link>\n );\n artists.push(row);\n }\n\n let albums = [];\n for (let album of track.albums) {\n const row = (\n <Link\n key={album.uuid}\n to={\"/album/\" + album.uuid}\n >{album.name} </Link>\n );\n albums.push(row);\n }\n\n return (\n <div className=\"pageWrapper\">\n <h1 style={{margin: 0}}>\n {track.name} {user && false && <Link\n key=\"editbuttonomg\"\n to={\"/track/\" + track.uuid + \"/edit\"}\n >edit</Link>}\n </h1>\n <div className=\"pageBody\">\n <div style={{display: `flex`, flexWrap: `wrap`, textAlign: `center`}}>\n <div style={{width: `300px`, padding: `0 10px 10px 10px`, textAlign: `left`}}>\n <img src={process.env.REACT_APP_API_URL + \"/img/\" + track.img + \"_full.jpg\"} alt={track.name} style={{maxWidth: `300px`, maxHeight: `300px`}}/>\n </div>\n <div style={{width: `290px`, padding: `0 10px 10px 10px`, margin: `0 5px 0 5px`, textAlign: `left`}}>\n <span style={{fontSize: '14pt'}}>\n {artists}\n </span>\n <br/>\n <span style={{fontSize: '14pt', textDecoration: 'none'}}>\n {albums}\n </span>\n <br/><br/>\n {track.mbid && <a rel=\"noreferrer\" target=\"_blank\" href={\"https://musicbrainz.org/track/\" + track.mbid}>Open on MusicBrainz<br/></a>}\n {track.spotify_id && <a rel=\"noreferrer\" target=\"_blank\" href={\"https://open.spotify.com/track/\" + track.spotify_id}>Open on Spotify<br/></a>}\n {length && <span>Track Length: {length}</span>}\n </div>\n <div style={{width: `290px`, padding: `0 10px 10px 10px`}}>\n <h3>Top 10 Scrobblers</h3>\n <TopUserTable trackuuid={track.uuid}/>\n </div>\n </div>\n </div>\n </div>\n );\n}\n\nexport default Track;"]},"metadata":{},"sourceType":"module"} |