Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion home/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var landingTemplate = `<html lang="en">
<div id="title">Mu</div>
<div id="desc">The Micro Network</div>
<p style="font-size: 18px; font-weight: 800; color: #333; margin: 20px 0; text-align: center; max-width: 800px;">
The internet without the noise.
No ads, no algorithms, no tracking.
</p>
<p style="color:#555;max-width:600px;margin:0 auto 10px;text-align:center;">
News, markets, video, search, and AI tools — all in one place. Build your own or let the agent build one for you.
Expand Down
35 changes: 22 additions & 13 deletions markets/markets.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,24 +255,33 @@ func fetchCoinGeckoChanges() map[string]float64 {
}

func generateMarketsCardHTML(prices map[string]float64) string {
var sb strings.Builder
sb.WriteString(`<div class="market-grid">`)

allTickers := append([]string{}, tickers...)
allTickers = append(allTickers, futuresKeys...)
sort.Slice(allTickers, func(i, j int) bool {
if len(allTickers[i]) != len(allTickers[j]) {
return len(allTickers[i]) < len(allTickers[j])
}
return allTickers[i] < allTickers[j]
})
sort.Strings(allTickers)

for _, ticker := range allTickers {
price := prices[ticker]
fmt.Fprintf(&sb, `<div class="market-item"><span class="market-symbol">%s</span><span class="market-price">$%.2f</span></div>`, ticker, price)
// 4 rows x 2 columns table, show first 8 alphabetically
show := allTickers
if len(show) > 8 {
show = show[:8]
}

sb.WriteString(`</div>`)
var sb strings.Builder
sb.WriteString(`<table style="width:100%;border-collapse:collapse;font-size:14px;">`)
for i := 0; i < len(show); i += 2 {
sb.WriteString(`<tr>`)
for col := 0; col < 2; col++ {
idx := i + col
if idx < len(show) {
ticker := show[idx]
price := prices[ticker]
fmt.Fprintf(&sb, `<td style="padding:6px 8px;"><span class="market-symbol">%s</span></td><td style="padding:6px 8px;text-align:right;"><span class="market-price">$%.2f</span></td>`, ticker, price)
} else {
sb.WriteString(`<td></td><td></td>`)
}
}
sb.WriteString(`</tr>`)
}
sb.WriteString(`</table>`)
return sb.String()
}

Expand Down
4 changes: 2 additions & 2 deletions markets/markets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ func TestGenerateMarketsCardHTML(t *testing.T) {
"GOLD": 2000,
}
html := generateMarketsCardHTML(prices)
if !strings.Contains(html, "market-grid") {
t.Error("expected market-grid class")
if !strings.Contains(html, "<table") {
t.Error("expected table element")
}
if !strings.Contains(html, "BTC") {
t.Error("expected BTC in output")
Expand Down
Loading