Fix: Code cleanup & truncate organization names

This commit is contained in:
Daniel Hougaard
2024-03-18 15:36:01 +01:00
parent 1d3e03e308
commit e8b635ce37
@@ -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 { useCallback, useEffect } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import Head from "next/head"; import Head from "next/head";
@@ -76,25 +74,18 @@ export default function LoginPage() {
if (callbackPort) { if (callbackPort) {
const privateKey = localStorage.getItem("PRIVATE_KEY"); const privateKey = localStorage.getItem("PRIVATE_KEY");
if (!privateKey) { let error: string | null = null;
createNotification({
text: "Private key not found",
type: "error"
});
}
if (!user.email) { if (!privateKey) error = "Private key not found";
createNotification({ if (!user.email) error = "User email not found";
text: "User email not found", if (!token) error = "No token found";
type: "error"
});
}
if (!token) { if (error) {
createNotification({ createNotification({
text: "No token found", text: error,
type: "error" type: "error"
}); });
return;
} }
const payload = { const payload = {
@@ -177,33 +168,22 @@ export default function LoginPage() {
<Spinner /> <Spinner />
) : ( ) : (
organizations.data?.map((org) => ( organizations.data?.map((org) => (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
<div <div
onClick={() => handleSelectOrganization(org)} onClick={() => handleSelectOrganization(org)}
key={org.id} 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" 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"
> >
<p className="transition-colors">{org.name}</p> <p className="truncate transition-colors">{org.name}</p>
<FontAwesomeIcon <FontAwesomeIcon
icon={faArrowRight} icon={faArrowRight}
className="text-gray-400 transition-colors group-hover:text-primary-500" className="text-gray-400 transition-all group-hover:translate-x-2 group-hover:text-primary-500"
/> />
</div> </div>
)) ))
)} )}
</div> </div>
<Button
className="mt-8"
colorSchema="primary"
isLoading={logout.isLoading}
isDisabled={logout.isLoading}
variant="solid"
size="lg"
onClick={handleLogout}
>
Logout
</Button>
</form> </form>
</div> </div>