From 310f46da1e6697cf02aa755cfb9eb3be3fdc1c24 Mon Sep 17 00:00:00 2001 From: MauserBitfly <125363940+MauserBitfly@users.noreply.github.com> Date: Wed, 19 Jun 2024 09:10:42 +0200 Subject: [PATCH] Bids 3142/group filter for slot viz (#496) * group filter for slot viz * Improve tooltip for slot viz explanation --------- Co-authored-by: D13ce --- frontend/assets/css/prime.scss | 151 +++++++++--------- frontend/components/bc/BcTooltip.vue | 1 + frontend/components/bc/toggle/MultiBar.vue | 2 +- .../components/dashboard/ValidatorSlotViz.vue | 84 +++++++++- .../components/slot/viz/SlotVizViewer.vue | 133 +++++++++++---- frontend/i18n/en.json | 3 +- .../dashboard/useValidatorSlotVizStore.ts | 8 +- frontend/types/network.ts | 2 +- 8 files changed, 261 insertions(+), 123 deletions(-) diff --git a/frontend/assets/css/prime.scss b/frontend/assets/css/prime.scss index 728be658c..20ba45cb8 100644 --- a/frontend/assets/css/prime.scss +++ b/frontend/assets/css/prime.scss @@ -172,7 +172,8 @@ .p-inputswitch-slider { background: var(--button-color-active); - transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s; + transition: background-color 0.2s, color 0.2s, border-color 0.2s, + box-shadow 0.2s; border-radius: 30px; } @@ -294,83 +295,76 @@ } // Multiselect drop-down -// TODO: Apply our styles better and completely .p-multiselect { @include fonts.button_text; - color: var(--primary-contrast-color); - background: var(--button-color-active); + color: var(--input-active-text-color); + background: var(--input-background); + border: 1px solid var(--input-border-color); height: var(--default-button-height); - border: 1px solid var(--button-color-active); border-radius: var(--border-radius); - transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s; + transition: background-color 0.2s, color 0.2s, border-color 0.2s; justify-content: center; -} -.p-multiselect .p-disabled { - color: var(--button-text-color-disabled); - background: var(--button-color-disabled); - border-color: var(--button-color-disabled); -} -.p-multiselect:not(:disabled):hover { - background: var(--button-color-hover); - border-color: var(--button-color-hover); -} -.p-multiselect .p-multiselect-label.p-placeholder { - background: var(--searchbar-filter-unselected); -} -.p-multiselect .p-multiselect-trigger { - background: transparent; - color: var(--light-grey); - width: 1.5rem; // MAYBE 2rem IS BETTER - border-top-right-radius: var(--border-radius); - border-bottom-right-radius: var(--border-radius); -} -.p-multiselect .p-multiselect-label { - padding: 6px; - padding-top: 3px; - transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s; + width: 100%; + + .p-disabled { + opacity: 0.5; + } + .p-multiselect-trigger { + margin-right: var(--padding); + } + .p-multiselect-label-container { + margin-top: auto; + margin-bottom: auto; + margin-left: var(--padding); + .p-multiselect-label { + @include utils.truncate-text; + &.p-placeholder { + background: var(--searchbar-filter-unselected); + } + } + } } .p-multiselect-panel { - background: var(--container-background); - border: 0 none; + color: var(--input-active-text-color); + background: var(--input-background); + border: 1px solid var(--input-border-color); border-radius: var(--border-radius); -} -.p-multiselect-panel .p-multiselect-items { - padding: 0.75rem 0; -} -.p-multiselect-panel .p-multiselect-items .p-multiselect-item { - margin: 0; - padding: 4px; - border: 0 none; - color: var(--text-color); - background: transparent; - transition: box-shadow 0.2s; - border-radius: 0; -} -.p-multiselect-panel .p-multiselect-items .p-multiselect-item.p-highlight { - color: #047857; - background: #F0FDFA; -} -.p-multiselect-panel .p-multiselect-items .p-multiselect-item.p-highlight.p-focus { - background: rgba(16, 185, 129, 0.24); -} -.p-multiselect-panel .p-multiselect-items .p-multiselect-item:not(.p-highlight):not(.p-disabled).p-focus { - color: #4b5563; - background: #e5e7eb; -} -.p-multiselect-panel .p-multiselect-items .p-multiselect-item:not(.p-highlight):not(.p-disabled):hover { - color: #4b5563; - background: #f3f4f6; -} -.p-multiselect-panel .p-multiselect-items .p-multiselect-item .p-checkbox { - margin-right: 0.5rem; -} -.p-multiselect-panel .p-multiselect-items .p-multiselect-item-group { - margin: 0; - padding: 0.75rem 1.25rem; - color: #374151; - background: #ffffff; - font-weight: 700; + padding: var(--padding) var(--padding-small); + + .p-multiselect-header { + float: left; + margin-right: var(--padding); + padding-left: var(--padding-small); + .p-multiselect-close { + display: none; + } + } + + .p-multiselect-items-wrapper { + max-width: 200px; + margin-top: var(--padding); + height: 100%; + border-top: 1px solid var(--input-border-color); + + .p-multiselect-items { + .p-multiselect-item { + padding: var(--padding-small) 4px var(--padding-small); + border-radius: var(--border-radius); + + &:hover { + background: var(--list-hover-background); + color: var(--list-hover-color); + } + .p-checkbox { + margin-right: var(--padding); + } + span { + @include utils.truncate-text; + } + } + } + } } /*** @@ -401,10 +395,9 @@ &.table { background: var(--background-color); } - &.header{ + &.header { background: transparent; border: none; - } &:not(.p-disabled).p-focus { @@ -475,15 +468,15 @@ } } -.p-accordion{ - .p-accordion-tab{ - .p-accordion-header{ +.p-accordion { + .p-accordion-tab { + .p-accordion-header { color: var(--container-color); background-color: var(--container-background); border: 1px solid var(--container-border-color); border-radius: var(--border-radius); padding: 16px; - .p-accordion-header-link{ + .p-accordion-header-link { display: flex; justify-content: space-between; flex-direction: row-reverse; @@ -491,12 +484,12 @@ } } - &.p-accordion-tab-active{ - .p-accordion-header{ - svg{ + &.p-accordion-tab-active { + .p-accordion-header { + svg { transform: rotate(90deg); } } } } -} \ No newline at end of file +} diff --git a/frontend/components/bc/BcTooltip.vue b/frontend/components/bc/BcTooltip.vue index a5c9c625e..fdd02786f 100644 --- a/frontend/components/bc/BcTooltip.vue +++ b/frontend/components/bc/BcTooltip.vue @@ -269,6 +269,7 @@ onUnmounted(() => { color: var(--tt-color); @include fonts.tooltip_text; pointer-events: none; + max-width: 300px; &.dark { --tt-bg-color: var(--light-black); diff --git a/frontend/components/bc/toggle/MultiBar.vue b/frontend/components/bc/toggle/MultiBar.vue index 340179e7f..65edf2309 100644 --- a/frontend/components/bc/toggle/MultiBar.vue +++ b/frontend/components/bc/toggle/MultiBar.vue @@ -51,7 +51,7 @@ watch(modelValues, () => { diff --git a/frontend/components/slot/viz/SlotVizViewer.vue b/frontend/components/slot/viz/SlotVizViewer.vue index 0051832e4..2ad866827 100644 --- a/frontend/components/slot/viz/SlotVizViewer.vue +++ b/frontend/components/slot/viz/SlotVizViewer.vue @@ -1,5 +1,9 @@ diff --git a/frontend/i18n/en.json b/frontend/i18n/en.json index d981192b7..3cc939bc6 100644 --- a/frontend/i18n/en.json +++ b/frontend/i18n/en.json @@ -150,12 +150,13 @@ }, "slotViz": { "head": "Head", + "info_tootlip": "Slot Viz explanation", "filter": { "attestation": "If enabled, attestations will be shown.", "proposal": "If enabled, blocks will be shown.", "slashing": "If enabled, slashings will be shown.", "sync": "If enabled, sync committees will be shown.", - "visible": "If enabled, all duties will be shown." + "visible": "If enabled, all duty icons for the duties selected to the left will be shown." }, "tooltip": { "attestation": "Attestation", diff --git a/frontend/stores/dashboard/useValidatorSlotVizStore.ts b/frontend/stores/dashboard/useValidatorSlotVizStore.ts index ebd1a79fc..1a487dd87 100644 --- a/frontend/stores/dashboard/useValidatorSlotVizStore.ts +++ b/frontend/stores/dashboard/useValidatorSlotVizStore.ts @@ -14,8 +14,12 @@ export function useValidatorSlotVizStore () { const slotViz = computed(() => data.value) - async function refreshSlotViz (dashboardKey: DashboardKey) { - const res = await fetch(API_PATH.DASHBOARD_SLOTVIZ, { headers: {} }, { dashboardKey: dashboardKey || 'MQ' }) + async function refreshSlotViz (dashboardKey: DashboardKey, groups?: number[]) { + let query + if (groups?.length) { + query = { groups: groups.join(',') } + } + const res = await fetch(API_PATH.DASHBOARD_SLOTVIZ, { headers: {}, query }, { dashboardKey: dashboardKey || 'MQ' }) // We use this hacky solution as we don't have an api endpoint to load a slot viz without validators // So we load it for a small public dashboard and then remove the validator informations from it. diff --git a/frontend/types/network.ts b/frontend/types/network.ts index 3617fc7f1..9fca0d21f 100644 --- a/frontend/types/network.ts +++ b/frontend/types/network.ts @@ -30,7 +30,7 @@ export enum ChainIDs { Chiado = 10200 } -interface ChainInfoFields { +export interface ChainInfoFields { name: string, description: string, family: ChainFamily,