summaryrefslogtreecommitdiff
path: root/front/src/logic/nostril.ts
diff options
context:
space:
mode:
Diffstat (limited to 'front/src/logic/nostril.ts')
-rw-r--r--front/src/logic/nostril.ts36
1 files changed, 0 insertions, 36 deletions
diff --git a/front/src/logic/nostril.ts b/front/src/logic/nostril.ts
deleted file mode 100644
index 4e5549d..0000000
--- a/front/src/logic/nostril.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import type { Event } from "@/types/nostr";
-import type { FC, FlatFeed, Poast } from "@/types/trill";
-import { engagementBunt, openLock } from "./bunts";
-export function eventsToFc(relayData: Record<string, Event[]>): FC {
- const start = null;
- const end = null;
- const feed = Object.values(relayData).reduce((acc: FlatFeed, events) => {
- const poasts = events.map(eventToPoast);
- for (const p of poasts) {
- if (p) acc[p.id] = p;
- }
- return acc;
- }, {});
- return { feed, start, end };
-}
-export function eventToPoast(event: Event): Poast | null {
- if (event.kind !== 1) return null;
- const contents = [{ paragraph: [{ text: event.content }] }];
- const ts = event.created_at * 1000;
- const id = `${ts}`;
- const poast: Poast = {
- id,
- host: event.pubkey,
- author: event.pubkey,
- contents,
- thread: id,
- parent: null,
- read: openLock,
- write: openLock,
- tags: [],
- time: ts,
- engagement: engagementBunt,
- children: [],
- };
- return poast;
-}