From 74d84cb2f22600b6246343e9ea606cf0db7517f0 Mon Sep 17 00:00:00 2001
From: polwex <polwex@sortug.com>
Date: Wed, 19 Nov 2025 05:47:30 +0700
Subject: Big GUI improvements on Nostr rendering and fetching

---
 gui/src/pages/Feed.tsx | 56 +++++++++++++++++---------------------------------
 1 file changed, 19 insertions(+), 37 deletions(-)

(limited to 'gui/src/pages/Feed.tsx')

diff --git a/gui/src/pages/Feed.tsx b/gui/src/pages/Feed.tsx
index bb001d4..16a5ea1 100644
--- a/gui/src/pages/Feed.tsx
+++ b/gui/src/pages/Feed.tsx
@@ -8,13 +8,13 @@ import { useState } from "react";
 import Composer from "@/components/composer/Composer";
 import { ErrorPage } from "@/pages/Error";
 import NostrFeed from "@/components/nostr/Feed";
+import { consolidateFeeds, disaggregate } from "@/logic/nostrill";
 
-type FeedType = "global" | "following" | "nostr";
+type FeedType = "urbit" | "following" | "nostr";
 function Loader() {
   const params = useParams();
-  console.log({ params });
   if (!params.taip) return <FeedPage t="nostr" />;
-  if (params.taip === "global") return <FeedPage t={"global"} />;
+  // if (params.taip === "urbit") return <FeedPage t={"urbit"} />;
   if (params.taip === "following") return <FeedPage t={"following"} />;
   if (params.taip === "nostr") return <FeedPage t={"nostr"} />;
   // else if (param === FeedType.Rumors) return <Rumors />;
@@ -27,10 +27,10 @@ function FeedPage({ t }: { t: FeedType }) {
     <>
       <div id="top-tabs">
         <div
-          className={active === "global" ? "active" : ""}
-          onClick={() => setActive("global")}
+          className={active === "urbit" ? "active" : ""}
+          onClick={() => setActive("urbit")}
         >
-          Global
+          Urbit
         </div>
         <div
           className={active === "following" ? "active" : ""}
@@ -47,8 +47,8 @@ function FeedPage({ t }: { t: FeedType }) {
       </div>
       <div id="feed-proper">
         <Composer />
-        {active === "global" ? (
-          <Global />
+        {active === "urbit" ? (
+          <Urbit />
         ) : active === "following" ? (
           <Following />
         ) : active === "nostr" ? (
@@ -58,40 +58,22 @@ function FeedPage({ t }: { t: FeedType }) {
     </>
   );
 }
-//   {active === "global" ? (
-//     <Global />
-//   ) : active === "following" ? (
-//     <Global />
-//   ) : (
-//     <Global />
-//   )}
 
-function Global() {
-  // const { api } = useLocalState();
-  // const { isPending, data, refetch } = useQuery({
-  //   queryKey: ["globalFeed"],
-  //   queryFn: () => {
-  //     return api!.scryFeed(null, null);
-  //   },
-  // });
-  // console.log(data, "scry feed data");
-  // if (isPending) return <img className="x-center" src={spinner} />;
-  // else if ("bucun" in data) return <p>Error</p>;
-  // else return <Inner data={data} refetch={refetch} />;
-  return <p>Error</p>;
+function Urbit() {
+  const following = useLocalState((s) => s.following);
+  const feed = disaggregate(following, "urbit");
+  return (
+    <div>
+      <PostList data={feed} refetch={() => {}} />
+    </div>
+  );
 }
 function Following() {
-  const following = useLocalState((s) => s.following2);
-  console.log({ following });
-
-  // console.log(data, "scry feed data");
-  // if (isPending) return <img className="x-center" src={spinner} />;
-  // else if ("bucun" in data) return <p>Error</p>;
-  // else return <Inner data={data} refetch={refetch} />;
-
+  const following = useLocalState((s) => s.following);
+  const feed = consolidateFeeds(following);
   return (
     <div>
-      <PostList data={following} refetch={() => {}} />
+      <PostList data={feed} refetch={() => {}} />
     </div>
   );
 }
-- 
cgit v1.2.3

