package main import ( "fmt" "time" ) func pathBuilder(page int, query string) string { base := "/" if page > 1 { base = fmt.Sprintf("/p/%d", page) } if query != "" { return fmt.Sprintf("%s?q=%s", base, query) } return base } func humanize(t time.Time) string { duration := time.Since(t) switch { case duration < time.Minute: return "just now" case duration < time.Hour: return fmt.Sprintf("%dm ago", int(duration.Minutes())) case duration < time.Hour*24: return fmt.Sprintf("%dh ago", int(duration.Hours())) default: return t.Format("Jan 02") } } templ navLink(text string, page int, query string, active bool) { if active { { text } } else { { text } } } templ MainContent(records []Record, query string, page int, hasMore bool) { if query != "" { IP History - { query } } else if page > 1 { IP History - Page { fmt.Sprint(page) } } else { IP History }
if query != "" {
Showing results for "{ query }" Clear Search
} if page == 1 && query == "" && len(records) > 0 {
Current Public IP
{ records[0].IP }
{ records[0].Timestamp.Format("Jan 02, 15:04:05 MST") } ({ humanize(records[0].Timestamp) })
} if len(records) > 0 { for _, r := range records { }
Timestamp IP Address
{ r.Timestamp.Format("2006-01-02 15:04:05") } { humanize(r.Timestamp) } { r.IP }
} else {

No IP found matching your search.

if query != "" { }
}
} templ Page(records []Record, query string, page int, hasMore bool) { IP History

IP History

A simple timeline of your public IP changes

@MainContent(records, query, page, hasMore)
}