Skip to content

Commit

Permalink
(BIDS-2504) use existing formatting function
Browse files Browse the repository at this point in the history
  • Loading branch information
remoterami committed Oct 2, 2023
1 parent 8cc32c2 commit 37facc7
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
8 changes: 1 addition & 7 deletions templates/validator/tables.html
Original file line number Diff line number Diff line change
Expand Up @@ -416,13 +416,7 @@ <h6 class="">This table displays the deposits made to the Ethereum staking depos
<tbody>
{{ range $i, $deposit := .Deposits.Eth1Deposits }}
<tr>
<td>
{{ if $deposit.FromName }}
{{ formatEth1Name $deposit.FromName }}
{{ else }}
{{ formatEth1Address $deposit.FromAddress }}
{{ end }}
</td>
<td>{{ formatAddressAsLink $deposit.FromAddress $deposit.FromName false false}}</td>
<td>{{ formatEth1TxHash $deposit.TxHash }}</td>
<td>{{ formatEth1Block $deposit.BlockNumber }}</td>
<td>{{ formatTimestamp $deposit.BlockTs }}</td>
Expand Down
4 changes: 2 additions & 2 deletions utils/eth1.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ func FormatAddressAsLink(address []byte, name string, verified bool, isContract

if len(name) > 0 {
if verified {
ret = fmt.Sprintf("<a class=\"text-monospace\" href=\"/address/%s\">✔ %s (%s…%s)</a> %v", addressString, name, addressString[:8], addressString[len(addressString)-6:], CopyButton(addressString))
ret = fmt.Sprintf("<a class=\"text-monospace\" href=\"/address/%s\">✔ %s</a> %v", addressString, name, CopyButton(addressString))
} else {
ret = fmt.Sprintf("<a class=\"text-monospace\" href=\"/address/%s\">%s %s…%s</a> %v", addressString, name, addressString[:8], addressString[len(addressString)-6:], CopyButton(addressString))
ret = fmt.Sprintf("<a class=\"text-monospace\" href=\"/address/%s\">%s</a> %v", addressString, name, CopyButton(addressString))
}
} else {
ret = fmt.Sprintf("<a class=\"text-monospace\" href=\"/address/%s\">%s…%s</a> %v", addressString, addressString[:8], addressString[len(addressString)-6:], CopyButton(addressString))
Expand Down
6 changes: 0 additions & 6 deletions utils/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,6 @@ func FormatEth1Address(addr []byte) template.HTML {
return template.HTML(fmt.Sprintf("<a href=\"/address/%s\" class=\"text-monospace\">%s…</a>%s", eth1Addr, eth1Addr[:8], copyBtn))
}

// FormatEth1Name will return the eth1-name formated as html
func FormatEth1Name(addr string) template.HTML {
copyBtn := CopyButton(addr)
return template.HTML(fmt.Sprintf("<a href=\"/address/%s\">%s</a>%s", addr, addr, copyBtn))
}

// FormatEth1Block will return the eth1-block formated as html
func FormatEth1Block(block uint64) template.HTML {
return template.HTML(fmt.Sprintf("<a href=\"/block/%[1]d\">%[1]d</a>", block))
Expand Down
1 change: 0 additions & 1 deletion utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ func GetTemplateFuncs() template.FuncMap {
"formatEth1Block": FormatEth1Block,
"formatEth1BlockHash": FormatEth1BlockHash,
"formatEth1Address": FormatEth1Address,
"formatEth1Name": FormatEth1Name,
"formatEth1AddressStringLowerCase": FormatEth1AddressStringLowerCase,
"formatEth1TxHash": FormatEth1TxHash,
"formatGraffiti": FormatGraffiti,
Expand Down

0 comments on commit 37facc7

Please sign in to comment.