From 0138f20b971d3efdd3391393d179f5d496695a4e Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 5 Sep 2023 16:45:01 +0200 Subject: [PATCH] implemented permissions --- src/Components/AppShell/AppShell.tsx | 4 +- src/Components/AppShell/NavBar.tsx | 10 +-- src/Components/Auth/LoginPage.tsx | 2 +- src/Components/Auth/SignupPage.tsx | 2 +- src/Components/Auth/useAuth.tsx | 4 +- src/Components/Map/Layer.tsx | 1 - src/Components/Map/Permissions.tsx | 12 +++- .../Map/Subcomponents/AddButton.tsx | 5 +- .../ItemPopupComponents/HeaderView.tsx | 20 ++++-- src/Components/Map/UtopiaMap.tsx | 61 ++++++++++--------- src/Components/Map/hooks/usePermissions.tsx | 39 ++++++++++-- src/Components/Map/index.tsx | 1 + src/Components/Profile/Settings.tsx | 6 +- src/index.tsx | 2 +- src/types.ts | 11 +++- 15 files changed, 118 insertions(+), 62 deletions(-) diff --git a/src/Components/AppShell/AppShell.tsx b/src/Components/AppShell/AppShell.tsx index 2b22ad3d..ec6a63b6 100644 --- a/src/Components/AppShell/AppShell.tsx +++ b/src/Components/AppShell/AppShell.tsx @@ -3,7 +3,7 @@ import NavBar from './NavBar' import { BrowserRouter } from 'react-router-dom' import { ToastContainer } from 'react-toastify' -export function AppShell({ appName, useAuth, children }) { +export function AppShell({ appName, children }) { return ( - +
{children}
diff --git a/src/Components/AppShell/NavBar.tsx b/src/Components/AppShell/NavBar.tsx index b90d71d3..b7204536 100644 --- a/src/Components/AppShell/NavBar.tsx +++ b/src/Components/AppShell/NavBar.tsx @@ -1,6 +1,6 @@ import { useState } from "react"; import { useNavigate } from "react-router-dom"; -//import { useAuth } from "../api/auth"; +import { useAuth } from "../Auth" import { Link } from "react-router-dom"; import { toast } from "react-toastify"; import QuestionMarkIcon from '@heroicons/react/24/outline/QuestionMarkCircleIcon' @@ -8,7 +8,7 @@ import * as React from "react"; import DialogModal from "./DialogModal"; -export default function NavBar({ appName, useAuth }: { appName: string, useAuth: any }) { +export default function NavBar({ appName}: { appName: string }) { const [signupOpen, setSignupOpen] = useState(false); @@ -110,7 +110,7 @@ export default function NavBar({ appName, useAuth }: { appName: string, useAuth: {isAuthenticated ?
- {user.avatar ?
+ {user?.avatar ?
-