Extract trending card template and apply consistentlyUnverified
aff0b5f parent: 788527a modified
internal/tmpl/dashboard.html +38 -56 | @@ -6,6 +6,7 @@ | ||
| 6 | 6 | <span class="text-spot-secondary"><strong class="text-spot-text">{{.SubscriptionCount}}</strong> feeds</span> |
| 7 | 7 | </div> |
| 8 | 8 | </div> |
| 9 | + | |
| 9 | 10 | {{if eq .SubscriptionCount 0}} |
| 10 | 11 | <div class="bg-spot-surface rounded-xl py-12 px-6 text-center mb-6"> |
| 11 | 12 | <div class="w-16 h-16 rounded-full bg-spot-hover flex items-center justify-center mb-4 mx-auto"> |
| @@ -25,55 +26,46 @@ | ||
| 25 | 26 | <h2 class="text-lg font-semibold text-spot-text">Trending</h2> |
| 26 | 27 | <a href="/trending" class="text-xs text-spot-secondary hover:text-spot-green uppercase tracking-button transition">See all</a> |
| 27 | 28 | </div> |
| 28 | - <div class="grid grid-cols-1 md:grid-cols-2 gap-3"> | |
| 29 | + <div class="space-y-3"> | |
| 29 | 30 | {{range .GlobalTrending}} |
| 30 | - <div class="bg-spot-surface rounded-xl p-4 hover:bg-spot-hover-50 transition"> | |
| 31 | - <a href="/articles/{{.ArticleID}}" class="font-bold text-sm text-spot-text leading-tight hover:text-spot-green transition">{{.Title}}</a> | |
| 32 | - <div class="flex items-center gap-2 mt-1 text-xs text-spot-secondary"> | |
| 33 | - {{if .Author}}<span>{{.Author}}</span>{{end}} | |
| 34 | - <span class="text-spot-muted"><a href="/articles?feed={{.FeedURL}}" class="hover:text-spot-green transition">{{if .FeedTitle}}{{.FeedTitle}}{{end}}</a></span> | |
| 35 | - </div> | |
| 36 | - <div class="flex items-center gap-3 mt-2 text-xs text-spot-secondary"> | |
| 37 | - <span class="inline-flex items-center gap-1"><svg class="w-4 h-4 text-spot-muted" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">{{template "icon-heart"}}</svg> {{.LikeCount}}</span> | |
| 38 | - <span class="text-spot-muted">{{.AnnotationCount}} notes</span> | |
| 39 | - </div> | |
| 40 | - </div> | |
| 41 | - {{end}} | |
| 42 | - </div> | |
| 43 | - </div> | |
| 31 | + {{template "trending-card.html" .}} | |
| 44 | 32 | {{end}} |
| 33 | + </div> | |
| 34 | +</div> | |
| 35 | +{{end}} | |
| 45 | 36 | |
| 46 | - {{if .FeedRecommendations}} | |
| 47 | - <div> | |
| 48 | - <h2 class="text-lg font-semibold text-spot-text mb-3">Popular feeds to get started</h2> | |
| 49 | - <div class="grid grid-cols-1 md:grid-cols-2 gap-3"> | |
| 50 | - {{range .FeedRecommendations}} | |
| 51 | - {{template "recommendation-card.html" (dict "title" .Title "feed_url" .FeedURL "description" .Description "favicon_url" .FaviconURL "subscriber_count" .SubscriberCount "CSRFToken" $.CSRFToken)}} | |
| 52 | - {{end}} | |
| 53 | - </div> | |
| 54 | - </div> | |
| 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)}} | |
| 55 | 43 | {{end}} |
| 56 | - {{else}} | |
| 57 | - <p class="text-sm text-spot-secondary mb-6">Your personalized feed, based on your social graph.</p> | |
| 44 | + </div> | |
| 45 | +</div> | |
| 46 | +{{end}} | |
| 47 | + | |
| 48 | +{{else}} | |
| 49 | +<p class="text-sm text-spot-secondary mb-6">Your personalized feed, based on your social graph.</p> | |
| 58 | 50 | |
| 59 | - <div id="new-articles-poll" hx-get="/articles/new-count?since={{.Now.Unix}}&return=/dashboard" hx-trigger="every 30s" hx-swap="innerHTML"></div> | |
| 51 | +<div id="new-articles-poll" hx-get="/articles/new-count?since={{.Now.Unix}}&return=/dashboard" hx-trigger="every 30s" hx-swap="innerHTML"></div> | |
| 60 | 52 | |
| 61 | - <div class="grid grid-cols-1 lg:grid-cols-3 gap-6"> | |
| 62 | - <div class="lg:col-span-2"> | |
| 63 | - {{if .ArticleRecommendations}} | |
| 64 | - <div class="mb-6"> | |
| 65 | - <h2 class="text-lg font-semibold text-spot-text mb-3">Recommended for you</h2> | |
| 66 | - <div class="space-y-3"> | |
| 67 | - {{range .ArticleRecommendations}} | |
| 68 | - <div class="bg-spot-surface rounded-xl p-4 hover:bg-spot-hover-50 transition"> | |
| 69 | - <a href="/articles/{{.ArticleID}}" class="font-bold text-sm text-spot-text leading-tight hover:text-spot-green transition">{{.Title}}</a> | |
| 70 | - <div class="flex items-center gap-2 mt-1 text-xs text-spot-secondary"> | |
| 71 | - {{if .Author}}<span>{{.Author}}</span>{{end}} | |
| 72 | - <a href="/articles?feed={{.FeedURL}}" class="text-spot-muted hover:text-spot-green transition">{{.FeedTitle}}</a> | |
| 73 | - {{if .Published.Valid}}<span>{{.Published.Time.Format "Jan 2"}}</span>{{end}} | |
| 74 | - </div> | |
| 75 | - {{if .Summary}}<p class="text-xs text-spot-secondary mt-2 line-clamp-2">{{.Summary}}</p>{{end}} | |
| 76 | - </div> | |
| 53 | +<div class="grid grid-cols-1 lg:grid-cols-3 gap-6"> | |
| 54 | + <div class="lg:col-span-2"> | |
| 55 | + {{if .ArticleRecommendations}} | |
| 56 | + <div class="mb-6"> | |
| 57 | + <h2 class="text-lg font-semibold text-spot-text mb-3">Recommended for you</h2> | |
| 58 | + <div class="space-y-3"> | |
| 59 | + {{range .ArticleRecommendations}} | |
| 60 | + <div class="bg-spot-surface rounded-xl px-5 py-4 hover:bg-spot-hover-50 transition"> | |
| 61 | + <a href="/articles/{{.ArticleID}}" class="font-bold text-spot-text hover:text-spot-green transition text-lg leading-tight">{{.Title}}</a> | |
| 62 | + <div class="text-sm text-spot-secondary mt-1 flex items-center gap-2"> | |
| 63 | + {{if .Author}}<span>{{.Author}}</span>{{end}} | |
| 64 | + <span class="text-spot-muted"><a href="/articles?feed={{.FeedURL}}" class="hover:text-spot-green transition">{{.FeedTitle}}</a></span> | |
| 65 | + {{if .Published.Valid}}<span>{{.Published.Time.Format "Jan 2"}}</span>{{end}} | |
| 66 | + </div> | |
| 67 | + {{if .Summary}}<p class="text-sm text-spot-secondary mt-2 line-clamp-2">{{.Summary}}</p>{{end}} | |
| 68 | + </div> | |
| 77 | 69 | {{end}} |
| 78 | 70 | </div> |
| 79 | 71 | </div> |
| @@ -122,20 +114,10 @@ | ||
| 122 | 114 | </div> |
| 123 | 115 | <div class="space-y-3"> |
| 124 | 116 | {{range .PersonalTrending}} |
| 125 | - <div class="bg-spot-surface rounded-xl p-4 hover:bg-spot-hover-50 transition"> | |
| 126 | - <a href="/articles/{{.ArticleID}}" class="font-bold text-sm text-spot-text leading-tight hover:text-spot-green transition">{{.Title}}</a> | |
| 127 | - <div class="flex items-center gap-2 mt-1 text-xs text-spot-secondary"> | |
| 128 | - {{if .Author}}<span>{{.Author}}</span>{{end}} | |
| 129 | - <span class="text-spot-muted"><a href="/articles?feed={{.FeedURL}}" class="hover:text-spot-green transition">{{if .FeedTitle}}{{.FeedTitle}}{{end}}</a></span> | |
| 130 | - </div> | |
| 131 | - <div class="flex items-center gap-3 mt-2 text-xs text-spot-secondary"> | |
| 132 | - <span class="inline-flex items-center gap-1"><svg class="w-4 h-4 text-spot-muted" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">{{template "icon-heart"}}</svg> {{.LikeCount}}</span> | |
| 133 | - <span class="text-spot-muted">{{.AnnotationCount}} notes</span> | |
| 134 | - </div> | |
| 135 | - </div> | |
| 136 | - {{end}} | |
| 137 | - </div> | |
| 117 | + {{template "trending-card.html" .}} | |
| 118 | + {{end}} | |
| 138 | 119 | </div> |
| 120 | + </div> | |
| 139 | 121 | {{end}} |
| 140 | 122 | |
| 141 | 123 | {{if .PeopleRecommendations}} |
| @@ -6,6 +6,7 @@ | |||
| 6 | <span class="text-spot-secondary"><strong class="text-spot-text">{{.SubscriptionCount}}</strong> feeds</span> | 6 | <span class="text-spot-secondary"><strong class="text-spot-text">{{.SubscriptionCount}}</strong> feeds</span> |
| 7 | </div> | 7 | </div> |
| 8 | </div> | 8 | </div> |
| 9 | + | ||
| 9 | {{if eq .SubscriptionCount 0}} | 10 | {{if eq .SubscriptionCount 0}} |
| 10 | <div class="bg-spot-surface rounded-xl py-12 px-6 text-center mb-6"> | 11 | <div class="bg-spot-surface rounded-xl py-12 px-6 text-center mb-6"> |
| 11 | <div class="w-16 h-16 rounded-full bg-spot-hover flex items-center justify-center mb-4 mx-auto"> | 12 | <div class="w-16 h-16 rounded-full bg-spot-hover flex items-center justify-center mb-4 mx-auto"> |
| @@ -25,55 +26,46 @@ | |||
| 25 | <h2 class="text-lg font-semibold text-spot-text">Trending</h2> | 26 | <h2 class="text-lg font-semibold text-spot-text">Trending</h2> |
| 26 | <a href="/trending" class="text-xs text-spot-secondary hover:text-spot-green uppercase tracking-button transition">See all</a> | 27 | <a href="/trending" class="text-xs text-spot-secondary hover:text-spot-green uppercase tracking-button transition">See all</a> |
| 27 | </div> | 28 | </div> |
| 28 | - <div class="grid grid-cols-1 md:grid-cols-2 gap-3"> | 29 | + <div class="space-y-3"> |
| 29 | {{range .GlobalTrending}} | 30 | {{range .GlobalTrending}} |
| 30 | - <div class="bg-spot-surface rounded-xl p-4 hover:bg-spot-hover-50 transition"> | 31 | + {{template "trending-card.html" .}} |
| 31 | - <a href="/articles/{{.ArticleID}}" class="font-bold text-sm text-spot-text leading-tight hover:text-spot-green transition">{{.Title}}</a> | ||
| 32 | - <div class="flex items-center gap-2 mt-1 text-xs text-spot-secondary"> | ||
| 33 | - {{if .Author}}<span>{{.Author}}</span>{{end}} | ||
| 34 | - <span class="text-spot-muted"><a href="/articles?feed={{.FeedURL}}" class="hover:text-spot-green transition">{{if .FeedTitle}}{{.FeedTitle}}{{end}}</a></span> | ||
| 35 | - </div> | ||
| 36 | - <div class="flex items-center gap-3 mt-2 text-xs text-spot-secondary"> | ||
| 37 | - <span class="inline-flex items-center gap-1"><svg class="w-4 h-4 text-spot-muted" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">{{template "icon-heart"}}</svg> {{.LikeCount}}</span> | ||
| 38 | - <span class="text-spot-muted">{{.AnnotationCount}} notes</span> | ||
| 39 | - </div> | ||
| 40 | - </div> | ||
| 41 | - {{end}} | ||
| 42 | - </div> | ||
| 43 | - </div> | ||
| 44 | {{end}} | 32 | {{end}} |
| 33 | + </div> | ||
| 34 | +</div> | ||
| 35 | +{{end}} | ||
| 45 | 36 | ||
| 46 | - {{if .FeedRecommendations}} | 37 | +{{if .FeedRecommendations}} |
| 47 | - <div> | 38 | +<div> |
| 48 | - <h2 class="text-lg font-semibold text-spot-text mb-3">Popular feeds to get started</h2> | 39 | + <h2 class="text-lg font-semibold text-spot-text mb-3">Popular feeds to get started</h2> |
| 49 | - <div class="grid grid-cols-1 md:grid-cols-2 gap-3"> | 40 | + <div class="grid grid-cols-1 md:grid-cols-2 gap-3"> |
| 50 | - {{range .FeedRecommendations}} | 41 | + {{range .FeedRecommendations}} |
| 51 | - {{template "recommendation-card.html" (dict "title" .Title "feed_url" .FeedURL "description" .Description "favicon_url" .FaviconURL "subscriber_count" .SubscriberCount "CSRFToken" $.CSRFToken)}} | 42 | + {{template "recommendation-card.html" (dict "title" .Title "feed_url" .FeedURL "description" .Description "favicon_url" .FaviconURL "subscriber_count" .SubscriberCount "CSRFToken" $.CSRFToken)}} |
| 52 | - {{end}} | ||
| 53 | - </div> | ||
| 54 | - </div> | ||
| 55 | {{end}} | 43 | {{end}} |
| 56 | - {{else}} | 44 | + </div> |
| 57 | - <p class="text-sm text-spot-secondary mb-6">Your personalized feed, based on your social graph.</p> | 45 | +</div> |
| 46 | +{{end}} | ||
| 47 | + | ||
| 48 | +{{else}} | ||
| 49 | +<p class="text-sm text-spot-secondary mb-6">Your personalized feed, based on your social graph.</p> | ||
| 58 | 50 | ||
| 59 | - <div id="new-articles-poll" hx-get="/articles/new-count?since={{.Now.Unix}}&return=/dashboard" hx-trigger="every 30s" hx-swap="innerHTML"></div> | 51 | +<div id="new-articles-poll" hx-get="/articles/new-count?since={{.Now.Unix}}&return=/dashboard" hx-trigger="every 30s" hx-swap="innerHTML"></div> |
| 60 | 52 | ||
| 61 | - <div class="grid grid-cols-1 lg:grid-cols-3 gap-6"> | 53 | +<div class="grid grid-cols-1 lg:grid-cols-3 gap-6"> |
| 62 | - <div class="lg:col-span-2"> | 54 | + <div class="lg:col-span-2"> |
| 63 | - {{if .ArticleRecommendations}} | 55 | + {{if .ArticleRecommendations}} |
| 64 | - <div class="mb-6"> | 56 | + <div class="mb-6"> |
| 65 | - <h2 class="text-lg font-semibold text-spot-text mb-3">Recommended for you</h2> | 57 | + <h2 class="text-lg font-semibold text-spot-text mb-3">Recommended for you</h2> |
| 66 | - <div class="space-y-3"> | 58 | + <div class="space-y-3"> |
| 67 | - {{range .ArticleRecommendations}} | 59 | + {{range .ArticleRecommendations}} |
| 68 | - <div class="bg-spot-surface rounded-xl p-4 hover:bg-spot-hover-50 transition"> | 60 | + <div class="bg-spot-surface rounded-xl px-5 py-4 hover:bg-spot-hover-50 transition"> |
| 69 | - <a href="/articles/{{.ArticleID}}" class="font-bold text-sm text-spot-text leading-tight hover:text-spot-green transition">{{.Title}}</a> | 61 | + <a href="/articles/{{.ArticleID}}" class="font-bold text-spot-text hover:text-spot-green transition text-lg leading-tight">{{.Title}}</a> |
| 70 | - <div class="flex items-center gap-2 mt-1 text-xs text-spot-secondary"> | 62 | + <div class="text-sm text-spot-secondary mt-1 flex items-center gap-2"> |
| 71 | - {{if .Author}}<span>{{.Author}}</span>{{end}} | 63 | + {{if .Author}}<span>{{.Author}}</span>{{end}} |
| 72 | - <a href="/articles?feed={{.FeedURL}}" class="text-spot-muted hover:text-spot-green transition">{{.FeedTitle}}</a> | 64 | + <span class="text-spot-muted"><a href="/articles?feed={{.FeedURL}}" class="hover:text-spot-green transition">{{.FeedTitle}}</a></span> |
| 73 | - {{if .Published.Valid}}<span>{{.Published.Time.Format "Jan 2"}}</span>{{end}} | 65 | + {{if .Published.Valid}}<span>{{.Published.Time.Format "Jan 2"}}</span>{{end}} |
| 74 | - </div> | 66 | + </div> |
| 75 | - {{if .Summary}}<p class="text-xs text-spot-secondary mt-2 line-clamp-2">{{.Summary}}</p>{{end}} | 67 | + {{if .Summary}}<p class="text-sm text-spot-secondary mt-2 line-clamp-2">{{.Summary}}</p>{{end}} |
| 76 | - </div> | 68 | + </div> |
| 77 | {{end}} | 69 | {{end}} |
| 78 | </div> | 70 | </div> |
| 79 | </div> | 71 | </div> |
| @@ -122,20 +114,10 @@ | |||
| 122 | </div> | 114 | </div> |
| 123 | <div class="space-y-3"> | 115 | <div class="space-y-3"> |
| 124 | {{range .PersonalTrending}} | 116 | {{range .PersonalTrending}} |
| 125 | - <div class="bg-spot-surface rounded-xl p-4 hover:bg-spot-hover-50 transition"> | 117 | + {{template "trending-card.html" .}} |
| 126 | - <a href="/articles/{{.ArticleID}}" class="font-bold text-sm text-spot-text leading-tight hover:text-spot-green transition">{{.Title}}</a> | 118 | + {{end}} |
| 127 | - <div class="flex items-center gap-2 mt-1 text-xs text-spot-secondary"> | ||
| 128 | - {{if .Author}}<span>{{.Author}}</span>{{end}} | ||
| 129 | - <span class="text-spot-muted"><a href="/articles?feed={{.FeedURL}}" class="hover:text-spot-green transition">{{if .FeedTitle}}{{.FeedTitle}}{{end}}</a></span> | ||
| 130 | - </div> | ||
| 131 | - <div class="flex items-center gap-3 mt-2 text-xs text-spot-secondary"> | ||
| 132 | - <span class="inline-flex items-center gap-1"><svg class="w-4 h-4 text-spot-muted" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">{{template "icon-heart"}}</svg> {{.LikeCount}}</span> | ||
| 133 | - <span class="text-spot-muted">{{.AnnotationCount}} notes</span> | ||
| 134 | - </div> | ||
| 135 | - </div> | ||
| 136 | - {{end}} | ||
| 137 | - </div> | ||
| 138 | </div> | 119 | </div> |
| 120 | + </div> | ||
| 139 | {{end}} | 121 | {{end}} |
| 140 | 122 | ||
| 141 | {{if .PeopleRecommendations}} | 123 | {{if .PeopleRecommendations}} |
added
internal/tmpl/partials/trending-card.html +21 -0 | new file mode 100644 | ||
| @@ -0,0 +1,21 @@ | ||
| 1 | +{{define "trending-card.html"}} | |
| 2 | +<div class="bg-spot-surface rounded-xl px-5 py-4 hover:bg-spot-hover-50 transition shadow-spot"> | |
| 3 | + <div class="flex items-start justify-between gap-4"> | |
| 4 | + <div class="min-w-0 flex-1"> | |
| 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"> | |
| 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> | |
| 10 | + </div> | |
| 11 | + {{if .Summary}} | |
| 12 | + <p class="text-sm text-spot-secondary mt-2 line-clamp-2">{{.Summary}}</p> | |
| 13 | + {{end}} | |
| 14 | + </div> | |
| 15 | + <div class="flex flex-col items-end gap-1 shrink-0 text-sm text-spot-secondary"> | |
| 16 | + <span class="inline-flex items-center gap-1"><svg class="w-4 h-4 text-spot-muted" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">{{template "icon-heart"}}</svg> {{.LikeCount}}</span> | |
| 17 | + <span class="text-spot-muted">{{.AnnotationCount}} notes</span> | |
| 18 | + </div> | |
| 19 | + </div> | |
| 20 | +</div> | |
| 21 | +{{end}} | |
| new file mode 100644 | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | +{{define "trending-card.html"}} | ||
| 2 | +<div class="bg-spot-surface rounded-xl px-5 py-4 hover:bg-spot-hover-50 transition shadow-spot"> | ||
| 3 | + <div class="flex items-start justify-between gap-4"> | ||
| 4 | + <div class="min-w-0 flex-1"> | ||
| 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"> | ||
| 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> | ||
| 10 | + </div> | ||
| 11 | + {{if .Summary}} | ||
| 12 | + <p class="text-sm text-spot-secondary mt-2 line-clamp-2">{{.Summary}}</p> | ||
| 13 | + {{end}} | ||
| 14 | + </div> | ||
| 15 | + <div class="flex flex-col items-end gap-1 shrink-0 text-sm text-spot-secondary"> | ||
| 16 | + <span class="inline-flex items-center gap-1"><svg class="w-4 h-4 text-spot-muted" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">{{template "icon-heart"}}</svg> {{.LikeCount}}</span> | ||
| 17 | + <span class="text-spot-muted">{{.AnnotationCount}} notes</span> | ||
| 18 | + </div> | ||
| 19 | + </div> | ||
| 20 | +</div> | ||
| 21 | +{{end}} | ||
modified
internal/tmpl/trending.html +2 -20 | @@ -13,26 +13,8 @@ | ||
| 13 | 13 | </p> |
| 14 | 14 | |
| 15 | 15 | <div id="trending-list" class="space-y-3"> |
| 16 | - {{range $i, $t := .Trending}} | |
| 17 | - <article class="bg-spot-surface rounded-xl px-5 py-4 hover:bg-spot-hover-50 transition shadow-spot"> | |
| 18 | - <div class="flex items-start justify-between gap-4"> | |
| 19 | - <div class="min-w-0 flex-1"> | |
| 20 | - <a href="/articles/{{$t.ArticleID}}" class="font-bold text-spot-text hover:text-spot-green transition text-lg leading-tight">{{$t.Title}}</a> | |
| 21 | - <div class="text-sm text-spot-secondary mt-1 flex items-center gap-2"> | |
| 22 | - {{if $t.FaviconURL}}<img src="{{$t.FaviconURL}}" class="w-4 h-4 rounded shrink-0" loading="lazy">{{end}} | |
| 23 | - {{if $t.Author}}<span>{{$t.Author}}</span>{{end}} | |
| 24 | - <span class="text-spot-muted"><a href="/articles?feed={{$t.FeedURL}}" class="hover:text-spot-green transition">{{if $t.FeedTitle}}{{$t.FeedTitle}}{{else}}{{$t.FeedURL}}{{end}}</a></span> | |
| 25 | - </div> | |
| 26 | - {{if $t.Summary}} | |
| 27 | - <p class="text-sm text-spot-secondary mt-2 line-clamp-2">{{$t.Summary}}</p> | |
| 28 | - {{end}} | |
| 29 | - </div> | |
| 30 | - <div class="flex flex-col items-end gap-1 shrink-0 text-sm text-spot-secondary"> | |
| 31 | - <span class="inline-flex items-center gap-1"><svg class="w-4 h-4 text-spot-muted" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">{{template "icon-heart"}}</svg> {{$t.LikeCount}}</span> | |
| 32 | - <span class="text-spot-muted">{{$t.AnnotationCount}} notes</span> | |
| 33 | - </div> | |
| 34 | - </div> | |
| 35 | - </article> | |
| 16 | + {{range .Trending}} | |
| 17 | + {{template "trending-card.html" .}} | |
| 36 | 18 | {{else}} |
| 37 | 19 | <div class="bg-spot-surface rounded-xl py-12 px-6 text-center"> |
| 38 | 20 | <div class="w-14 h-14 rounded-full bg-spot-hover flex items-center justify-center mb-4 mx-auto"> |
| @@ -13,26 +13,8 @@ | |||
| 13 | </p> | 13 | </p> |
| 14 | 14 | ||
| 15 | <div id="trending-list" class="space-y-3"> | 15 | <div id="trending-list" class="space-y-3"> |
| 16 | - {{range $i, $t := .Trending}} | 16 | + {{range .Trending}} |
| 17 | - <article class="bg-spot-surface rounded-xl px-5 py-4 hover:bg-spot-hover-50 transition shadow-spot"> | 17 | + {{template "trending-card.html" .}} |
| 18 | - <div class="flex items-start justify-between gap-4"> | ||
| 19 | - <div class="min-w-0 flex-1"> | ||
| 20 | - <a href="/articles/{{$t.ArticleID}}" class="font-bold text-spot-text hover:text-spot-green transition text-lg leading-tight">{{$t.Title}}</a> | ||
| 21 | - <div class="text-sm text-spot-secondary mt-1 flex items-center gap-2"> | ||
| 22 | - {{if $t.FaviconURL}}<img src="{{$t.FaviconURL}}" class="w-4 h-4 rounded shrink-0" loading="lazy">{{end}} | ||
| 23 | - {{if $t.Author}}<span>{{$t.Author}}</span>{{end}} | ||
| 24 | - <span class="text-spot-muted"><a href="/articles?feed={{$t.FeedURL}}" class="hover:text-spot-green transition">{{if $t.FeedTitle}}{{$t.FeedTitle}}{{else}}{{$t.FeedURL}}{{end}}</a></span> | ||
| 25 | - </div> | ||
| 26 | - {{if $t.Summary}} | ||
| 27 | - <p class="text-sm text-spot-secondary mt-2 line-clamp-2">{{$t.Summary}}</p> | ||
| 28 | - {{end}} | ||
| 29 | - </div> | ||
| 30 | - <div class="flex flex-col items-end gap-1 shrink-0 text-sm text-spot-secondary"> | ||
| 31 | - <span class="inline-flex items-center gap-1"><svg class="w-4 h-4 text-spot-muted" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">{{template "icon-heart"}}</svg> {{$t.LikeCount}}</span> | ||
| 32 | - <span class="text-spot-muted">{{$t.AnnotationCount}} notes</span> | ||
| 33 | - </div> | ||
| 34 | - </div> | ||
| 35 | - </article> | ||
| 36 | {{else}} | 18 | {{else}} |
| 37 | <div class="bg-spot-surface rounded-xl py-12 px-6 text-center"> | 19 | <div class="bg-spot-surface rounded-xl py-12 px-6 text-center"> |
| 38 | <div class="w-14 h-14 rounded-full bg-spot-hover flex items-center justify-center mb-4 mx-auto"> | 20 | <div class="w-14 h-14 rounded-full bg-spot-hover flex items-center justify-center mb-4 mx-auto"> |