From 29074d4d03e007f2620cf13622f0893f2e20d565 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <p.gawron@atcomp.pl>
Date: Thu, 13 Jun 2024 07:37:36 +0200
Subject: [PATCH] open page with another map if other map is available

---
 .../AccessDeniedModal.component.tsx           | 23 ++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/components/FunctionalArea/Modal/AccessDeniedModal/AccessDeniedModal.component.tsx b/src/components/FunctionalArea/Modal/AccessDeniedModal/AccessDeniedModal.component.tsx
index 2b821edf..30254e23 100644
--- a/src/components/FunctionalArea/Modal/AccessDeniedModal/AccessDeniedModal.component.tsx
+++ b/src/components/FunctionalArea/Modal/AccessDeniedModal/AccessDeniedModal.component.tsx
@@ -36,6 +36,10 @@ export const AccessDeniedModal: React.FC = () => {
     window.location.href = `mailto:${adminEmail}`;
   };
 
+  const openProject = (e: React.FormEvent<HTMLButtonElement>): void => {
+    window.location.href = `?id=${e.currentTarget.value}`;
+  };
+
   return (
     <div className="w-[400px] border border-t-[#E1E0E6] bg-white p-[24px]">
       {isAnonymousLogin && (
@@ -56,7 +60,24 @@ export const AccessDeniedModal: React.FC = () => {
           </div>
         </div>
       )}
-      {isProjectsAvailable && <div>Switch to another map</div>}
+      {isProjectsAvailable && (
+        <div>
+          <div className="mb-1 mt-5 text-sm">Switch to another map</div>
+          <div className="grid grid-cols-3 gap-2">
+            {projects.map(project => (
+              <Button
+                key={project.projectId}
+                value={project.projectId}
+                variantStyles="ghost"
+                className="text-center text-gray-500"
+                onClick={openProject}
+              >
+                {project.name} ({project.projectId})
+              </Button>
+            ))}
+          </div>
+        </div>
+      )}
       {isAdminEmail && (
         <div className="mt-1 text-center">
           <Button
-- 
GitLab