From b8eeb636e0640e1459742ddad908e5fdd7789a7c Mon Sep 17 00:00:00 2001 From: Atlas <17718755+uykukacinca@users.noreply.github.com> Date: Sun, 6 Oct 2024 18:36:37 +0300 Subject: [PATCH] twitch-grid-cards --- docs/configuration.md | 12 +++++++ internal/assets/static/main.css | 1 + internal/assets/templates.go | 1 + .../twitch-channels-card-contents.html | 32 +++++++++++++++++++ .../templates/twitch-channels-grid.html | 29 +++++++++++++++++ internal/feed/twitch.go | 10 ++++++ internal/widget/twitch-channels.go | 26 ++++++++++++--- 7 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 internal/assets/templates/twitch-channels-card-contents.html create mode 100644 internal/assets/templates/twitch-channels-grid.html diff --git a/docs/configuration.md b/docs/configuration.md index 6f9d602a..b0059b2c 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -1588,6 +1588,9 @@ Preview: | ---- | ---- | -------- | ------- | | channels | array | yes | | | collapse-after | integer | no | 5 | +| collapse-after-rows | integer | no | 4 | +| style | string | no | | +| show-offline | boolean | no | false | | sort-by | string | no | viewers | ##### `channels` @@ -1596,6 +1599,15 @@ A list of channels to display. ##### `collapse-after` How many channels are visible before the "SHOW MORE" button appears. Set to `-1` to never collapse. +##### `collapse-after-rows` +Specify the number of rows to show when using the `grid-cards` style before the "SHOW MORE" button appears. + +##### `style` +Used to change the appearance of the widget. Possible values are `grid-cards`. + +##### `show-offline` + + ##### `sort-by` Can be used to specify the order in which the channels are displayed. Possible values are `viewers` and `live`. diff --git a/internal/assets/static/main.css b/internal/assets/static/main.css index d5ab9bb7..f22d54f4 100644 --- a/internal/assets/static/main.css +++ b/internal/assets/static/main.css @@ -695,6 +695,7 @@ details[open] .summary::after { @container widget (max-width: 850px) { .cards-grid { --cards-per-row: 3; } } @container widget (max-width: 750px) { .cards-grid { --cards-per-row: 3; } } @container widget (max-width: 650px) { .cards-grid { --cards-per-row: 2; } } +@container widget (max-width: 300px) { .cards-grid { --cards-per-row: 1; } } .widget-small-content-bounds { max-width: 350px; diff --git a/internal/assets/templates.go b/internal/assets/templates.go index 85abb69a..6c309830 100644 --- a/internal/assets/templates.go +++ b/internal/assets/templates.go @@ -34,6 +34,7 @@ var ( MonitorTemplate = compileTemplate("monitor.html", "widget-base.html") TwitchGamesListTemplate = compileTemplate("twitch-games-list.html", "widget-base.html") TwitchChannelsTemplate = compileTemplate("twitch-channels.html", "widget-base.html") + TwitchChannelsGridTemplate = compileTemplate("twitch-channels-grid.html", "widget-base.html", "twitch-channels-card-contents.html") RepositoryTemplate = compileTemplate("repository.html", "widget-base.html") SearchTemplate = compileTemplate("search.html", "widget-base.html") ExtensionTemplate = compileTemplate("extension.html", "widget-base.html") diff --git a/internal/assets/templates/twitch-channels-card-contents.html b/internal/assets/templates/twitch-channels-card-contents.html new file mode 100644 index 00000000..bf543417 --- /dev/null +++ b/internal/assets/templates/twitch-channels-card-contents.html @@ -0,0 +1,32 @@ +{{ define "twitch-channels-card-contents" }} + {{ if .IsLive }} + + {{ end }} +
+{{ end }} diff --git a/internal/assets/templates/twitch-channels-grid.html b/internal/assets/templates/twitch-channels-grid.html new file mode 100644 index 00000000..1667e7e4 --- /dev/null +++ b/internal/assets/templates/twitch-channels-grid.html @@ -0,0 +1,29 @@ +{{ template "widget-base.html" . }} +{{ define "widget-content-classes" }}widget-content-frameless{{ end }} +{{ define "widget-content" }} +