mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-18 11:13:30 +00:00
small fixes
This commit is contained in:
parent
c74a81cfdb
commit
98d2ccfc86
@ -14,9 +14,8 @@ import { User } from '@shared/user';
|
|||||||
|
|
||||||
import { useEvent } from '@utils/hooks/useEvent';
|
import { useEvent } from '@utils/hooks/useEvent';
|
||||||
|
|
||||||
export function Repost({ event }: { event: NDKEvent }) {
|
export function Repost({ event }: { event: NDKEvent & { root_id: string } }) {
|
||||||
const repostID = event.tags.find((el) => el[0] === 'e')[1] ?? '';
|
const { status, data } = useEvent(event.root_id, event.content);
|
||||||
const { status, data } = useEvent(repostID, event.content);
|
|
||||||
|
|
||||||
const renderKind = useCallback(
|
const renderKind = useCallback(
|
||||||
(repostEvent: NDKEvent) => {
|
(repostEvent: NDKEvent) => {
|
||||||
@ -49,10 +48,10 @@ export function Repost({ event }: { event: NDKEvent }) {
|
|||||||
<div className="h-min w-full px-3 pb-3">
|
<div className="h-min w-full px-3 pb-3">
|
||||||
<div className="flex flex-col gap-1 overflow-hidden rounded-xl bg-white/10 px-3 py-3 backdrop-blur-xl">
|
<div className="flex flex-col gap-1 overflow-hidden rounded-xl bg-white/10 px-3 py-3 backdrop-blur-xl">
|
||||||
<p className="select-text break-all text-white/50">
|
<p className="select-text break-all text-white/50">
|
||||||
Failed to get repost with ID
|
Failed to get post with ID
|
||||||
</p>
|
</p>
|
||||||
<div className="break-all rounded-lg bg-white/10 px-2 py-2 backdrop-blur-xl">
|
<div className="break-all rounded-lg bg-white/10 px-2 py-2 backdrop-blur-xl">
|
||||||
<p className="text-white">{repostID}</p>
|
<p className="text-white">{event.id}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -71,7 +70,7 @@ export function Repost({ event }: { event: NDKEvent }) {
|
|||||||
<div className="w-11 shrink-0" />
|
<div className="w-11 shrink-0" />
|
||||||
<div className="relative z-20 flex-1">
|
<div className="relative z-20 flex-1">
|
||||||
{renderKind(data)}
|
{renderKind(data)}
|
||||||
<NoteActions id={repostID} pubkey={data.pubkey} />
|
<NoteActions id={data.id} pubkey={data.pubkey} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import ReactMarkdown from 'react-markdown';
|
import ReactMarkdown from 'react-markdown';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
import remarkGfm from 'remark-gfm';
|
import remarkGfm from 'remark-gfm';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -37,6 +38,15 @@ export function TextNote({ content }: { content: string }) {
|
|||||||
className="markdown"
|
className="markdown"
|
||||||
remarkPlugins={[remarkGfm]}
|
remarkPlugins={[remarkGfm]}
|
||||||
components={{
|
components={{
|
||||||
|
a: ({ href }) => {
|
||||||
|
const cleanURL = new URL(href);
|
||||||
|
cleanURL.search = '';
|
||||||
|
return (
|
||||||
|
<Link to={href} target="_blank">
|
||||||
|
{cleanURL.hostname + cleanURL.pathname}
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
},
|
||||||
del: ({ children }) => {
|
del: ({ children }) => {
|
||||||
const key = children[0] as string;
|
const key = children[0] as string;
|
||||||
if (typeof key !== 'string') return;
|
if (typeof key !== 'string') return;
|
||||||
|
Loading…
Reference in New Issue
Block a user