From aa9436160182b0465b81ad3c40e563a9811eb7a6 Mon Sep 17 00:00:00 2001 From: MauserBitfly <125363940+MauserBitfly@users.noreply.github.com> Date: Thu, 7 Mar 2024 13:02:30 +0100 Subject: [PATCH] Bids 2821/dashboard validator management - group selection, dashboard loading (#78) * dropdown styles * group selection * load dashboard group --------- Co-authored-by: D13ce --- frontend/assets/css/colors.scss | 16 +++- frontend/assets/css/main.scss | 7 +- frontend/assets/css/prime.scss | 86 +++++++++++++++++++ frontend/assets/css/utils.scss | 9 ++ frontend/components/bc/BcDropdown.vue | 19 ++++ .../dashboard/ValidatorOverview.vue | 6 +- .../dashboard/chart/SummaryChart.vue | 7 +- .../components/dashboard/group/GroupLabel.vue | 26 ++++++ .../dashboard/group/GroupSelection.vue | 47 ++++++++++ .../table/DashboardTableEfficiency.vue | 4 +- .../dashboard/table/DashboardTableSummary.vue | 6 +- .../table/DashboardTableValidators.vue | 6 +- .../DashboardValidatorManageValidators.vue | 36 ++++++++ .../playground/DashboardValidatorSummary.vue | 3 +- .../playground/PlaygroundStyling.vue | 36 +++++++- frontend/composables/useCustomFetch.ts | 5 ++ frontend/i18n/en.json | 8 ++ frontend/pages/playground.vue | 3 + .../stores/dashboard/useUserDashboardStore.ts | 14 +++ .../useValidatorDashboardOverviewStore.ts | 2 +- frontend/stores/useUserStore.ts | 11 ++- frontend/types/dashboard/index.ts | 4 + 22 files changed, 335 insertions(+), 26 deletions(-) create mode 100644 frontend/assets/css/utils.scss create mode 100644 frontend/components/bc/BcDropdown.vue create mode 100644 frontend/components/dashboard/group/GroupLabel.vue create mode 100644 frontend/components/dashboard/group/GroupSelection.vue create mode 100644 frontend/components/playground/DashboardValidatorManageValidators.vue create mode 100644 frontend/stores/dashboard/useUserDashboardStore.ts diff --git a/frontend/assets/css/colors.scss b/frontend/assets/css/colors.scss index c7ef22b75..d623a5c47 100644 --- a/frontend/assets/css/colors.scss +++ b/frontend/assets/css/colors.scss @@ -7,6 +7,8 @@ --light-grey: #f0f0f0; --light-grey-2: #dfdfdf; --light-grey-3: #d3d3d3; + --light-grey-5: #eaeaea; + --light-grey-6: #a8a8a8; --dark-grey: #5c4e4e; --very-dark-grey: #362f32; --asphalt: #484f56; @@ -29,12 +31,13 @@ --primary-orange-pressed: #ffb346; --primary-contrast-color: var(--grey-4); + --primary-contrast-color-discreet: var(--light-grey-5); --background-color: var(--grey-1); --text-color: var(--light-black); --text-color-inverted: var(--light-grey); --text-color-disabled: var(--grey); - --text-color-discreet: var(--grey); + --text-color-discreet: var(--dark-grey); --button-color-active: var(--primary-orange); --button-color-hover: var(--primary-orange-hover); @@ -65,15 +68,22 @@ --megamenu-text-color: var(--grey); --megamenu-hover-color: var(--light-grey-3); + --list-highlight-background: var(--primary-orange-hover); + --list-hover-background: var(--light-grey-6); + --list-hover-color: var(--light-grey); + --list-hover-descrete-color: var(--light-grey-5); + &.dark-mode { --primary-color: var(--primary-orange); --primary-contrast-color: var(--light-black); + --primary-contrast-color-discreet: var(--dark-grey); --background-color: var(--almost-black); --text-color: var(--light-grey); --text-color-inverted: var(--light-black); --text-color-disabled: var(--grey); + --text-color-discreet: var(--grey); --button-color-active: var(--primary-orange); --button-color-hover: var(--primary-orange-hover); @@ -103,5 +113,9 @@ --megamenu-panel-color: var(--graphite); --megamenu-text-color: var(--grey); --megamenu-hover-color: var(--asphalt); + + --list-highlight-background: var(--primary-orange); + --list-hover-background: var(--dark-grey); + --list-hover-descrete-color: var(--grey); } } diff --git a/frontend/assets/css/main.scss b/frontend/assets/css/main.scss index ed3d0b72b..4698c63a9 100644 --- a/frontend/assets/css/main.scss +++ b/frontend/assets/css/main.scss @@ -1,6 +1,7 @@ @import "~/assets/css/colors.scss"; @import "~/assets/css/variables.scss"; @import "~/assets/css/fonts.scss"; +@import "~/assets/css/utils.scss"; html { margin: 0; @@ -40,12 +41,6 @@ a { @include container; } -@mixin truncate-text() { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - .text-positive{ color: var(--positive-color) } diff --git a/frontend/assets/css/prime.scss b/frontend/assets/css/prime.scss index aa228d6b4..920f3ea34 100644 --- a/frontend/assets/css/prime.scss +++ b/frontend/assets/css/prime.scss @@ -1,4 +1,5 @@ @use "~/assets/css/fonts.scss"; +@use "~/assets/css/utils.scss"; @import "~/assets/css/prime_datatable.scss"; @import "~/assets/css/prime_megamenu.scss"; @@ -204,3 +205,88 @@ .p-toast .p-toast-message.p-toast-message-error .p-toast-icon-close { color: #ff5757; } + +/*** +* Dropdown +* https://primevue.org/dropdown/ +* different Dropdown variant's: +* - 'default' (=default) : default style for dropdown +* - 'table' : dropdown style within a data table +***/ + +.p-dropdown { + background: var(--input-background); + border: 1px solid var(--input-border-color); + color: var(--input-active-text-color); + transition: background-color 0.2s, color 0.2s, border-color 0.2s; + border-radius: var(--border-radius); + padding: var(--padding); + + &.table { + background: var(--background-color); + } + + &:not(.p-disabled).p-focus { + outline: 0 none; + outline-offset: 0; + } + &.p-overlay-open { + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + } + .p-dropdown-label { + background: transparent; + border: 0 none; + padding: 0; + &.p-placeholder { + color: var(--input-placeholder-text-color); + } + &:focus, + &:enabled:focus { + outline: 0 none; + box-shadow: none; + } + } + .p-dropdown-trigger { + margin-left: var(--padding); + background: transparent; + border-top-right-radius: var(--border-radius); + border-bottom-right-radius: var(--border-radius); + } +} + +.p-dropdown-panel { + background: var(--input-background); + border: 1px solid var(--input-border-color); + color: var(--input-active-text-color); + border-radius: 0 0 var(--border-radius) var(--border-radius); + transform: translateY(-1px); + &.table { + background: var(--background-color); + } + .p-dropdown-items { + padding: var(--padding-small); + .p-dropdown-item { + @include utils.truncate-text; + padding: var(--padding-small) 4px; + border-radius: var(--border-radius); + .discreet { + color: var(--text-color-discreet); + } + &.p-highlight:not(:hover) { + background: var(--list-highlight-background); + color: var(--primary-contrast-color); + .discreet { + color: var(--primary-contrast-color-discreet); + } + } + &:hover { + background: var(--list-hover-background); + color: var(--list-hover-color); + .discreet { + color: var(--list-hover-descrete-color); + } + } + } + } +} diff --git a/frontend/assets/css/utils.scss b/frontend/assets/css/utils.scss new file mode 100644 index 000000000..b6b23ee35 --- /dev/null +++ b/frontend/assets/css/utils.scss @@ -0,0 +1,9 @@ +@mixin truncate-text() { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.truncate-text{ + @include truncate-text; +} \ No newline at end of file diff --git a/frontend/components/bc/BcDropdown.vue b/frontend/components/bc/BcDropdown.vue new file mode 100644 index 000000000..58c3b89bc --- /dev/null +++ b/frontend/components/bc/BcDropdown.vue @@ -0,0 +1,19 @@ + + + diff --git a/frontend/components/dashboard/ValidatorOverview.vue b/frontend/components/dashboard/ValidatorOverview.vue index 0c2d26dbe..bf6cfe5ff 100644 --- a/frontend/components/dashboard/ValidatorOverview.vue +++ b/frontend/components/dashboard/ValidatorOverview.vue @@ -1,6 +1,6 @@ + + diff --git a/frontend/components/dashboard/group/GroupSelection.vue b/frontend/components/dashboard/group/GroupSelection.vue new file mode 100644 index 000000000..5d7097dee --- /dev/null +++ b/frontend/components/dashboard/group/GroupSelection.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/frontend/components/dashboard/table/DashboardTableEfficiency.vue b/frontend/components/dashboard/table/DashboardTableEfficiency.vue index ad3ec3dd3..3b1e80b2b 100644 --- a/frontend/components/dashboard/table/DashboardTableEfficiency.vue +++ b/frontend/components/dashboard/table/DashboardTableEfficiency.vue @@ -33,10 +33,10 @@ const data = computed(() => { diff --git a/frontend/components/playground/DashboardValidatorSummary.vue b/frontend/components/playground/DashboardValidatorSummary.vue index d526896f2..557470bc6 100644 --- a/frontend/components/playground/DashboardValidatorSummary.vue +++ b/frontend/components/playground/DashboardValidatorSummary.vue @@ -1,6 +1,7 @@ diff --git a/frontend/components/playground/PlaygroundStyling.vue b/frontend/components/playground/PlaygroundStyling.vue index f2ea02248..e9d6a8d5b 100644 --- a/frontend/components/playground/PlaygroundStyling.vue +++ b/frontend/components/playground/PlaygroundStyling.vue @@ -5,7 +5,7 @@ import { import { faChartColumn } from '@fortawesome/pro-regular-svg-icons' -import { BcToggleMultiBar, IconSlotBlockProposal } from '#components' +import { IconSlotBlockProposal } from '#components' const emptyModalVisibility = ref(false) const headerPropModalVisibility = ref(false) @@ -24,6 +24,9 @@ const selected = ref(true) const completeList = ref([{ value: 'attestation' }, { value: 'proposal', component: IconSlotBlockProposal }, { value: 'sync' }, { value: 'chart', icon: faChartColumn }]) const selectedList = ref(['attestation', 'proposal']) +const dropodownSelection = ref() +const dropdownList = [{ value: 'yes', label: 'Yes' }, { value: 'no', label: 'No' }, { value: 'maybe', label: 'Maybe we need a bigger label' }] +