From 74d01699bca8691411a70004dc5a57a591a63a0e Mon Sep 17 00:00:00 2001 From: Nkeiruka Date: Wed, 22 May 2024 11:48:08 +0100 Subject: [PATCH] - Fixes inability to delete single profiles - Minor UI and scss changes - Profile dropdown defaults to the first profile in the list - Scrollbar 'follows' new additions of profiles. Signed-off-by: Nkeiruka --- src/components/ScrollableContainer.tsx | 4 +- src/pages/profiles/ProfileSelector.tsx | 104 ++++++++++++++----------- src/sass/_forms.scss | 17 +++- 3 files changed, 75 insertions(+), 50 deletions(-) diff --git a/src/components/ScrollableContainer.tsx b/src/components/ScrollableContainer.tsx index c0ffef08d..5203b0a64 100644 --- a/src/components/ScrollableContainer.tsx +++ b/src/components/ScrollableContainer.tsx @@ -43,7 +43,9 @@ const ScrollableContainer: FC = ({ return (
-
{children}
+
+ {children} +
); }; diff --git a/src/pages/profiles/ProfileSelector.tsx b/src/pages/profiles/ProfileSelector.tsx index 3ab9cd075..ef94da997 100644 --- a/src/pages/profiles/ProfileSelector.tsx +++ b/src/pages/profiles/ProfileSelector.tsx @@ -1,4 +1,4 @@ -import { FC } from "react"; +import { FC, useEffect } from "react"; import { Button, Icon, @@ -38,6 +38,14 @@ const ProfileSelector: FC = ({ queryFn: () => fetchProfiles(project), }); + useEffect(() => { + const contentdetails = document.getElementById("content-details"); + + if (contentdetails) { + contentdetails.scrollTop = contentdetails.scrollHeight; + } + }, [selected]); + if (isLoading) { return ; } @@ -53,7 +61,7 @@ const ProfileSelector: FC = ({ ); const addProfile = () => { - const nextProfile = unselected.pop()?.name; + const nextProfile = unselected[0]?.name; if (nextProfile) { setSelected([...selected, nextProfile]); } @@ -94,59 +102,65 @@ const ProfileSelector: FC = ({ title={title} > - {!readOnly && (index > 0 || selected.length > 1) && ( -
- - - {index > 0 && ( + +
+ {!readOnly && (index > 0 || selected.length > 1) && ( +
- )} -
- )} + +
+ )} + + {!readOnly && ( + + )} +
))} {!readOnly && (