From e8b635ce37f7b25e1937abfdb36d1df0175b7387 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com> Date: Mon, 18 Mar 2024 15:36:01 +0100 Subject: [PATCH] Fix: Code cleanup & truncate organization names --- .../src/pages/login/select-organization.tsx | 40 +++++-------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/frontend/src/pages/login/select-organization.tsx b/frontend/src/pages/login/select-organization.tsx index cd37d5a27..481b42966 100644 --- a/frontend/src/pages/login/select-organization.tsx +++ b/frontend/src/pages/login/select-organization.tsx @@ -1,5 +1,3 @@ -/* eslint-disable jsx-a11y/no-static-element-interactions */ -/* eslint-disable jsx-a11y/click-events-have-key-events */ import { useCallback, useEffect } from "react"; import { useTranslation } from "react-i18next"; import Head from "next/head"; @@ -76,25 +74,18 @@ export default function LoginPage() { if (callbackPort) { const privateKey = localStorage.getItem("PRIVATE_KEY"); - if (!privateKey) { - createNotification({ - text: "Private key not found", - type: "error" - }); - } + let error: string | null = null; - if (!user.email) { - createNotification({ - text: "User email not found", - type: "error" - }); - } + if (!privateKey) error = "Private key not found"; + if (!user.email) error = "User email not found"; + if (!token) error = "No token found"; - if (!token) { + if (error) { createNotification({ - text: "No token found", + text: error, type: "error" }); + return; } const payload = { @@ -177,33 +168,22 @@ export default function LoginPage() { ) : ( organizations.data?.map((org) => ( + // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
handleSelectOrganization(org)} key={org.id} className="group flex cursor-pointer items-center justify-between rounded-md bg-mineshaft-700 px-4 py-3 capitalize text-gray-200 shadow-md transition-colors hover:bg-mineshaft-600" > -

{org.name}

+

{org.name}

)) )} - -