fix: note embed in cards

This commit is contained in:
2025-05-02 10:22:56 +01:00
parent c2b52c749b
commit 6bd92279dc
2 changed files with 9 additions and 4 deletions

View File

@ -35,7 +35,7 @@ export function EventIcon({ kind }: { kind?: EventKind }) {
export function NostrEvent({ ev }: { ev: TaggedNostrEvent }) {
const link = NostrLink.fromEvent(ev);
function modalPage(inner: ReactNode) {
return <div className="rounded-2xl px-4 py-3 md:w-[700px] mx-auto w-full">{inner}</div>;
return <div className="rounded-2xl px-4 py-3">{inner}</div>;
}
switch (ev.kind) {
@ -83,6 +83,8 @@ export function NostrEvent({ ev }: { ev: TaggedNostrEvent }) {
export function EventEmbed({ link, ...props }: EventProps & HTMLProps<HTMLDivElement>) {
const event = useEventFeed(link);
if (event) {
return <NostrEvent ev={event} {...props} />;
return <div className="md:w-[700px] mx-auto w-full">
<NostrEvent ev={event} {...props} />
</div>;
}
}

View File

@ -1,16 +1,19 @@
import { NostrLink, TaggedNostrEvent } from "@snort/system";
import { ExternalIconLink } from "./external-link";
import { Profile } from "./profile";
import EventReactions from "./event-reactions";
import { Text } from "@/element/text";
import { Link } from "react-router-dom";
import { Icon } from "./icon";
export function Note({ ev }: { ev: TaggedNostrEvent }) {
return (
<div className="bg-layer-2 rounded-xl px-4 py-3 flex flex-col gap-2">
<div className="flex justify-between items-center">
<Profile pubkey={ev.pubkey} avatarSize={30} />
<ExternalIconLink size={24} href={`https://snort.social/${NostrLink.fromEvent(ev).encode()}`} />
<Link to={`/${NostrLink.fromEvent(ev).encode()}`}>
<Icon name="link" size={24} />
</Link>
</div>
<Text tags={ev.tags} content={ev.content} className="whitespace-pre-line overflow-wrap" />
<EventReactions ev={ev} />