Skip to content

Commit

Permalink
(BIDS-2432) Remove text-primary style from 0x in FormatAddressLong (#…
Browse files Browse the repository at this point in the history
…2530)

* (BIDS-2432) Remove text-primary style from 0x in FormatAddressLong

* (BIDS-2432) Minor refactoring
- Improve variable names
- Remove unused spans
- Improve variable handling

* (BIDS-2432) Remove empty class definitions
  • Loading branch information
D13ce authored Sep 5, 2023
1 parent e122540 commit 7e539bd
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions utils/eth1.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,15 @@ func FormatAddressAsTokenLink(token, address []byte, name string, verified bool,

func FormatHashLong(hash common.Hash) template.HTML {
address := hash.String()
test := `
<div class="d-flex text-monospace">
<span class="">%s</span>
<span class="flex-shrink-1 text-truncate">%s</span>
<span class="">%s</span>
</div>`
if len(address) > 4 {
return template.HTML(fmt.Sprintf(test, address[:4], address[4:len(address)-4], address[len(address)-4:]))
htmlFormat := `
<div class="d-flex text-monospace">
%s
<span class="flex-shrink-1 text-truncate">%s</span>
%s
</div>`

return template.HTML(fmt.Sprintf(htmlFormat, address[:4], address[4:len(address)-4], address[len(address)-4:]))
}

return template.HTML(address)
Expand All @@ -255,10 +256,11 @@ func FormatAddressLong(address string) template.HTML {
return template.HTML(address)
}
address = FixAddressCasing(address)
test := `
<span class="text-monospace mw-100"><span class="text-primary">%s</span><span class="text-truncate">%s</span><span class="text-primary">%s</span></span>`
if len(address) > 4 {
return template.HTML(fmt.Sprintf(test, address[:6], address[6:len(address)-4], address[len(address)-4:]))
htmlFormat := `
<span class="text-monospace mw-100">%s<span class="text-primary">%s</span>%s<span class="text-primary">%s</span></span>`

return template.HTML(fmt.Sprintf(htmlFormat, address[:2], address[2:6], address[6:len(address)-4], address[len(address)-4:]))
}

return template.HTML(address)
Expand Down

0 comments on commit 7e539bd

Please sign in to comment.