feat: badges

- render badges in cards
- render mentioned badges in chat
- render host badge awards in chat
- render accepted badges next to username
This commit is contained in:
2023-07-31 20:42:43 +02:00
parent 1baecf41f2
commit 7a030c9e53
14 changed files with 291 additions and 42 deletions

View File

@ -8,13 +8,10 @@ import { useRequestBuilder } from "@snort/system-react";
import { unixNow } from "@snort/shared";
import { System } from "index";
import { useMemo } from "react";
import { LIVE_STREAM_CHAT } from "const";
import { LIVE_STREAM_CHAT, WEEK } from "const";
export function useLiveChatFeed(link: NostrLink, eZaps?: Array<string>) {
const since = useMemo(
() => unixNow() - 60 * 60 * 24 * 7, // 7-days of zaps
[link.id],
);
const since = useMemo(() => unixNow() - WEEK, [link.id]);
const sub = useMemo(() => {
const rb = new RequestBuilder(`live:${link.id}:${link.author}`);
rb.withOptions({
@ -45,7 +42,9 @@ export function useLiveChatFeed(link: NostrLink, eZaps?: Array<string>) {
const esub = useMemo(() => {
if (etags.length === 0) return null;
const rb = new RequestBuilder(`reactions:${link.id}:${link.author}`);
const rb = new RequestBuilder(
`reactions:${link.id}:${link.author}:${etags.length}`,
);
rb.withOptions({
leaveOpen: true,
});