feat: render emoji packs and goals in cards

This commit is contained in:
Alejandro Gomez
2023-07-26 16:13:47 +02:00
parent 7a6f4048fb
commit 59cf6506e0
21 changed files with 537 additions and 76 deletions

33
src/element/Event.tsx Normal file
View File

@ -0,0 +1,33 @@
import "./event.css";
import { type NostrLink, EventKind } from "@snort/system";
import { useEvent } from "hooks/event";
import { GOAL } from "const";
import { Goal } from "element/goal";
import { Note } from "element/note";
interface EventProps {
link: NostrLink;
}
export function Event({ link }: EventProps) {
const event = useEvent(link);
if (event && event.kind === GOAL) {
return (
<div className="event-container">
<Goal ev={event} />
</div>
);
}
if (event && event.kind === EventKind.TextNote) {
return (
<div className="event-container">
<Note ev={event} />
</div>
);
}
return <code>{link.id}</code>;
}