diff --git a/internal/templates/grouped-entries.gohtml b/internal/templates/grouped-entries.gohtml index 0822209..58b5709 100644 --- a/internal/templates/grouped-entries.gohtml +++ b/internal/templates/grouped-entries.gohtml @@ -22,20 +22,18 @@

{{.PrimaryGroup.Title}}

- generated on {{.GeneratedDate.Format - "Jan 2, 2006"}} -
- -
-

Summary

- {{if .PrimaryGroup.Summary}} -

{{textToHTML .PrimaryGroup.Summary}}

- {{end}} -

- This digest has {{.PrimaryGroup.TotalEntries}} entries from {{.PrimaryGroup.TotalFeeds}} feeds. +

+ generated {{.GeneratedDate.Format "Jan 2, 2006"}}, with {{.PrimaryGroup.TotalEntries}} entries from {{.PrimaryGroup.TotalFeeds}} feeds.

+ {{if .PrimaryGroup.Summary}} +
+

Summary

+
{{textToHTML .PrimaryGroup.Summary}}
+
+ {{end}} +
{{range .PrimaryGroup.SubGroups}}

{{.Title}}

diff --git a/internal/templates/overview.gohtml b/internal/templates/overview.gohtml index 770cce3..96554ec 100644 --- a/internal/templates/overview.gohtml +++ b/internal/templates/overview.gohtml @@ -9,33 +9,39 @@
-

Miniflux Digest Overview

- generated on {{.GeneratedDate.Format "Jan 2, 2006"}} +

Miniflux Digest Overview

+

+ Generated on {{.GeneratedDate.Format "Jan 2, 2006"}}, with {{.TotalEntries}} entries from {{.TotalFeeds}} feeds. +

+ {{if .OverviewSummary}}
-

Summary

- {{if .OverviewSummary}} -

{{.OverviewSummary}}

- {{end}} -

You have {{.TotalEntries}} entries from {{.TotalFeeds}} feeds.

+

Summary

+
{{.OverviewSummary}}
+ {{end}}
-

Grouped Digests

-
    - {{range .PrimaryGroups}} -
  • -

    {{.Title}}

    - {{if .Summary}} -

    {{.Summary}}

    - {{else}} -

    {{.TotalEntries}} entries from {{.TotalFeeds}} feeds.

    - {{end}} -
  • - {{end}} -
+

Grouped Digests

+ {{range .PrimaryGroups}} +
+ + {{.Title}} + + {{if .Summary}} +
+ {{.Summary}} +
+ {{end}} + +
+ {{end}}
+ diff --git a/internal/templates/static/overview.js b/internal/templates/static/overview.js new file mode 100644 index 0000000..8539f56 --- /dev/null +++ b/internal/templates/static/overview.js @@ -0,0 +1,42 @@ +document.addEventListener('DOMContentLoaded', () => { + const markAsReadLinks = document.querySelectorAll('.mark-as-read-link'); + + markAsReadLinks.forEach(link => { + link.addEventListener('click', (event) => { + event.preventDefault(); + const entry = event.target.closest('section.entry'); + if (entry) { + entry.classList.toggle('viewed'); + if (entry.classList.contains('viewed')) { + event.target.textContent = 'Mark as unread'; + } else { + event.target.textContent = 'Mark as read'; + } + } + }); + }); + + const entries = document.querySelectorAll('.grouped-digests .entry'); + entries.forEach(entry => { + entry.addEventListener('click', (event) => { + // Don't do anything if a link in the meta section was clicked + if (event.target.closest('.entry-meta')) { + return; + } + + // Find the main link and navigate to it + const mainLink = entry.querySelector('a.entry-link'); + if (mainLink) { + mainLink.click(); + } + }); + // Add a cursor pointer to the whole card except the meta section + entry.style.cursor = 'pointer'; + }); + + // Remove cursor pointer from the meta section + const metaSections = document.querySelectorAll('.entry-meta'); + metaSections.forEach(meta => { + meta.style.cursor = 'auto'; + }); +}); diff --git a/internal/templates/static/style.css b/internal/templates/static/style.css index b0d31e8..98b5b45 100644 --- a/internal/templates/static/style.css +++ b/internal/templates/static/style.css @@ -68,20 +68,36 @@ body { .container { max-width: 800px; + min-width: 360px; margin: 2rem auto; padding: 1.5rem; } section.header { margin-bottom: 1.5rem; - text-align: center; + text-align: left; } section.header h1.title { font-size: 1.875rem; font-weight: 700; color: var(--header-title-color); - margin-bottom: 0.25rem; + margin-bottom: 0; +} + +.subtitle { + font-size: 0.9rem; + color: var(--header-date-color); + margin-top: 0; +} + +.subtitle a { + color: var(--entry-link-color); + text-decoration: none; +} + +.subtitle a:hover { + text-decoration: underline; } section.header .date { @@ -89,7 +105,7 @@ section.header .date { color: var(--header-date-color); } -section.summary p:first-of-type { +section.summary div:first-of-type { margin: 1rem auto; padding: 0.5rem 1rem; background-color: var(--container-background); @@ -100,10 +116,9 @@ section.summary p:first-of-type { h2.group-entries-title { font-size: 1.25rem; font-weight: 500; - color: var(--group-title-color); + color: var(--text-color); margin-top: 0.5rem; margin-bottom: 0.5rem; - padding-left: 0.5rem; } section.entry { diff --git a/scripts/preview/main.go b/scripts/preview/main.go index a1b83a5..f7e5212 100644 --- a/scripts/preview/main.go +++ b/scripts/preview/main.go @@ -79,7 +79,7 @@ func generateMockDigest(cfg *config.Config) *models.OverviewTemplateData { } log.Println("generateDigestData: Building digest data...") - return digestSvc.BuildDigestData( + data := digestSvc.BuildDigestData( entries, icons, cfg.Digest.GroupBy, @@ -87,6 +87,17 @@ func generateMockDigest(cfg *config.Config) *models.OverviewTemplateData { cfg.Digest.SortBy, cfg.Miniflux.Host, ) + + if len(data.PrimaryGroups) > 0 { + data.PrimaryGroups[0].Summary = "This is a mock summary for the first group to test the layout." + } + if len(data.PrimaryGroups) > 2 { + data.PrimaryGroups[2].Summary = "This is another mock summary for a different group, showing that not all groups have summaries." + } + + data.OverviewSummary = "This is a mock overview summary to see how it looks on the page. It should provide a high-level overview of all the digests included below." + + return data } func generateMinifluxDigest(cfg *config.Config, minifluxClientService services.MinifluxClientService) *models.OverviewTemplateData {