- removed GitHub Link in Sidebar for embedded mode

This commit is contained in:
Sebastian Stein 2024-06-25 10:22:19 +02:00
parent a7786d8b01
commit 935f0aeed9
2 changed files with 18 additions and 11 deletions

View File

@ -1,5 +1,5 @@
import { AppShell, SideBar, Content, AuthProvider, Modal, LoginPage, SignupPage, Quests, RequestPasswordPage, SetNewPasswordPage, OverlayProfile, OverlayProfileSettings, OverlayUserSettings, OverlayItemsIndexPage, OverlayItemProfile, OverlayItemProfileSettings, Permissions, Tags } from 'utopia-ui' import { AppShell, SideBar, Content, AuthProvider, Modal, LoginPage, SignupPage, Quests, RequestPasswordPage, SetNewPasswordPage, OverlayProfile, OverlayProfileSettings, OverlayUserSettings, OverlayItemsIndexPage, OverlayItemProfile, OverlayItemProfileSettings, Permissions, Tags } from 'utopia-ui'
import { bottomRoutes, routes } from './routes/sidebar' import { getBottomRoutes, routes } from './routes/sidebar'
import { Route, Routes } from 'react-router-dom' import { Route, Routes } from 'react-router-dom'
import MapContainer from "./pages/MapContainer" import MapContainer from "./pages/MapContainer"
import './App.css' import './App.css'
@ -15,7 +15,6 @@ import { Tag } from 'utopia-ui/dist/types'
import { mapApi } from './api/mapApi' import { mapApi } from './api/mapApi'
import { layersApi } from './api/layersApi' import { layersApi } from './api/layersApi'
function App() { function App() {
@ -80,7 +79,8 @@ function App() {
}, [map]) }, [map])
const currentUrl = window.location.href;
const bottomRoutes = getBottomRoutes(currentUrl);
if (map && layers) return ( if (map && layers) return (

View File

@ -1,4 +1,3 @@
import { MapIcon } from '@heroicons/react/24/outline' import { MapIcon } from '@heroicons/react/24/outline'
@ -44,14 +43,22 @@ export const routes = [
*/ */
] ]
export const bottomRoutes = [ export const getBottomRoutes = (currentUrl: string) => {
const url = new URL(currentUrl);
const isEmbedded = url.searchParams.get('embedded') === 'true';
const bottomRoutes = [
// Other routes can be added here
];
{ if (!isEmbedded) {
path: 'https://github.com/utopia-os/utopia-ui', // url bottomRoutes.push({
icon: <svg viewBox="0 0 24 24" aria-hidden="true" className="tw-h-6 tw-w-6" stroke="currentColor"><path fillRule="evenodd" clipRule="evenodd" d="M12 2C6.477 2 2 6.463 2 11.97c0 4.404 2.865 8.14 6.839 9.458.5.092.682-.216.682-.48 0-.236-.008-.864-.013-1.695-2.782.602-3.369-1.337-3.369-1.337-.454-1.151-1.11-1.458-1.11-1.458-.908-.618.069-.606.069-.606 1.003.07 1.531 1.027 1.531 1.027.892 1.524 2.341 1.084 2.91.828.092-.643.35-1.083.636-1.332-2.22-.251-4.555-1.107-4.555-4.927 0-1.088.39-1.979 1.029-2.675-.103-.252-.446-1.266.098-2.638 0 0 .84-.268 2.75 1.022A9.607 9.607 0 0 1 12 6.82c.85.004 1.705.114 2.504.336 1.909-1.29 2.747-1.022 2.747-1.022.546 1.372.202 2.386.1 2.638.64.696 1.028 1.587 1.028 2.675 0 3.83-2.339 4.673-4.566 4.92.359.307.678.915.678 1.846 0 1.332-.012 2.407-.012 2.734 0 .267.18.577.688.48 3.97-1.32 6.833-5.054 6.833-9.458C22 6.463 17.522 2 12 2Z"></path></svg>, path: 'https://github.com/utopia-os/utopia-ui', // url
name: 'Github', // name that appear in Sidebar icon: <svg viewBox="0 0 24 24" aria-hidden="true" className="tw-h-6 tw-w-6" stroke="currentColor"><path fillRule="evenodd" clipRule="evenodd" d="M12 2C6.477 2 2 6.463 2 11.97c0 4.404 2.865 8.14 6.839 9.458.5.092.682-.216.682-.48 0-.236-.008-.864-.013-1.695-2.782.602-3.369-1.337-3.369-1.337-.454-1.151-1.11-1.458-1.11-1.458-.908-.618.069-.606.069-.606 1.003.07 1.531 1.027 1.531 1.027.892 1.524 2.341 1.084 2.91.828.092-.643.35-1.083.636-1.332-2.22-.251-4.555-1.107-4.555-4.927 0-1.088.39-1.979 1.029-2.675-.103-.252-.446-1.266.098-2.638 0 0 .84-.268 2.75 1.022A9.607 9.607 0 0 1 12 6.82c.85.004 1.705.114 2.504.336 1.909-1.29 2.747-1.022 2.747-1.022.546 1.372.202 2.386.1 2.638.64.696 1.028 1.587 1.028 2.675 0 3.83-2.339 4.673-4.566 4.92.359.307.678.915.678 1.846 0 1.332-.012 2.407-.012 2.734 0 .267.18.577.688.48 3.97-1.32 6.833-5.054 6.833-9.458C22 6.463 17.522 2 12 2Z"></path></svg>,
blank: true name: 'Github', // name that appear in Sidebar
blank: true
});
} }
] return bottomRoutes;
};