GoScrobble/web/node_modules/.cache/babel-loader/ab52c2b86851ad9e61e9ee624bfe3b8f.json

1 line
24 KiB
JSON
Raw Normal View History

2022-04-25 02:47:15 +00:00
{"ast":null,"code":"var _jsxFileName = \"/app/src/Components/Navigation.js\",\n _s = $RefreshSig$();\n\nimport { React, useState, useContext } from 'react';\nimport { Navbar, NavbarBrand, Collapse, Nav, NavbarToggler, NavItem } from 'reactstrap';\nimport { Link, useLocation } from 'react-router-dom';\nimport logo from '../logo.png';\nimport './Navigation.css';\nimport AuthContext from '../Contexts/AuthContext';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst menuItems = ['Home', 'Recent' // 'About',\n];\nconst loggedInMenuItems = ['Home', 'Recent', 'My Profile' // 'Docs',\n];\n\nconst isMobile = () => {\n return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n};\n\nconst Navigation = () => {\n _s();\n\n const location = useLocation(); // Lovely hack to highlight the current page (:\n\n let active = \"home\";\n\n if (location && location.pathname && location.pathname.length > 1) {\n active = location.pathname.replace(/\\//, \"\");\n }\n\n let activeStyle = {\n color: '#FFFFFF'\n };\n let {\n user,\n Logout\n } = useContext(AuthContext);\n let [collapsed, setCollapsed] = useState(true);\n\n const toggleCollapsed = () => {\n setCollapsed(!collapsed);\n };\n\n const renderMobileNav = () => {\n return /*#__PURE__*/_jsxDEV(Navbar, {\n color: \"dark\",\n dark: true,\n fixed: \"top\",\n children: [/*#__PURE__*/_jsxDEV(NavbarBrand, {\n className: \"mr-auto\",\n children: /*#__PURE__*/_jsxDEV(Link, {\n className: \"nav-logo-link\",\n to: \"/\",\n children: [/*#__PURE__*/_jsxDEV(\"img\", {\n src: logo,\n className: \"nav-logo\",\n alt: \"logo\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 45,\n columnNumber: 79\n }, this), \" GoScrobble\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 45,\n columnNumber: 40\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 45,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(NavbarToggler, {\n onClick: toggleCollapsed,\n className: \"mr-2\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 46,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(Collapse, {\n isOpen: !collapsed,\n navbar: true,\n children: user ? /*#__PURE__*/_jsxDEV(Nav, {\n className: \"navLinkLoginMobile\",\n navbar: true,\n children: [loggedInMenuItems.map(menuItem => /*#__PURE__*/_jsxDEV(NavItem, {\n children: /*#__PURE__*/_jsxDEV(Link, {\n className: \"navLinkMobile\",\n style: active === menuItem.toLowerCase() ? activeStyle : {},\n to: menuItem === \"My Profile\" ? \"/u/\" + user.username : \"/\" + menuItem.toLowerCase(),\n onClick: toggleCollapsed,\n children: menuItem\n }, menuItem, false, {\n fileName: _jsxFileName,\n lineNumber: 52,\n columnNumber: 17\n }, this)\n }, menuItem, false, {\n fileName: _jsxFileName,\n lineNumber: 51,\n columnNumber: 13\n }, this)), /*#__PURE__*/_jsxDEV(Link, {\n to: \"/user\",\n style: active === \"user\" ? activeStyle : {},\n className: \"navLinkMobile\",\n onClick: toggleCollapsed,\n children: \"Settings\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 61,\n columnNumber: 11\n }, this), user.admin && /*#__PURE__*/_jsxDEV(Link, {\n to: \"/admin\",\n style: active === \"admin\" ? activeStyle : {},\n className: \"navLink\",\n onClick: toggleCollapsed,\n children: \"Admin\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 68