diff --git a/packages/dashboard/util.go b/packages/dashboard/util.go
index e0ee78e52e..2f7378a4f4 100644
--- a/packages/dashboard/util.go
+++ b/packages/dashboard/util.go
@@ -6,6 +6,15 @@ import (
"time"
)
+const maxLength = 150
+
+func Trim(s string) string {
+ if len(s) > maxLength {
+ return s[0:maxLength] + "..."
+ }
+ return s
+}
+
func FormatTimestamp(ts interface{}) string {
t, ok := ts.(time.Time)
if !ok {
diff --git a/tools/wwallet/dashboard/base.go b/tools/wwallet/dashboard/base.go
index 0290b2f4a5..8bd27fe137 100644
--- a/tools/wwallet/dashboard/base.go
+++ b/tools/wwallet/dashboard/base.go
@@ -28,6 +28,7 @@ type NavPage struct {
func MakeTemplate(parts ...string) *template.Template {
t := template.New("").Funcs(template.FuncMap{
"formatTimestamp": dashboard.FormatTimestamp,
+ "trim": dashboard.Trim,
"exploreAddressUrl": dashboard.ExploreAddressUrl(
dashboard.ExploreAddressUrlFromGoshimmerUri(config.GoshimmerApi()),
),
@@ -90,7 +91,7 @@ const TplSCInfo = `
SC address: {{template "address" .Status.SCAddress}}
Program hash: {{.Status.ProgramHash}}
Description of the instance: {{.Status.Description}}
Description of the instance: {{trim .Status.Description}}
Owner address: {{template "address" .Status.OwnerAddress}}
Minimum node reward (fee): {{.Status.MinimumReward}}
Color: {{.Config.BootupData.Color}}
Sender: {{template "address" $di.Sender}}
Amount: {{$di.Amount}} IOTAs
When: {{formatTimestamp $di.When}}
For sale: {{$auction.NumTokens}}
tokens of color {{$color}}
Owner: {{template "address" $auction.AuctionOwner}}
Started at: {{formatTimestamp $auction.WhenStarted}}
Color: {{$color}}
Color: {{.Color}}