From f5aa898631b25a1071121030c2b3b014f689a03f Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 12 Oct 2023 16:28:30 +0100 Subject: [PATCH] feat: list feed rendering --- packages/app/src/Pages/ListFeedPage.tsx | 36 +++++++++++++++++++++++++ packages/app/src/index.tsx | 7 ++++- packages/app/src/lang.json | 3 +++ packages/app/src/translations/en.json | 1 + 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 packages/app/src/Pages/ListFeedPage.tsx diff --git a/packages/app/src/Pages/ListFeedPage.tsx b/packages/app/src/Pages/ListFeedPage.tsx new file mode 100644 index 00000000..9d2b9dfb --- /dev/null +++ b/packages/app/src/Pages/ListFeedPage.tsx @@ -0,0 +1,36 @@ +import { dedupe, unwrap } from "@snort/shared"; +import { EventKind, parseNostrLink } from "@snort/system"; +import { Hour } from "Const"; +import Timeline from "Element/Feed/Timeline"; +import PageSpinner from "Element/PageSpinner"; +import { useEventFeed } from "Feed/EventFeed"; +import { FormattedMessage } from "react-intl"; +import { useParams } from "react-router-dom"; + +export function ListFeedPage() { + const { id } = useParams(); + const link = parseNostrLink(unwrap(id)); + const { data } = useEventFeed(link); + + if (!data) return ; + if (data.kind !== EventKind.ContactList && data.kind !== EventKind.PubkeyLists) { + return ( + + + + ); + } + const pubkeys = dedupe(data.tags.filter(a => a[0] === "p").map(a => a[1])); + return ( + + ); +} diff --git a/packages/app/src/index.tsx b/packages/app/src/index.tsx index efb36dad..d2ece538 100644 --- a/packages/app/src/index.tsx +++ b/packages/app/src/index.tsx @@ -20,6 +20,7 @@ import { PowWorker, } from "@snort/system"; import { SnortContext } from "@snort/system-react"; +import { removeUndefined } from "@snort/shared"; import * as serviceWorkerRegistration from "serviceWorkerRegistration"; import { IntlProvider } from "IntlProvider"; @@ -48,7 +49,7 @@ import { preload, RelayMetrics, SystemDb, UserCache, UserRelays } from "Cache"; import { LoginStore } from "Login"; import { SnortDeckLayout } from "Pages/DeckLayout"; import FreeNostrAddressPage from "./Pages/FreeNostrAddressPage"; -import { removeUndefined } from "@snort/shared"; +import { ListFeedPage } from "Pages/ListFeedPage"; const WasmQueryOptimizer = { expandFilter: (f: ReqFilter) => { @@ -221,6 +222,10 @@ export const router = createBrowserRouter([ path: "/zap-pool", element: , }, + { + path: "/list-feed/:id", + element: , + }, ...NewUserRoutes, ...WalletRoutes, ...(CONFIG.features.subscriptions ? SubscribeRoutes : []), diff --git a/packages/app/src/lang.json b/packages/app/src/lang.json index c3f194f7..93cae8ac 100644 --- a/packages/app/src/lang.json +++ b/packages/app/src/lang.json @@ -1410,6 +1410,9 @@ "v8lolG": { "defaultMessage": "Start chat" }, + "vB3oQ/": { + "defaultMessage": "Must be a contact list or pubkey list" + }, "vOKedj": { "defaultMessage": "{n,plural,=1{& {n} other} other{& {n} others}}" }, diff --git a/packages/app/src/translations/en.json b/packages/app/src/translations/en.json index ff039a25..72d0a8ee 100644 --- a/packages/app/src/translations/en.json +++ b/packages/app/src/translations/en.json @@ -462,6 +462,7 @@ "usAvMr": "Edit Profile", "ut+2Cd": "Get a partner identifier", "v8lolG": "Start chat", + "vB3oQ/": "Must be a contact list or pubkey list", "vOKedj": "{n,plural,=1{& {n} other} other{& {n} others}}", "vZ4quW": "NIP-05 is a DNS based verification spec which helps to validate you as a real user.", "vhlWFg": "Poll Options",