From 6df867181fd1eb72187695a47c18752706a0f6a3 Mon Sep 17 00:00:00 2001 From: enzo-bitfly <194075446+enzo-bitfly@users.noreply.github.com> Date: Wed, 15 Jan 2025 12:24:00 +0100 Subject: [PATCH] refactor(DashboardTableSummaryDetails): rename variable names for clarity --- .../table/DashboardTableSummaryDetails.vue | 50 +++++++++---------- frontend/types/dashboard/summary.ts | 2 +- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/frontend/components/dashboard/table/DashboardTableSummaryDetails.vue b/frontend/components/dashboard/table/DashboardTableSummaryDetails.vue index 165da311f..da967f56a 100644 --- a/frontend/components/dashboard/table/DashboardTableSummaryDetails.vue +++ b/frontend/components/dashboard/table/DashboardTableSummaryDetails.vue @@ -39,33 +39,33 @@ watch( type CombinedPropOrUndefined = SummaryDetailsEfficiencyCombinedProp | undefined -const data = computed(() => { - const list: SummaryRow[][] = [ +const summarySections = computed(() => { + const sections: SummaryRow[][] = [ [], [], [], ] - const addToList = ( + const addToSection = ( index: number, - prop?: SummaryDetailsEfficiencyCombinedProp, + summaryProperty?: SummaryDetailsEfficiencyCombinedProp, ) => { - if (!prop) { + if (!summaryProperty) { return } - const title = $t(`dashboard.validator.summary.row.${prop}`) + const title = $t(`dashboard.validator.summary.row.${summaryProperty}`) const row = { - prop, + summaryProperty, title, } - list[index].push(row) + sections[index].push(row) } - const addPropsTolist = ( - index: number, - props: CombinedPropOrUndefined[], + const addSummaryPropertiesToSection = ( + sectionIndex: number, + summaryProperties: CombinedPropOrUndefined[], ) => { - props.forEach(p => addToList(index, p)) + summaryProperties.forEach(summaryProperty => addToSection(sectionIndex, summaryProperty)) } const rewardCols: CombinedPropOrUndefined[] @@ -75,7 +75,7 @@ const data = computed(() => { .attestations ? [] : rewardCols - addPropsTolist(0, [ + addSummaryPropertiesToSection(0, [ (!props.tableVisibility.efficiency ? 'efficiency' : undefined), ...addCols, 'attestations', @@ -86,7 +86,7 @@ const data = computed(() => { 'attestation_avg_incl_dist', ]) - addPropsTolist(1, [ + addSummaryPropertiesToSection(1, [ 'sync', 'validators_sync', 'proposals', @@ -96,18 +96,18 @@ const data = computed(() => { ]) addCols = !props.tableVisibility.attestations ? [] : rewardCols - addPropsTolist(2, [ + addSummaryPropertiesToSection(2, [ 'apr', 'luck', 'missed_rewards', ...addCols, ]) - return list + return sections }) const rowClass = (data: SummaryRow) => { - if (!data.prop) { + if (!data.property) { return 'bold' // headline without prop } const classNames: Partial< @@ -123,7 +123,7 @@ const rowClass = (data: SummaryRow) => { slashings: 'bold spacing-top', sync: props.tableVisibility.efficiency ? 'bold' : 'bold spacing-top', } - return classNames[data.prop] + return classNames[data.property] } @@ -133,25 +133,25 @@ const rowClass = (data: SummaryRow) => { class="details-container" >
- {{ prop.title }} + {{ summaryRow.title }}