瀏覽代碼

add bun rss tile, remove old tiles

Kirk Trombley 1 年之前
父節點
當前提交
78e6c8e6bf
共有 2 個文件被更改,包括 43 次插入22 次删除
  1. 16 22
      src/App.js
  2. 27 0
      src/components/tiles/BunRSS.jsx

+ 16 - 22
src/App.js

@@ -1,29 +1,23 @@
-import React from 'react';
-import './App.css';
+import React from "react";
+import "./App.css";
 import Teamspeak from "./components/tiles/Teamspeak";
-import TerrAssumptions from './components/tiles/TerrAssumptions';
-import CommaFeed from './components/tiles/CommaFeed';
-import Gogs from './components/tiles/Gogs';
-import Minecraft from './components/tiles/Minecraft';
-import Rollbot from './components/tiles/Rollbot';
-import VacationPlanner from './components/tiles/VacationPlanner';
-import DroneCI from './components/tiles/DroneCI';
-import Etherpad from './components/tiles/Etherpad';
-import Nextcloud from './components/tiles/Nextcloud';
+import TerrAssumptions from "./components/tiles/TerrAssumptions";
+import Gogs from "./components/tiles/Gogs";
+import Minecraft from "./components/tiles/Minecraft";
+import DroneCI from "./components/tiles/DroneCI";
+import Etherpad from "./components/tiles/Etherpad";
+import BunRSS from "./components/tiles/BunRSS";
 
 const App = () => (
   <div className="App">
-    <Teamspeak/>
-    <TerrAssumptions/>
-    <CommaFeed/>
-    <Minecraft/>
-    <Rollbot/>
-    <VacationPlanner/>
-    <Gogs/>
-    <DroneCI/>
-    <Etherpad/>
-    <Nextcloud/>
+    <Teamspeak />
+    <BunRSS />
+    <TerrAssumptions />
+    <Minecraft />
+    <Gogs />
+    <DroneCI />
+    <Etherpad />
   </div>
 );
 
-export default App;
+export default App;

+ 27 - 0
src/components/tiles/BunRSS.jsx

@@ -0,0 +1,27 @@
+import { OK } from "../shared/StatusMessage";
+import Tile from "../shared/Tile";
+import useApi from "../../hooks/useApi";
+import useHealthPolling from "../../hooks/useHealthPolling";
+
+const url = "https://rss.hiram.services";
+const queryUrl = `${url}/unread-count/kirkleon`;
+const ms = 1000 * 60 * 20;
+
+const BunRSS = () => {
+  const health = useHealthPolling(url, { ms });
+  const [apiRes, data] = useApi(queryUrl, { ms });
+
+  const message = health !== OK
+                ? null
+                : apiRes === OK
+                ? `${data.unread} item(s) unread`
+                : "Could not retrieve unread"
+  return <Tile
+    link={url}
+    title="BunRSS"
+    health={health}
+    data={message}
+  />
+}
+
+export default BunRSS;