Improve dashboard UI and truncate trending if too longUnverified
973a7c3 parent: aff0b5f modified
internal/tmpl/dashboard.html +42 -31 | @@ -1,53 +1,64 @@ | ||
| 1 | 1 | {{define "dashboard.html"}} |
| 2 | 2 | <div class="flex items-center justify-between mb-2"> |
| 3 | 3 | <h1 class="text-2xl font-bold text-spot-text">Dashboard</h1> |
| 4 | + {{if gt .SubscriptionCount 0}} | |
| 4 | 5 | <div class="flex gap-4 text-sm"> |
| 5 | 6 | <span class="text-spot-secondary"><strong class="text-spot-text">{{.UnreadCount}}</strong> unread</span> |
| 6 | 7 | <span class="text-spot-secondary"><strong class="text-spot-text">{{.SubscriptionCount}}</strong> feeds</span> |
| 7 | 8 | </div> |
| 9 | + {{end}} | |
| 8 | 10 | </div> |
| 11 | +<p class="text-sm text-spot-secondary mb-6"> | |
| 12 | + {{if eq .SubscriptionCount 0}}Get started by subscribing to RSS feeds.{{else}}Your personalized feed, based on your social graph.{{end}} | |
| 13 | +</p> | |
| 9 | 14 | |
| 10 | 15 | {{if eq .SubscriptionCount 0}} |
| 11 | -<div class="bg-spot-surface rounded-xl py-12 px-6 text-center mb-6"> | |
| 12 | - <div class="w-16 h-16 rounded-full bg-spot-hover flex items-center justify-center mb-4 mx-auto"> | |
| 13 | - <svg class="w-8 h-8 text-spot-muted" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12.75 19.5v-15m0 0l-6.75 6.75M12.75 4.5l6.75 6.75"/></svg> | |
| 14 | - </div> | |
| 15 | - <h2 class="text-lg font-semibold text-spot-text mb-2">Add your first feed</h2> | |
| 16 | - <p class="text-sm text-spot-secondary mb-6">Subscribe to RSS feeds to start building your personalized reading experience.</p> | |
| 17 | - <a href="/feeds" class="inline-flex items-center gap-2 px-5 py-2.5 rounded-lg bg-spot-green text-white text-sm font-medium hover:opacity-90 transition"> | |
| 18 | - <svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15"/></svg> | |
| 19 | - Add feeds | |
| 20 | - </a> | |
| 21 | -</div> | |
| 16 | +<div id="new-articles-poll" hx-get="/articles/new-count?since={{.Now.Unix}}&return=/dashboard" hx-trigger="every 30s" hx-swap="innerHTML"></div> | |
| 22 | 17 | |
| 23 | -{{if .GlobalTrending}} | |
| 24 | -<div class="mb-6"> | |
| 25 | - <div class="flex items-center justify-between mb-3"> | |
| 26 | - <h2 class="text-lg font-semibold text-spot-text">Trending</h2> | |
| 27 | - <a href="/trending" class="text-xs text-spot-secondary hover:text-spot-green uppercase tracking-button transition">See all</a> | |
| 28 | - </div> | |
| 29 | - <div class="space-y-3"> | |
| 30 | - {{range .GlobalTrending}} | |
| 31 | - {{template "trending-card.html" .}} | |
| 18 | +<div class="grid grid-cols-1 lg:grid-cols-3 gap-6"> | |
| 19 | + <div class="lg:col-span-2 space-y-6"> | |
| 20 | + <div class="bg-spot-surface rounded-xl py-12 px-6 text-center"> | |
| 21 | + <div class="w-16 h-16 rounded-full bg-spot-hover flex items-center justify-center mb-4 mx-auto"> | |
| 22 | + <svg class="w-8 h-8 text-spot-muted" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12.75 19.5v-15m0 0l-6.75 6.75M12.75 4.5l6.75 6.75"/></svg> | |
| 23 | + </div> | |
| 24 | + <h2 class="text-lg font-semibold text-spot-text mb-2">Add your first feed</h2> | |
| 25 | + <p class="text-sm text-spot-secondary mb-6">Subscribe to RSS feeds to start building your personalized reading experience.</p> | |
| 26 | + <a href="/feeds" class="inline-flex items-center gap-2 px-5 py-2.5 rounded-lg bg-spot-green text-white text-sm font-medium hover:opacity-90 transition"> | |
| 27 | + <svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15"/></svg> | |
| 28 | + Add feeds | |
| 29 | + </a> | |
| 30 | + </div> | |
| 31 | + | |
| 32 | + {{if .GlobalTrending}} | |
| 33 | + <div> | |
| 34 | + <div class="flex items-center justify-between mb-3"> | |
| 35 | + <h2 class="text-lg font-semibold text-spot-text">Trending</h2> | |
| 36 | + <a href="/trending" class="text-xs text-spot-secondary hover:text-spot-green uppercase tracking-button transition">See all</a> | |
| 37 | + </div> | |
| 38 | + <div class="space-y-3"> | |
| 39 | + {{range .GlobalTrending}} | |
| 40 | + {{template "trending-card.html" .}} | |
| 41 | + {{end}} | |
| 42 | + </div> | |
| 43 | + </div> | |
| 32 | 44 | {{end}} |
| 33 | 45 | </div> |
| 34 | -</div> | |
| 35 | -{{end}} | |
| 36 | 46 | |
| 37 | -{{if .FeedRecommendations}} | |
| 38 | -<div> | |
| 39 | - <h2 class="text-lg font-semibold text-spot-text mb-3">Popular feeds to get started</h2> | |
| 40 | - <div class="grid grid-cols-1 md:grid-cols-2 gap-3"> | |
| 41 | - {{range .FeedRecommendations}} | |
| 42 | - {{template "recommendation-card.html" (dict "title" .Title "feed_url" .FeedURL "description" .Description "favicon_url" .FaviconURL "subscriber_count" .SubscriberCount "CSRFToken" $.CSRFToken)}} | |
| 47 | + <div class="space-y-8"> | |
| 48 | + {{if .FeedRecommendations}} | |
| 49 | + <div> | |
| 50 | + <h2 class="text-lg font-semibold text-spot-text mb-4">Popular feeds to get started</h2> | |
| 51 | + <div class="space-y-3"> | |
| 52 | + {{range .FeedRecommendations}} | |
| 53 | + {{template "recommendation-card.html" (dict "title" .Title "feed_url" .FeedURL "description" .Description "favicon_url" .FaviconURL "subscriber_count" .SubscriberCount "CSRFToken" $.CSRFToken)}} | |
| 54 | + {{end}} | |
| 55 | + </div> | |
| 56 | + </div> | |
| 43 | 57 | {{end}} |
| 44 | 58 | </div> |
| 45 | 59 | </div> |
| 46 | -{{end}} | |
| 47 | 60 | |
| 48 | 61 | {{else}} |
| 49 | -<p class="text-sm text-spot-secondary mb-6">Your personalized feed, based on your social graph.</p> | |
| 50 | - | |
| 51 | 62 | <div id="new-articles-poll" hx-get="/articles/new-count?since={{.Now.Unix}}&return=/dashboard" hx-trigger="every 30s" hx-swap="innerHTML"></div> |
| 52 | 63 | |
| 53 | 64 | <div class="grid grid-cols-1 lg:grid-cols-3 gap-6"> |
| @@ -1,53 +1,64 @@ | |||
| 1 | {{define "dashboard.html"}} | 1 | {{define "dashboard.html"}} |
| 2 | <div class="flex items-center justify-between mb-2"> | 2 | <div class="flex items-center justify-between mb-2"> |
| 3 | <h1 class="text-2xl font-bold text-spot-text">Dashboard</h1> | 3 | <h1 class="text-2xl font-bold text-spot-text">Dashboard</h1> |
| 4 | + {{if gt .SubscriptionCount 0}} | ||
| 4 | <div class="flex gap-4 text-sm"> | 5 | <div class="flex gap-4 text-sm"> |
| 5 | <span class="text-spot-secondary"><strong class="text-spot-text">{{.UnreadCount}}</strong> unread</span> | 6 | <span class="text-spot-secondary"><strong class="text-spot-text">{{.UnreadCount}}</strong> unread</span> |
| 6 | <span class="text-spot-secondary"><strong class="text-spot-text">{{.SubscriptionCount}}</strong> feeds</span> | 7 | <span class="text-spot-secondary"><strong class="text-spot-text">{{.SubscriptionCount}}</strong> feeds</span> |
| 7 | </div> | 8 | </div> |
| 9 | + {{end}} | ||
| 8 | </div> | 10 | </div> |
| 11 | +<p class="text-sm text-spot-secondary mb-6"> | ||
| 12 | + {{if eq .SubscriptionCount 0}}Get started by subscribing to RSS feeds.{{else}}Your personalized feed, based on your social graph.{{end}} | ||
| 13 | +</p> | ||
| 9 | 14 | ||
| 10 | {{if eq .SubscriptionCount 0}} | 15 | {{if eq .SubscriptionCount 0}} |
| 11 | -<div class="bg-spot-surface rounded-xl py-12 px-6 text-center mb-6"> | 16 | +<div id="new-articles-poll" hx-get="/articles/new-count?since={{.Now.Unix}}&return=/dashboard" hx-trigger="every 30s" hx-swap="innerHTML"></div> |
| 12 | - <div class="w-16 h-16 rounded-full bg-spot-hover flex items-center justify-center mb-4 mx-auto"> | ||
| 13 | - <svg class="w-8 h-8 text-spot-muted" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12.75 19.5v-15m0 0l-6.75 6.75M12.75 4.5l6.75 6.75"/></svg> | ||
| 14 | - </div> | ||
| 15 | - <h2 class="text-lg font-semibold text-spot-text mb-2">Add your first feed</h2> | ||
| 16 | - <p class="text-sm text-spot-secondary mb-6">Subscribe to RSS feeds to start building your personalized reading experience.</p> | ||
| 17 | - <a href="/feeds" class="inline-flex items-center gap-2 px-5 py-2.5 rounded-lg bg-spot-green text-white text-sm font-medium hover:opacity-90 transition"> | ||
| 18 | - <svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15"/></svg> | ||
| 19 | - Add feeds | ||
| 20 | - </a> | ||
| 21 | -</div> | ||
| 22 | 17 | ||
| 23 | -{{if .GlobalTrending}} | 18 | +<div class="grid grid-cols-1 lg:grid-cols-3 gap-6"> |
| 24 | -<div class="mb-6"> | 19 | + <div class="lg:col-span-2 space-y-6"> |
| 25 | - <div class="flex items-center justify-between mb-3"> | 20 | + <div class="bg-spot-surface rounded-xl py-12 px-6 text-center"> |
| 26 | - <h2 class="text-lg font-semibold text-spot-text">Trending</h2> | 21 | + <div class="w-16 h-16 rounded-full bg-spot-hover flex items-center justify-center mb-4 mx-auto"> |
| 27 | - <a href="/trending" class="text-xs text-spot-secondary hover:text-spot-green uppercase tracking-button transition">See all</a> | 22 | + <svg class="w-8 h-8 text-spot-muted" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12.75 19.5v-15m0 0l-6.75 6.75M12.75 4.5l6.75 6.75"/></svg> |
| 28 | - </div> | 23 | + </div> |
| 29 | - <div class="space-y-3"> | 24 | + <h2 class="text-lg font-semibold text-spot-text mb-2">Add your first feed</h2> |
| 30 | - {{range .GlobalTrending}} | 25 | + <p class="text-sm text-spot-secondary mb-6">Subscribe to RSS feeds to start building your personalized reading experience.</p> |
| 31 | - {{template "trending-card.html" .}} | 26 | + <a href="/feeds" class="inline-flex items-center gap-2 px-5 py-2.5 rounded-lg bg-spot-green text-white text-sm font-medium hover:opacity-90 transition"> |
| 27 | + <svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15"/></svg> | ||
| 28 | + Add feeds | ||
| 29 | + </a> | ||
| 30 | + </div> | ||
| 31 | + | ||
| 32 | + {{if .GlobalTrending}} | ||
| 33 | + <div> | ||
| 34 | + <div class="flex items-center justify-between mb-3"> | ||
| 35 | + <h2 class="text-lg font-semibold text-spot-text">Trending</h2> | ||
| 36 | + <a href="/trending" class="text-xs text-spot-secondary hover:text-spot-green uppercase tracking-button transition">See all</a> | ||
| 37 | + </div> | ||
| 38 | + <div class="space-y-3"> | ||
| 39 | + {{range .GlobalTrending}} | ||
| 40 | + {{template "trending-card.html" .}} | ||
| 41 | + {{end}} | ||
| 42 | + </div> | ||
| 43 | + </div> | ||
| 32 | {{end}} | 44 | {{end}} |
| 33 | </div> | 45 | </div> |
| 34 | -</div> | ||
| 35 | -{{end}} | ||
| 36 | 46 | ||
| 37 | -{{if .FeedRecommendations}} | 47 | + <div class="space-y-8"> |
| 38 | -<div> | 48 | + {{if .FeedRecommendations}} |
| 39 | - <h2 class="text-lg font-semibold text-spot-text mb-3">Popular feeds to get started</h2> | 49 | + <div> |
| 40 | - <div class="grid grid-cols-1 md:grid-cols-2 gap-3"> | 50 | + <h2 class="text-lg font-semibold text-spot-text mb-4">Popular feeds to get started</h2> |
| 41 | - {{range .FeedRecommendations}} | 51 | + <div class="space-y-3"> |
| 42 | - {{template "recommendation-card.html" (dict "title" .Title "feed_url" .FeedURL "description" .Description "favicon_url" .FaviconURL "subscriber_count" .SubscriberCount "CSRFToken" $.CSRFToken)}} | 52 | + {{range .FeedRecommendations}} |
| 53 | + {{template "recommendation-card.html" (dict "title" .Title "feed_url" .FeedURL "description" .Description "favicon_url" .FaviconURL "subscriber_count" .SubscriberCount "CSRFToken" $.CSRFToken)}} | ||
| 54 | + {{end}} | ||
| 55 | + </div> | ||
| 56 | + </div> | ||
| 43 | {{end}} | 57 | {{end}} |
| 44 | </div> | 58 | </div> |
| 45 | </div> | 59 | </div> |
| 46 | -{{end}} | ||
| 47 | 60 | ||
| 48 | {{else}} | 61 | {{else}} |
| 49 | -<p class="text-sm text-spot-secondary mb-6">Your personalized feed, based on your social graph.</p> | ||
| 50 | - | ||
| 51 | <div id="new-articles-poll" hx-get="/articles/new-count?since={{.Now.Unix}}&return=/dashboard" hx-trigger="every 30s" hx-swap="innerHTML"></div> | 62 | <div id="new-articles-poll" hx-get="/articles/new-count?since={{.Now.Unix}}&return=/dashboard" hx-trigger="every 30s" hx-swap="innerHTML"></div> |
| 52 | 63 | ||
| 53 | <div class="grid grid-cols-1 lg:grid-cols-3 gap-6"> | 64 | <div class="grid grid-cols-1 lg:grid-cols-3 gap-6"> |
modified
internal/tmpl/partials/trending-card.html +2 -2 | @@ -5,8 +5,8 @@ | ||
| 5 | 5 | <a href="/articles/{{.ArticleID}}" class="font-bold text-spot-text hover:text-spot-green transition text-lg leading-tight">{{.Title}}</a> |
| 6 | 6 | <div class="text-sm text-spot-secondary mt-1 flex items-center gap-2"> |
| 7 | 7 | {{if .FaviconURL}}<img src="{{.FaviconURL}}" class="w-4 h-4 rounded shrink-0" loading="lazy">{{end}} |
| 8 | - {{if .Author}}<span>{{.Author}}</span>{{end}} | |
| 9 | - <span class="text-spot-muted"><a href="/articles?feed={{.FeedURL}}" class="hover:text-spot-green transition">{{if .FeedTitle}}{{.FeedTitle}}{{else}}{{.FeedURL}}{{end}}</a></span> | |
| 8 | + {{if .Author}}<span class="truncate max-w-32">{{.Author}}</span>{{end}} | |
| 9 | + <span class="text-spot-muted truncate"><a href="/articles?feed={{.FeedURL}}" class="hover:text-spot-green transition">{{if .FeedTitle}}{{.FeedTitle}}{{else}}{{.FeedURL}}{{end}}</a></span> | |
| 10 | 10 | </div> |
| 11 | 11 | {{if .Summary}} |
| 12 | 12 | <p class="text-sm text-spot-secondary mt-2 line-clamp-2">{{.Summary}}</p> |
| @@ -5,8 +5,8 @@ | |||
| 5 | <a href="/articles/{{.ArticleID}}" class="font-bold text-spot-text hover:text-spot-green transition text-lg leading-tight">{{.Title}}</a> | 5 | <a href="/articles/{{.ArticleID}}" class="font-bold text-spot-text hover:text-spot-green transition text-lg leading-tight">{{.Title}}</a> |
| 6 | <div class="text-sm text-spot-secondary mt-1 flex items-center gap-2"> | 6 | <div class="text-sm text-spot-secondary mt-1 flex items-center gap-2"> |
| 7 | {{if .FaviconURL}}<img src="{{.FaviconURL}}" class="w-4 h-4 rounded shrink-0" loading="lazy">{{end}} | 7 | {{if .FaviconURL}}<img src="{{.FaviconURL}}" class="w-4 h-4 rounded shrink-0" loading="lazy">{{end}} |
| 8 | - {{if .Author}}<span>{{.Author}}</span>{{end}} | 8 | + {{if .Author}}<span class="truncate max-w-32">{{.Author}}</span>{{end}} |
| 9 | - <span class="text-spot-muted"><a href="/articles?feed={{.FeedURL}}" class="hover:text-spot-green transition">{{if .FeedTitle}}{{.FeedTitle}}{{else}}{{.FeedURL}}{{end}}</a></span> | 9 | + <span class="text-spot-muted truncate"><a href="/articles?feed={{.FeedURL}}" class="hover:text-spot-green transition">{{if .FeedTitle}}{{.FeedTitle}}{{else}}{{.FeedURL}}{{end}}</a></span> |
| 10 | </div> | 10 | </div> |
| 11 | {{if .Summary}} | 11 | {{if .Summary}} |
| 12 | <p class="text-sm text-spot-secondary mt-2 line-clamp-2">{{.Summary}}</p> | 12 | <p class="text-sm text-spot-secondary mt-2 line-clamp-2">{{.Summary}}</p> |