Skip to content

Commit f197976

Browse files
committed
feat: add registered trademark symbol to BeaconScore
See: BC-47
1 parent a17821b commit f197976

File tree

10 files changed

+151
-52
lines changed

10 files changed

+151
-52
lines changed

frontend/components/bc/BcTranslation.vue

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ defineProps<{
55
* The path to the key in the translation file (e.g. en.json)
66
*/
77
keypath: TranslationKey,
8-
linkpath?: TranslationKey,
9-
listpath?: TranslationKey,
10-
tag?: keyof HTMLElementTagNameMap,
118
/**
129
* URL to link to
1310
*
@@ -22,6 +19,13 @@ defineProps<{
2219
* "link": "Click here"
2320
* }
2421
*/
22+
linkpath?: TranslationKey,
23+
listpath?: TranslationKey,
24+
/**
25+
* Part of the translation to be shown as `superscript` (e.g. ®)
26+
*/
27+
suppath?: TranslationKey,
28+
tag?: keyof HTMLElementTagNameMap,
2529
to?: string,
2630
}>()
2731
</script>
@@ -36,7 +40,9 @@ defineProps<{
3640
<span
3741
v-if="boldpath"
3842
class="bc-translation-bold"
39-
>{{ $t(boldpath) }}</span>
43+
>
44+
{{ $t(boldpath) }}
45+
</span>
4046
</template>
4147
<template #link>
4248
<slot
@@ -67,6 +73,11 @@ defineProps<{
6773
</ul>
6874
</slot>
6975
</template>
76+
<template #sup>
77+
<sup v-if="suppath">
78+
{{ $t(suppath) }}
79+
</sup>
80+
</template>
7081
</I18nT>
7182
</template>
7283

frontend/components/dashboard/DashboardValidatorOverview.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,13 @@ const aprInfos = [
137137
</DashboardValidatorOverviewItem>
138138
<DashboardValidatorOverviewItem
139139
:infos="efficiencyInfos"
140-
:title="$t('dashboard.validator.overview.24h_beaconscore')"
141140
>
141+
<template #title>
142+
<BcTranslation
143+
keypath="dashboard.validator.overview.24h_beaconscore"
144+
suppath="base.common.registered_trademark_symbol"
145+
/>
146+
</template>
142147
<BcTooltip
143148
tooltip-class="tooltip"
144149
>
@@ -151,6 +156,7 @@ const aprInfos = [
151156
<BcTranslation
152157
keypath="dashboard.beaconscore.template"
153158
linkpath="dashboard.beaconscore.link"
159+
suppath="base.common.registered_trademark_symbol"
154160
:to="externalLink.knowledgeBase.beaconScore"
155161
/>
156162
</template>

frontend/components/dashboard/DashboardValidatorOverviewItem.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,21 @@ const props = defineProps<{
66
label: string,
77
value: NumberOrString,
88
}[],
9-
title: string,
9+
title?: string,
1010
}>()
1111
</script>
1212

1313
<template>
1414
<div class="box">
1515
<div class="main">
1616
<div class="big_text_label">
17-
{{ props.title }}
17+
<slot
18+
v-if="$slots.title"
19+
name="title"
20+
/>
21+
<template v-else>
22+
{{ props.title }}
23+
</template>
1824
</div>
1925
<div class="big_text dashbaord-validator-overview-item__value">
2026
<slot />

frontend/components/dashboard/chart/DashboardChartSummary.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,20 @@ const formatTimestamp = (value: string) => {
287287
}
288288
}
289289
const isTriggeringOnMouseMove = ref(true)
290+
const efficiencyLabel = computed(() => {
291+
switch (props.filter?.efficiency) {
292+
case 'all':
293+
return `${$t('base.common.beaconscore')}®`
294+
case 'attestation':
295+
return $t('dashboard.validator.summary.chart.efficiency.attestation')
296+
case 'proposal':
297+
return $t('dashboard.validator.summary.chart.efficiency.proposal')
298+
case 'sync':
299+
return $t('dashboard.validator.summary.chart.efficiency.sync')
300+
default:
301+
return ''
302+
}
303+
})
290304
const option = computed<EChartsOption>(() => {
291305
return {
292306
color: colors.value.groups,
@@ -409,9 +423,7 @@ const option = computed<EChartsOption>(() => {
409423
? Math.max(0, 10 * Math.ceil(range.min / 10 - 1))
410424
: 10 * Math.ceil(range.min / 10 - 1),
411425
minInterval: 10,
412-
name: $t(
413-
`dashboard.validator.summary.chart.efficiency.${props.filter?.efficiency}`,
414-
),
426+
name: efficiencyLabel.value,
415427
nameLocation: 'middle',
416428
nameTextStyle: {
417429
padding: [

frontend/components/dashboard/chart/DashboardChartSummaryFilter.vue

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,33 @@ const aggregationDisabled = ({ disabled }: { disabled: boolean }) => disabled
3737
3838
/** efficiency */
3939
const efficiency = ref<EfficiencyType>(chartFilter.value.efficiency)
40-
41-
const efficiencyList = EfficiencyTypes.map(e => ({
42-
id: e,
43-
label: $t(`dashboard.validator.summary.chart.efficiency.${e}`),
44-
}))
40+
const efficiencyList = EfficiencyTypes.map((efficiencyType) => {
41+
let efficiencyTranslationKey: TranslationKey
42+
switch (efficiencyType) {
43+
case 'all':
44+
efficiencyTranslationKey = 'base.common.beaconscore'
45+
break
46+
case 'attestation':
47+
efficiencyTranslationKey = 'dashboard.validator.summary.chart.efficiency.attestation'
48+
break
49+
case 'proposal':
50+
efficiencyTranslationKey = 'dashboard.validator.summary.chart.efficiency.proposal'
51+
break
52+
case 'sync':
53+
efficiencyTranslationKey = 'dashboard.validator.summary.chart.efficiency.sync'
54+
break
55+
}
56+
return {
57+
efficiencyTranslationKey,
58+
id: efficiencyType,
59+
}
60+
})
4561
watch(efficiency, (e) => {
4662
chartFilter.value.efficiency = e
4763
})
64+
const getEfficiencyTranslationKey = (id: EfficiencyType) => {
65+
return efficiencyList.find(efficiencyType => efficiencyType.id === id)!.efficiencyTranslationKey
66+
}
4867
4968
/** groups */
5069
const total = ref(
@@ -156,9 +175,23 @@ const selectedLabel = computed(() => {
156175
v-model="efficiency"
157176
:options="efficiencyList"
158177
option-value="id"
159-
option-label="label"
178+
option-label="labelTranslationKey"
160179
class="small"
161-
/>
180+
>
181+
<template #option="{ efficiencyTranslationKey }">
182+
<BcTranslation
183+
:keypath="efficiencyTranslationKey"
184+
suppath="base.common.registered_trademark_symbol"
185+
/>
186+
</template>
187+
188+
<template #value="{ value }">
189+
<BcTranslation
190+
:keypath="getEfficiencyTranslationKey(value)"
191+
suppath="base.common.registered_trademark_symbol"
192+
/>
193+
</template>
194+
</BcDropdown>
162195

163196
<BcMultiSelect
164197
v-model="selectedGroups"

frontend/components/dashboard/chart/DashboardChartTooltipHeader.vue

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,18 @@ const epochText = computed(() => {
7373
})
7474
7575
const title = computed(() => {
76-
if (props.efficiencyType) {
77-
return props.t(
78-
`dashboard.validator.summary.chart.efficiency.${props.efficiencyType}`,
79-
)
76+
switch (props.efficiencyType) {
77+
case 'all':
78+
return `${props.t('base.common.beaconscore')}®`
79+
case 'attestation':
80+
return props.t('dashboard.validator.summary.chart.efficiency.attestation')
81+
case 'proposal':
82+
return props.t('dashboard.validator.summary.chart.efficiency.proposal')
83+
case 'sync':
84+
return props.t('dashboard.validator.summary.chart.efficiency.sync')
85+
default:
86+
return ''
8087
}
81-
return undefined
8288
})
8389
</script>
8490

frontend/components/dashboard/table/DashboardTableSummary.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,10 @@ watch(
260260
>
261261
<template #header>
262262
<div class="validators-header">
263-
<div>{{ $t("dashboard.validator.col.beaconscore") }}</div>
263+
<BcTranslation
264+
keypath="base.common.beaconscore"
265+
suppath="base.common.registered_trademark_symbol"
266+
/>
264267
<BcTooltip
265268
class="info"
266269
tooltip-class="summary-info-tooltip"
@@ -270,6 +273,7 @@ watch(
270273
<BcTranslation
271274
keypath="dashboard.beaconscore.template"
272275
linkpath="dashboard.beaconscore.link"
276+
suppath="base.common.registered_trademark_symbol"
273277
:to="externalLink.knowledgeBase.beaconScore"
274278
/>
275279
</template>

frontend/components/dashboard/table/DashboardTableSummaryValue.vue

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -426,14 +426,21 @@ const openValidatorModal = () => {
426426
/>
427427
<template #tooltip>
428428
<span class="efficiency-total-tooltip">
429-
{{
430-
$t('dashboard.validator.summary.tooltip.higher', {
431-
name: groupName,
432-
average: formatPercent(data.efficiencyTotal.networkEfficiency, {
429+
<I18nT
430+
keypath="dashboard.validator.summary.tooltip.higher"
431+
>
432+
<template #sup>
433+
<sup>{{ $t("base.common.registered_trademark_symbol") }}</sup>
434+
</template>
435+
<template #name>
436+
{{ groupName }}
437+
</template>
438+
<template #average>
439+
{{ formatPercent(data.efficiencyTotal.networkEfficiency, {
433440
maximumFractionDigits: 2,
434-
}),
435-
})
436-
}}
441+
}) }}
442+
</template>
443+
</I18nT>
437444
</span>
438445
</template>
439446
</BcTooltip>
@@ -453,14 +460,21 @@ const openValidatorModal = () => {
453460
/>
454461
<template #tooltip>
455462
<span class="efficiency-total-tooltip">
456-
{{
457-
$t('dashboard.validator.summary.tooltip.equal', {
458-
name: groupName,
459-
average: formatPercent(data.efficiencyTotal.networkEfficiency, {
463+
<I18nT
464+
keypath="dashboard.validator.summary.tooltip.equal"
465+
>
466+
<template #sup>
467+
<sup>{{ $t("base.common.registered_trademark_symbol") }}</sup>
468+
</template>
469+
<template #name>
470+
{{ groupName }}
471+
</template>
472+
<template #average>
473+
{{ formatPercent(data.efficiencyTotal.networkEfficiency, {
460474
maximumFractionDigits: 2,
461-
}),
462-
})
463-
}}
475+
}) }}
476+
</template>
477+
</I18nT>
464478
</span>
465479
</template>
466480
</BcTooltip>
@@ -480,14 +494,21 @@ const openValidatorModal = () => {
480494
/>
481495
<template #tooltip>
482496
<span class="efficiency-total-tooltip">
483-
{{
484-
$t('dashboard.validator.summary.tooltip.lower', {
485-
name: groupName,
486-
average: formatPercent(data.efficiencyTotal.networkEfficiency, {
497+
<I18nT
498+
keypath="dashboard.validator.summary.tooltip.lower"
499+
>
500+
<template #sup>
501+
<sup>{{ $t("base.common.registered_trademark_symbol") }}</sup>
502+
</template>
503+
<template #name>
504+
{{ groupName }}
505+
</template>
506+
<template #average>
507+
{{ formatPercent(data.efficiencyTotal.networkEfficiency, {
487508
maximumFractionDigits: 2,
488-
}),
489-
})
490-
}}
509+
}) }}
510+
</template>
511+
</I18nT>
491512
</span>
492513
</template>
493514
</BcTooltip>

frontend/i18n/locales/en.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99
"try_again": "Try again"
1010
},
1111
"all": "All",
12+
"beaconscore": "BeaconScore{sup}",
1213
"close": "Close",
1314
"ethereum": "Ethereum",
1415
"log_in": "Log in",
1516
"no_results": "No results found.",
1617
"open_navigation": "Open Navigation",
18+
"registered_trademark_symbol": "®",
1719
"side_navigation": "Side Navigation",
1820
"something_went_wrong": "Something went wrong."
1921
},
@@ -172,7 +174,7 @@
172174
"account_dashboard": "Account Dashboard",
173175
"beaconscore": {
174176
"link": "knowledge base article",
175-
"template": "Read more about how we calculate the BeaconScore in our {link}"
177+
"template": "Read more about how we calculate the BeaconScore{sup} in our {link}"
176178
},
177179
"creation": {
178180
"network": {
@@ -351,7 +353,6 @@
351353
"col": {
352354
"amount": "Amount",
353355
"balance": "Balance",
354-
"beaconscore": "BeaconScore",
355356
"block_processed": "Block Processed",
356357
"block_queued": "Block Queued",
357358
"cl_rewards": "Cl Rewards",
@@ -443,7 +444,7 @@
443444
"validators_limit_exceeded": "Cannot add validators. The maximum effective balance of the validators exceeds your plan's limit."
444445
},
445446
"overview": {
446-
"24h_beaconscore": "BeaconScore (24h)",
447+
"24h_beaconscore": "BeaconScore{sup} (24h)",
447448
"30d_apr": "APR (30d)",
448449
"30d_rewards": "Rewards (30d)",
449450
"online_validators": "Online Validators",
@@ -528,7 +529,6 @@
528529
"all_groups": "All Groups",
529530
"average": "Network Average",
530531
"efficiency": {
531-
"all": "BeaconScore",
532532
"attestation": "Attestation Eff.",
533533
"proposal": "Proposal Eff.",
534534
"sync": "Sync Eff."
@@ -571,11 +571,11 @@
571571
"tooltip": {
572572
"amount_of_rounds": "(amount of rounds)",
573573
"amount_of_validators": "(amount of validators)",
574-
"equal": "{name}'s BeaconScore is at the network average of {average}",
574+
"equal": "{name}'s BeaconScore{sup} is at the network average of {average}",
575575
"estimated_loss": "Estimated loss based on avg. network performance.",
576-
"higher": "{name}'s BeaconScore is above the network average of {average}",
576+
"higher": "{name}'s BeaconScore{sup} is above the network average of {average}",
577577
"live": "Validators missing two consecutive attestations are considered offline.",
578-
"lower": "{name}'s BeaconScore is below the network average of {average}"
578+
"lower": "{name}'s BeaconScore{sup} is below the network average of {average}"
579579
},
580580
"total_group_name": "Total Efficiency",
581581
"validator_status_popout": "Open validator status details"

frontend/types/dashboard/summary.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export const EfficiencyTypes = [
9797
'attestation',
9898
'sync',
9999
'proposal',
100-
]
100+
] as const
101101
export type EfficiencyType = (typeof EfficiencyTypes)[number]
102102

103103
export type SummaryChartFilter = {

0 commit comments

Comments
 (0)