From 12478130d01f7614ac5855e242c60248fdcb08f3 Mon Sep 17 00:00:00 2001 From: Vladyslav Matsiiako Date: Sat, 8 Apr 2023 23:36:33 -0700 Subject: [PATCH] Fixing UI, UX, and bugs in the dashboard --- frontend/src/components/v2/Button/Button.tsx | 11 ++++ .../src/views/DashboardPage/DashboardPage.tsx | 11 ++-- .../components/PitDrawer/PitDrawer.tsx | 8 ++- .../SecretTableHeader/SecretTableHeader.tsx | 57 +++++-------------- 4 files changed, 36 insertions(+), 51 deletions(-) diff --git a/frontend/src/components/v2/Button/Button.tsx b/frontend/src/components/v2/Button/Button.tsx index 635aa0858..c4a89023c 100644 --- a/frontend/src/components/v2/Button/Button.tsx +++ b/frontend/src/components/v2/Button/Button.tsx @@ -33,6 +33,7 @@ const buttonVariants = cva( solid: '', outline: ['bg-transparent', 'border-2', 'border-solid'], plain: '', + selected: '', // a constant color not in use on hover or click goes colorSchema color star: 'text-bunker-200 bg-mineshaft-500' }, @@ -61,6 +62,16 @@ const buttonVariants = cva( variant: 'star', className: 'hover:bg-primary hover:text-black' }, + { + colorSchema: 'primary', + variant: 'selected', + className: 'bg-primary/10 border border-primary/50 text-bunker-200' + }, + { + colorSchema: 'secondary', + variant: 'star', + className: 'bg-mineshaft-700 border border-mineshaft-600 hover:bg-mineshaft hover:text-white' + }, { colorSchema: 'danger', variant: 'star', diff --git a/frontend/src/views/DashboardPage/DashboardPage.tsx b/frontend/src/views/DashboardPage/DashboardPage.tsx index a77eadc14..146b42165 100644 --- a/frontend/src/views/DashboardPage/DashboardPage.tsx +++ b/frontend/src/views/DashboardPage/DashboardPage.tsx @@ -189,11 +189,9 @@ export const DashboardPage = () => { handleSubmit, getValues, setValue, - formState: { isDirty, isSubmitting, dirtyFields }, + formState: { isSubmitting, dirtyFields }, reset } = method; - console.log(122, method) - console.log(123, isDirty, Object.keys(dirtyFields)) const formSecrets = useWatch({ control, name: 'secrets' }); const { fields, prepend, append, remove, update } = useFieldArray({ control, name: 'secrets' }); @@ -201,7 +199,6 @@ export const DashboardPage = () => { const isReadOnly = selectedEnv?.isWriteDenied; const isAddOnly = selectedEnv?.isReadDenied && !selectedEnv?.isWriteDenied; const canDoRollback = !isReadOnly && !isAddOnly; - console.log(123, !isRollbackMode, !isAddOnly, !isDirty) const isSubmitDisabled = isReadOnly || // on add only mode the formstate becomes dirty due to secrets missing some items @@ -415,7 +412,7 @@ export const DashboardPage = () => { ); return ( -
+
{/* breadcrumb row */} @@ -529,7 +526,7 @@ export const DashboardPage = () => {
- + }
diff --git a/frontend/src/views/DashboardPage/components/PitDrawer/PitDrawer.tsx b/frontend/src/views/DashboardPage/components/PitDrawer/PitDrawer.tsx index e97b1e13a..a398530b2 100644 --- a/frontend/src/views/DashboardPage/components/PitDrawer/PitDrawer.tsx +++ b/frontend/src/views/DashboardPage/components/PitDrawer/PitDrawer.tsx @@ -46,9 +46,14 @@ export const PitDrawer = ({ key={_id} className="py-3 px-4 text-sm" isFullWidth + colorSchema={ + (i === 0 && index === 0 && snapshotId === null) || snapshotId === _id + ? 'primary' + : 'secondary' + } variant={ (i === 0 && index === 0 && snapshotId === null) || snapshotId === _id - ? 'solid' + ? 'selected' : 'star' } onClick={() => onSelectSnapshot(_id)} @@ -65,6 +70,7 @@ export const PitDrawer = ({