homepage improvements

- show followed streams first
- show stream hashtags in video tile
- allow to visit hashtag page by clicking tag
- allow to follow/unfollow hashtags
This commit is contained in:
2023-07-31 12:19:51 +02:00
parent e726a67413
commit 75ff1dc376
11 changed files with 288 additions and 158 deletions

View File

@ -94,3 +94,22 @@ export async function openFile(): Promise<File | undefined> {
export function getTagValues(tags: Array<string[]>, tag: string) {
return tags.filter((t) => t.at(0) === tag).map((t) => t.at(1));
}
export function dedupeByHost(events: Array<NostrEvent>) {
const { result } = events.reduce(
({ result, seen }, ev) => {
const host = getHost(ev);
if (seen.has(host)) {
return { result, seen };
}
result.push(ev);
seen.add(host);
return { result, seen };
},
{
result: [],
seen: new Set(),
},
);
return result;
}