From 71025c6ed062cacae69b09597aae6a4de393116a Mon Sep 17 00:00:00 2001
From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Date: Wed, 9 Apr 2025 15:54:46 +1000
Subject: sidebar: news use monitor height
Use monitor height instead of absolute
---
src/modules/sidebar/alerts.tsx | 5 +++--
src/modules/sidebar/index.tsx | 8 ++++----
src/modules/sidebar/modules/headlines.tsx | 7 +++++--
src/modules/sidebar/modules/news.tsx | 7 +++++--
src/modules/sidebar/packages.tsx | 5 +++--
5 files changed, 20 insertions(+), 12 deletions(-)
(limited to 'src')
diff --git a/src/modules/sidebar/alerts.tsx b/src/modules/sidebar/alerts.tsx
index b669514..9599aff 100644
--- a/src/modules/sidebar/alerts.tsx
+++ b/src/modules/sidebar/alerts.tsx
@@ -1,10 +1,11 @@
+import type { Monitor } from "@/services/monitors";
import Headlines from "./modules/headlines";
import Notifications from "./modules/notifications";
-export default () => (
+export default ({ monitor }: { monitor: Monitor }) => (
-
+
);
diff --git a/src/modules/sidebar/index.tsx b/src/modules/sidebar/index.tsx
index 9d197cd..7570283 100644
--- a/src/modules/sidebar/index.tsx
+++ b/src/modules/sidebar/index.tsx
@@ -33,12 +33,12 @@ export const awaitSidebar = (monitor: Monitor) =>
idle(awaitSidebar);
});
-const getPane = (name: PaneName) => {
+const getPane = (monitor: Monitor, name: PaneName) => {
if (name === "dashboard") return ;
if (name === "audio") return ;
if (name === "connectivity") return ;
- if (name === "packages") return ;
- if (name === "alerts") return ;
+ if (name === "packages") return ;
+ if (name === "alerts") return ;
return ;
};
@@ -76,7 +76,7 @@ export default class SideBar extends Widget.Window {
transitionDuration={200}
shown={bind(this.shown)}
>
- {paneNames.map(getPane)}
+ {paneNames.map(n => getPane(monitor, n))}
diff --git a/src/modules/sidebar/modules/headlines.tsx b/src/modules/sidebar/modules/headlines.tsx
index 089119c..3660f18 100644
--- a/src/modules/sidebar/modules/headlines.tsx
+++ b/src/modules/sidebar/modules/headlines.tsx
@@ -1,3 +1,4 @@
+import type { Monitor } from "@/services/monitors";
import News, { type IArticle } from "@/services/news";
import Palette, { type IPalette } from "@/services/palette";
import { capitalize } from "@/utils/strings";
@@ -143,7 +144,7 @@ const NoNews = () => (
);
-export default () => (
+export default ({ monitor }: { monitor: Monitor }) => (
@@ -163,7 +164,9 @@ export default () => (
>
(a.length > 0 ? "expanded" : ""))}
+ css={bind(News.get_default(), "articles").as(a =>
+ a.length > 0 ? `min-height: ${Math.round(monitor.height * 0.4)}px;` : ""
+ )}
hscroll={Gtk.PolicyType.NEVER}
name="list"
>
diff --git a/src/modules/sidebar/modules/news.tsx b/src/modules/sidebar/modules/news.tsx
index 1ab2383..c799757 100644
--- a/src/modules/sidebar/modules/news.tsx
+++ b/src/modules/sidebar/modules/news.tsx
@@ -1,3 +1,4 @@
+import type { Monitor } from "@/services/monitors";
import Palette from "@/services/palette";
import Updates from "@/services/updates";
import { setupCustomTooltip } from "@/utils/widgets";
@@ -75,7 +76,7 @@ const NoNews = () => (
);
-export default () => (
+export default ({ monitor }: { monitor: Monitor }) => (