diff options
Diffstat (limited to 'cmds/templates/live-feed.html')
| -rw-r--r-- | cmds/templates/live-feed.html | 158 |
1 files changed, 158 insertions, 0 deletions
diff --git a/cmds/templates/live-feed.html b/cmds/templates/live-feed.html new file mode 100644 index 0000000..1529ee1 --- /dev/null +++ b/cmds/templates/live-feed.html @@ -0,0 +1,158 @@ +{{define "live-feed"}} +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>{{.Title}} - Live Feed</title> + <style> + /* ======================================== + BASE STYLE + ======================================== */ + * { margin: 0; padding: 0; box-sizing: border-box; } + body { + font-family: monospace; + background: #fff; + color: #000; + padding: 20px; + line-height: 1.6; + } + h1 { + font-size: 1.2em; + font-weight: bold; + margin-bottom: 20px; + } + + /* ======================================== + NAV (live-feed | score-scan) + ======================================== */ + .nav { + margin-bottom: 30px; + display: flex; + gap: 30px; + border-bottom: 1px solid #000; + padding-bottom: 10px; + } + .nav a { + text-decoration: none; + color: #000; + font-family: monospace; + } + .nav a.active { + border-bottom: 2px solid #000; + padding-bottom: 5px; + } + + /* ======================================== + ARTICLE LIST + ======================================== */ + .article { + margin-bottom: 15px; + padding: 10px; + border: 1px solid #ccc; + } + .article a { + color: #00f; + text-decoration: underline; + } + .article-meta { + margin-top: 8px; + color: #666; + font-size: 0.9em; + } + + /* ======================================== + ARTICLE LIST STUFF + ======================================== */ + .summary { + margin-bottom: 15px; + padding: 10px; + border: 1px solid #000; + background: #f9f9f9; + } + .rss-link { + background: #f9f9f9; + padding: 15px; + border: 1px solid #000; + margin-bottom: 20px; + } + .rss-link a { + color: #00f; + text-decoration: underline; + } + .feed-list { + max-height: 600px; + overflow-y: auto; + border: 1px solid #000; + padding: 10px; + } + + .error { + color: #f00; + margin-top: 10px; + padding: 10px; + border: 1px solid #f00; + } + </style> +</head> +<body> + <h1><a href="/live-feed" style="color: inherit; text-decoration: none;">{{.Title}}</a></h1> + <div class="nav"> + <a href="/live-feed" class="active">Live Feed</a> + <a href="/tools">Score & Scan</a> + </div> + + <div class="rss-link"> + <strong>Filtered RSS Feed:</strong> + <a href="/api/filtered/rss" target="_blank">Subscribe to filtered articles</a> + <span style="margin-left: 10px; color: #666; font-size: 0.9em;">(rss link for feed readers)</span> + <div style="margin-top: 10px; padding-top: 10px; border-top: 1px solid #ccc; color: #666; font-size: 0.9em;"> + Last updated: <span id="feedTimestamp">{{if .UpdatedAt}}{{.UpdatedAt}}{{else}}—{{end}}</span> + </div> + </div> + + <div style="margin-bottom: 20px;"> + <strong>Filter by date:</strong> + <div style="margin-top: 8px; display: flex; gap: 10px;"> + <a href="/live-feed?filter=day" style="padding: 6px 12px; text-decoration: none; {{if eq .Filter "day"}}background: #000; color: #fff;{{else}}border: 1px solid #000; color: #000;{{end}}">Last 24h</a> + <a href="/live-feed?filter=week" style="padding: 6px 12px; text-decoration: none; {{if eq .Filter "week"}}background: #000; color: #fff;{{else}}border: 1px solid #000; color: #000;{{end}}">Last 7 days</a> + <a href="/live-feed?filter=all" style="padding: 6px 12px; text-decoration: none; {{if eq .Filter "all"}}background: #000; color: #fff;{{else}}border: 1px solid #000; color: #000;{{end}}">All</a> + </div> + </div> + + <div class="feed-list"> + {{if .Error}} + <div class="error">{{.Error}}</div> + {{else if .Articles}} + <div class="summary"> + <strong>{{len .Articles}}</strong> articles (threshold: {{printf "%.2f" .Threshold}}) + </div> + {{$threshold := .Threshold}} + {{range .Articles}} + {{$isGood := ge .Score $threshold}} + {{$bgColor := "white"}} + {{if $isGood}} + {{$bgColor = "#e8f5e9"}} + {{else}} + {{$bgColor = "#ffebee"}} + {{end}} + {{$indicator := "✗"}} + {{if $isGood}} + {{$indicator = "✓"}} + {{end}} + <div class="article" style="background-color: {{$bgColor}};"> + <div style="font-weight: bold;"> + <a href="{{.URL}}" target="_blank">{{.Title}}</a> + </div> + <div class="article-meta"> + Rating: {{$indicator}} {{.Rating}}/10 (raw: {{printf "%.3f" .Score}}) · {{.Source}}{{if .PublishedAt}} · {{.PublishedAt}}{{end}} + </div> + </div> + {{end}} + {{else}} + <p>No articles to display</p> + {{end}} + </div> +</body> +</html> +{{end}} |
