feat: list feed rendering
This commit is contained in:
36
packages/app/src/Pages/ListFeedPage.tsx
Normal file
36
packages/app/src/Pages/ListFeedPage.tsx
Normal file
@ -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 <PageSpinner />;
|
||||||
|
if (data.kind !== EventKind.ContactList && data.kind !== EventKind.PubkeyLists) {
|
||||||
|
return (
|
||||||
|
<b>
|
||||||
|
<FormattedMessage defaultMessage="Must be a contact list or pubkey list" />
|
||||||
|
</b>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const pubkeys = dedupe(data.tags.filter(a => a[0] === "p").map(a => a[1]));
|
||||||
|
return (
|
||||||
|
<Timeline
|
||||||
|
subject={{
|
||||||
|
type: "pubkey",
|
||||||
|
items: pubkeys,
|
||||||
|
discriminator: "list-feed",
|
||||||
|
}}
|
||||||
|
postsOnly={true}
|
||||||
|
method="TIME_RANGE"
|
||||||
|
window={Hour * 12}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
@ -20,6 +20,7 @@ import {
|
|||||||
PowWorker,
|
PowWorker,
|
||||||
} from "@snort/system";
|
} from "@snort/system";
|
||||||
import { SnortContext } from "@snort/system-react";
|
import { SnortContext } from "@snort/system-react";
|
||||||
|
import { removeUndefined } from "@snort/shared";
|
||||||
|
|
||||||
import * as serviceWorkerRegistration from "serviceWorkerRegistration";
|
import * as serviceWorkerRegistration from "serviceWorkerRegistration";
|
||||||
import { IntlProvider } from "IntlProvider";
|
import { IntlProvider } from "IntlProvider";
|
||||||
@ -48,7 +49,7 @@ import { preload, RelayMetrics, SystemDb, UserCache, UserRelays } from "Cache";
|
|||||||
import { LoginStore } from "Login";
|
import { LoginStore } from "Login";
|
||||||
import { SnortDeckLayout } from "Pages/DeckLayout";
|
import { SnortDeckLayout } from "Pages/DeckLayout";
|
||||||
import FreeNostrAddressPage from "./Pages/FreeNostrAddressPage";
|
import FreeNostrAddressPage from "./Pages/FreeNostrAddressPage";
|
||||||
import { removeUndefined } from "@snort/shared";
|
import { ListFeedPage } from "Pages/ListFeedPage";
|
||||||
|
|
||||||
const WasmQueryOptimizer = {
|
const WasmQueryOptimizer = {
|
||||||
expandFilter: (f: ReqFilter) => {
|
expandFilter: (f: ReqFilter) => {
|
||||||
@ -221,6 +222,10 @@ export const router = createBrowserRouter([
|
|||||||
path: "/zap-pool",
|
path: "/zap-pool",
|
||||||
element: <ZapPoolPage />,
|
element: <ZapPoolPage />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/list-feed/:id",
|
||||||
|
element: <ListFeedPage />,
|
||||||
|
},
|
||||||
...NewUserRoutes,
|
...NewUserRoutes,
|
||||||
...WalletRoutes,
|
...WalletRoutes,
|
||||||
...(CONFIG.features.subscriptions ? SubscribeRoutes : []),
|
...(CONFIG.features.subscriptions ? SubscribeRoutes : []),
|
||||||
|
@ -1410,6 +1410,9 @@
|
|||||||
"v8lolG": {
|
"v8lolG": {
|
||||||
"defaultMessage": "Start chat"
|
"defaultMessage": "Start chat"
|
||||||
},
|
},
|
||||||
|
"vB3oQ/": {
|
||||||
|
"defaultMessage": "Must be a contact list or pubkey list"
|
||||||
|
},
|
||||||
"vOKedj": {
|
"vOKedj": {
|
||||||
"defaultMessage": "{n,plural,=1{& {n} other} other{& {n} others}}"
|
"defaultMessage": "{n,plural,=1{& {n} other} other{& {n} others}}"
|
||||||
},
|
},
|
||||||
|
@ -462,6 +462,7 @@
|
|||||||
"usAvMr": "Edit Profile",
|
"usAvMr": "Edit Profile",
|
||||||
"ut+2Cd": "Get a partner identifier",
|
"ut+2Cd": "Get a partner identifier",
|
||||||
"v8lolG": "Start chat",
|
"v8lolG": "Start chat",
|
||||||
|
"vB3oQ/": "Must be a contact list or pubkey list",
|
||||||
"vOKedj": "{n,plural,=1{& {n} other} other{& {n} others}}",
|
"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.",
|
"vZ4quW": "NIP-05 is a DNS based verification spec which helps to validate you as a real user.",
|
||||||
"vhlWFg": "Poll Options",
|
"vhlWFg": "Poll Options",
|
||||||
|
Reference in New Issue
Block a user