mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-18 11:13:30 +00:00
polish
This commit is contained in:
parent
2e47415160
commit
ac50cd1373
@ -81,7 +81,7 @@
|
|||||||
"@tauri-apps/cli": "2.0.0-alpha.10",
|
"@tauri-apps/cli": "2.0.0-alpha.10",
|
||||||
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
|
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
|
||||||
"@types/html-to-text": "^9.0.1",
|
"@types/html-to-text": "^9.0.1",
|
||||||
"@types/node": "^18.17.1",
|
"@types/node": "^18.17.2",
|
||||||
"@types/react": "^18.2.18",
|
"@types/react": "^18.2.18",
|
||||||
"@types/react-dom": "^18.2.7",
|
"@types/react-dom": "^18.2.7",
|
||||||
"@types/youtube-player": "^5.5.7",
|
"@types/youtube-player": "^5.5.7",
|
||||||
|
@ -190,8 +190,8 @@ devDependencies:
|
|||||||
specifier: ^9.0.1
|
specifier: ^9.0.1
|
||||||
version: 9.0.1
|
version: 9.0.1
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^18.17.1
|
specifier: ^18.17.2
|
||||||
version: 18.17.1
|
version: 18.17.2
|
||||||
'@types/react':
|
'@types/react':
|
||||||
specifier: ^18.2.18
|
specifier: ^18.2.18
|
||||||
version: 18.2.18
|
version: 18.2.18
|
||||||
@ -269,7 +269,7 @@ devDependencies:
|
|||||||
version: 4.9.5
|
version: 4.9.5
|
||||||
vite:
|
vite:
|
||||||
specifier: ^4.4.8
|
specifier: ^4.4.8
|
||||||
version: 4.4.8(@types/node@18.17.1)
|
version: 4.4.8(@types/node@18.17.2)
|
||||||
vite-plugin-top-level-await:
|
vite-plugin-top-level-await:
|
||||||
specifier: ^1.3.1
|
specifier: ^1.3.1
|
||||||
version: 1.3.1(vite@4.4.8)
|
version: 1.3.1(vite@4.4.8)
|
||||||
@ -2437,8 +2437,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==}
|
resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@types/node@18.17.1:
|
/@types/node@18.17.2:
|
||||||
resolution: {integrity: sha512-xlR1jahfizdplZYRU59JlUx9uzF1ARa8jbhM11ccpCJya8kvos5jwdm2ZAgxSCwOl0fq21svP18EVwPBXMQudw==}
|
resolution: {integrity: sha512-wBo3KqP/PBqje5TI9UTiuL3yWfP6sdPtjtygSOqcYZWT232dfDeDOnkDps5wqZBP9NgGgYrNejinl0faAuE+HQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@types/normalize-package-data@2.4.1:
|
/@types/normalize-package-data@2.4.1:
|
||||||
@ -2614,7 +2614,7 @@ packages:
|
|||||||
vite: ^4
|
vite: ^4
|
||||||
dependencies:
|
dependencies:
|
||||||
'@swc/core': 1.3.74
|
'@swc/core': 1.3.74
|
||||||
vite: 4.4.8(@types/node@18.17.1)
|
vite: 4.4.8(@types/node@18.17.2)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@swc/helpers'
|
- '@swc/helpers'
|
||||||
dev: true
|
dev: true
|
||||||
@ -2912,7 +2912,7 @@ packages:
|
|||||||
hasBin: true
|
hasBin: true
|
||||||
dependencies:
|
dependencies:
|
||||||
caniuse-lite: 1.0.30001519
|
caniuse-lite: 1.0.30001519
|
||||||
electron-to-chromium: 1.4.482
|
electron-to-chromium: 1.4.484
|
||||||
node-releases: 2.0.13
|
node-releases: 2.0.13
|
||||||
update-browserslist-db: 1.0.11(browserslist@4.21.10)
|
update-browserslist-db: 1.0.11(browserslist@4.21.10)
|
||||||
|
|
||||||
@ -3389,8 +3389,8 @@ packages:
|
|||||||
/eastasianwidth@0.2.0:
|
/eastasianwidth@0.2.0:
|
||||||
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
|
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
|
||||||
|
|
||||||
/electron-to-chromium@1.4.482:
|
/electron-to-chromium@1.4.484:
|
||||||
resolution: {integrity: sha512-h+UqpfmEr1Qkk0zp7ej/jid7CXoq4m4QzW6wNTb0ELJ/BZCpA4wgUylBIMGCe621tnr4l5VmoHjdoSx2lbnNJA==}
|
resolution: {integrity: sha512-nO3ZEomTK2PO/3TUXgEx0A97xZTpKVf4p427lABHuCpT1IQ2N+njVh29DkQkCk6Q4m2wjU+faK4xAcfFndwjvw==}
|
||||||
|
|
||||||
/emoji-regex@8.0.0:
|
/emoji-regex@8.0.0:
|
||||||
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
|
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
|
||||||
@ -6586,8 +6586,8 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
glob: 7.2.3
|
glob: 7.2.3
|
||||||
|
|
||||||
/rollup@3.27.0:
|
/rollup@3.27.1:
|
||||||
resolution: {integrity: sha512-aOltLCrYZ0FhJDm7fCqwTjIUEVjWjcydKBV/Zeid6Mn8BWgDCUBBWT5beM5ieForYNo/1ZHuGJdka26kvQ3Gzg==}
|
resolution: {integrity: sha512-tXNDFwOkN6C2w5Blj1g6ForKeFw6c1mDu5jxoeDO3/pmYjgt+8yvIFjKzH5FQUq70OKZBkOt0zzv0THXL7vwzQ==}
|
||||||
engines: {node: '>=14.18.0', npm: '>=8.0.0'}
|
engines: {node: '>=14.18.0', npm: '>=8.0.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
@ -7455,7 +7455,7 @@ packages:
|
|||||||
'@rollup/plugin-virtual': 3.0.1
|
'@rollup/plugin-virtual': 3.0.1
|
||||||
'@swc/core': 1.3.74
|
'@swc/core': 1.3.74
|
||||||
uuid: 9.0.0
|
uuid: 9.0.0
|
||||||
vite: 4.4.8(@types/node@18.17.1)
|
vite: 4.4.8(@types/node@18.17.2)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@swc/helpers'
|
- '@swc/helpers'
|
||||||
- rollup
|
- rollup
|
||||||
@ -7472,13 +7472,13 @@ packages:
|
|||||||
debug: 4.3.4
|
debug: 4.3.4
|
||||||
globrex: 0.1.2
|
globrex: 0.1.2
|
||||||
tsconfck: 2.1.2(typescript@4.9.5)
|
tsconfck: 2.1.2(typescript@4.9.5)
|
||||||
vite: 4.4.8(@types/node@18.17.1)
|
vite: 4.4.8(@types/node@18.17.2)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
- typescript
|
- typescript
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/vite@4.4.8(@types/node@18.17.1):
|
/vite@4.4.8(@types/node@18.17.2):
|
||||||
resolution: {integrity: sha512-LONawOUUjxQridNWGQlNizfKH89qPigK36XhMI7COMGztz8KNY0JHim7/xDd71CZwGT4HtSRgI7Hy+RlhG0Gvg==}
|
resolution: {integrity: sha512-LONawOUUjxQridNWGQlNizfKH89qPigK36XhMI7COMGztz8KNY0JHim7/xDd71CZwGT4HtSRgI7Hy+RlhG0Gvg==}
|
||||||
engines: {node: ^14.18.0 || >=16.0.0}
|
engines: {node: ^14.18.0 || >=16.0.0}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
@ -7506,10 +7506,10 @@ packages:
|
|||||||
terser:
|
terser:
|
||||||
optional: true
|
optional: true
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 18.17.1
|
'@types/node': 18.17.2
|
||||||
esbuild: 0.18.17
|
esbuild: 0.18.17
|
||||||
postcss: 8.4.27
|
postcss: 8.4.27
|
||||||
rollup: 3.27.0
|
rollup: 3.27.1
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
fsevents: 2.3.2
|
fsevents: 2.3.2
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -22,7 +22,7 @@ export function ThreadBlock({ params }: { params: Block }) {
|
|||||||
// useLiveThread(params.content);
|
// useLiveThread(params.content);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="scrollbar-hide w-[400px] shrink-0 overflow-y-auto bg-white/10 pb-20">
|
<div className="scrollbar-hide h-full w-[400px] shrink-0 overflow-y-auto bg-white/10 pb-20">
|
||||||
<TitleBar id={params.id} title={params.title} />
|
<TitleBar id={params.id} title={params.title} />
|
||||||
<div className="h-full">
|
<div className="h-full">
|
||||||
{status === 'loading' ? (
|
{status === 'loading' ? (
|
||||||
|
@ -45,7 +45,7 @@ export function UserBlock({ params }: { params: Block }) {
|
|||||||
<UserProfile pubkey={params.content} />
|
<UserProfile pubkey={params.content} />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h3 className="mt-2 px-3 text-lg font-semibold text-white">
|
<h3 className="mt-4 px-3 text-lg font-semibold text-white">
|
||||||
Latest activities
|
Latest activities
|
||||||
</h3>
|
</h3>
|
||||||
<div className="flex h-full w-full flex-col justify-between gap-1.5 pb-10">
|
<div className="flex h-full w-full flex-col justify-between gap-1.5 pb-10">
|
||||||
|
@ -12,7 +12,15 @@ import {
|
|||||||
|
|
||||||
import { Content } from '@utils/types';
|
import { Content } from '@utils/types';
|
||||||
|
|
||||||
export function NoteContent({ content }: { content: Content }) {
|
export function NoteContent({ content, long }: { content: Content; long?: boolean }) {
|
||||||
|
if (long) {
|
||||||
|
return (
|
||||||
|
<ReactMarkdown className="markdown" remarkPlugins={[remarkGfm]}>
|
||||||
|
{content as unknown as string}
|
||||||
|
</ReactMarkdown>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ReactMarkdown
|
<ReactMarkdown
|
||||||
|
@ -26,7 +26,7 @@ export function Repost({ event }: { event: LumeEvent }) {
|
|||||||
if (status === 'error') {
|
if (status === 'error') {
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-center overflow-hidden rounded-xl bg-white/10 px-3 py-3">
|
<div className="flex items-center justify-center overflow-hidden rounded-xl bg-white/10 px-3 py-3">
|
||||||
<p className="text-white/50">Failed to fetch</p>
|
<p className="text-white/50">Failed to fetch event: {repostID}</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ export function SubNote({ id, root }: { id: string; root?: string }) {
|
|||||||
if (status === 'error') {
|
if (status === 'error') {
|
||||||
return (
|
return (
|
||||||
<div className="mb-5 flex overflow-hidden rounded-xl bg-white/10 px-3 py-3">
|
<div className="mb-5 flex overflow-hidden rounded-xl bg-white/10 px-3 py-3">
|
||||||
<p className="text-white/50">Failed to fetch</p>
|
<p className="break-all text-white/50">Failed to fetch event: {id}</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ export function SubNote({ id, root }: { id: string; root?: string }) {
|
|||||||
<div className="relative z-20 -mt-6 flex items-start gap-3">
|
<div className="relative z-20 -mt-6 flex items-start gap-3">
|
||||||
<div className="w-11 shrink-0" />
|
<div className="w-11 shrink-0" />
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<NoteContent content={data.content} />
|
<NoteContent content={data.content} long={data.kind === 30023} />
|
||||||
<NoteActions id={data.event_id} pubkey={data.pubkey} root={root} />
|
<NoteActions id={data.event_id} pubkey={data.pubkey} root={root} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,6 +23,14 @@ export const MentionNote = memo(function MentionNote({ id }: { id: string }) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!id) {
|
||||||
|
return (
|
||||||
|
<div className="mb-2 mt-3 cursor-default rounded-lg bg-white/10 px-3 py-3">
|
||||||
|
<p className="break-all">Failed to fetch event: {id}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
onClick={(e) => openThread(e, id)}
|
onClick={(e) => openThread(e, id)}
|
||||||
@ -56,14 +64,14 @@ export const MentionNote = memo(function MentionNote({ id }: { id: string }) {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{data?.content?.parsed?.length > 160
|
{data?.content?.original?.length > 160
|
||||||
? data.content.parsed.substring(0, 160) + '...'
|
? data.content.original.substring(0, 160) + '...'
|
||||||
: data.content.parsed}
|
: data.content.original}
|
||||||
</ReactMarkdown>
|
</ReactMarkdown>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<p>Failed to fetch event</p>
|
<p className="break-all">Failed to fetch event: {id}</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -20,7 +20,11 @@ export function MentionUser({ pubkey }: { pubkey: string }) {
|
|||||||
}
|
}
|
||||||
className="break-words font-normal text-blue-400 no-underline hover:text-blue-500"
|
className="break-words font-normal text-blue-400 no-underline hover:text-blue-500"
|
||||||
>
|
>
|
||||||
{'@' + user?.name || user?.displayName || displayNpub(pubkey, 16)}
|
{user?.nip05 ||
|
||||||
|
user?.name ||
|
||||||
|
user?.display_name ||
|
||||||
|
user?.username ||
|
||||||
|
displayNpub(pubkey, 16)}
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ export function NoteMetadata({ id }: { id: string }) {
|
|||||||
|
|
||||||
return { replies, users, zap };
|
return { replies, users, zap };
|
||||||
},
|
},
|
||||||
{ refetchOnWindowFocus: false, refetchOnReconnect: false }
|
{ refetchOnWindowFocus: false, refetchOnReconnect: false, refetchOnMount: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
if (status === 'loading') {
|
if (status === 'loading') {
|
||||||
|
@ -43,7 +43,7 @@ export function RepliesList({ id }: { id: string }) {
|
|||||||
return (
|
return (
|
||||||
<div className="mt-3">
|
<div className="mt-3">
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<div className="rounded-xl border-t border-zinc-800/50 bg-zinc-900 px-3 py-3">
|
<div className="rounded-xl bg-white/10 px-3 py-3">
|
||||||
<NoteSkeleton />
|
<NoteSkeleton />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -93,7 +93,7 @@ export function User({
|
|||||||
</div>
|
</div>
|
||||||
<Popover.Portal>
|
<Popover.Portal>
|
||||||
<Popover.Content
|
<Popover.Content
|
||||||
className="w-[300px] overflow-hidden rounded-md bg-white/10 backdrop-blur-xl"
|
className="w-[300px] overflow-hidden rounded-md bg-white/10 backdrop-blur-xl focus:outline-none"
|
||||||
sideOffset={5}
|
sideOffset={5}
|
||||||
>
|
>
|
||||||
<div className="flex gap-2.5 border-b border-white/5 px-3 py-3">
|
<div className="flex gap-2.5 border-b border-white/5 px-3 py-3">
|
||||||
|
@ -102,12 +102,6 @@ export function UserProfile({ pubkey }: { pubkey: string }) {
|
|||||||
>
|
>
|
||||||
Message
|
Message
|
||||||
</Link>
|
</Link>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="group inline-flex h-10 w-10 items-center justify-center rounded-md bg-white/10 text-sm font-medium hover:bg-orange-500"
|
|
||||||
>
|
|
||||||
<ZapIcon className="h-5 w-5" />
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -8,47 +8,56 @@ import { LumeEvent } from '@utils/types';
|
|||||||
|
|
||||||
export function useEvent(id: string, fallback?: string) {
|
export function useEvent(id: string, fallback?: string) {
|
||||||
const { ndk } = useNDK();
|
const { ndk } = useNDK();
|
||||||
const { status, data, error, isFetching } = useQuery(['note', id], async () => {
|
const { status, data, error, isFetching } = useQuery(
|
||||||
const result = await getNoteByID(id);
|
['note', id],
|
||||||
if (result) {
|
async () => {
|
||||||
return result as LumeEvent;
|
const result = await getNoteByID(id);
|
||||||
} else {
|
if (result) {
|
||||||
if (fallback) {
|
return result as LumeEvent;
|
||||||
const embed: LumeEvent = JSON.parse(fallback);
|
|
||||||
embed['event_id'] = embed.id;
|
|
||||||
await createNote(
|
|
||||||
embed.id,
|
|
||||||
embed.pubkey,
|
|
||||||
embed.kind,
|
|
||||||
embed.tags,
|
|
||||||
embed.content as unknown as string,
|
|
||||||
embed.created_at
|
|
||||||
);
|
|
||||||
return embed;
|
|
||||||
} else {
|
} else {
|
||||||
const event = await ndk.fetchEvent(id);
|
if (fallback) {
|
||||||
if (event) {
|
const embed: LumeEvent = JSON.parse(fallback);
|
||||||
|
embed['event_id'] = embed.id;
|
||||||
await createNote(
|
await createNote(
|
||||||
event.id,
|
embed.id,
|
||||||
event.pubkey,
|
embed.pubkey,
|
||||||
event.kind,
|
embed.kind,
|
||||||
event.tags,
|
embed.tags,
|
||||||
event.content,
|
embed.content as unknown as string,
|
||||||
event.created_at
|
embed.created_at
|
||||||
);
|
);
|
||||||
event['event_id'] = event.id;
|
return embed;
|
||||||
if (event.kind === 1) {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore
|
|
||||||
event['content'] = parser(event);
|
|
||||||
}
|
|
||||||
return event as unknown as LumeEvent;
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Event not found');
|
const event = await ndk.fetchEvent(id);
|
||||||
|
if (event) {
|
||||||
|
await createNote(
|
||||||
|
event.id,
|
||||||
|
event.pubkey,
|
||||||
|
event.kind,
|
||||||
|
event.tags,
|
||||||
|
event.content,
|
||||||
|
event.created_at
|
||||||
|
);
|
||||||
|
event['event_id'] = event.id;
|
||||||
|
if (event.kind === 1) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
event['content'] = parser(event);
|
||||||
|
}
|
||||||
|
return event as unknown as LumeEvent;
|
||||||
|
} else {
|
||||||
|
throw new Error('Event not found');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
staleTime: Infinity,
|
||||||
|
refetchOnMount: false,
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
|
refetchOnReconnect: false,
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
return { status, data, error, isFetching };
|
return { status, data, error, isFetching };
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { NDKFilter } from '@nostr-dev-kit/ndk';
|
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
|
|
||||||
import { useNDK } from '@libs/ndk/provider';
|
import { useNDK } from '@libs/ndk/provider';
|
||||||
@ -15,12 +14,12 @@ export function useProfile(pubkey: string, fallback?: string) {
|
|||||||
['user', pubkey],
|
['user', pubkey],
|
||||||
async () => {
|
async () => {
|
||||||
if (!fallback) {
|
if (!fallback) {
|
||||||
const filter: NDKFilter = { kinds: [0], authors: [pubkey] };
|
const user = await ndk.getUser({ hexpubkey: pubkey });
|
||||||
const events = await ndk.fetchEvents(filter);
|
await user.fetchProfile();
|
||||||
const latest = [...events].sort((a, b) => b.created_at - a.created_at).pop();
|
if (user.profile) {
|
||||||
if (latest) {
|
user.profile.display_name = user.profile.displayName;
|
||||||
await createMetadata(latest.id, latest.pubkey, latest.content);
|
await createMetadata(user.npub, pubkey, JSON.stringify(user.profile));
|
||||||
return JSON.parse(latest.content);
|
return user.profile;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('User not found');
|
throw new Error('User not found');
|
||||||
}
|
}
|
||||||
@ -30,6 +29,7 @@ export function useProfile(pubkey: string, fallback?: string) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
staleTime: Infinity,
|
||||||
refetchOnMount: false,
|
refetchOnMount: false,
|
||||||
refetchOnWindowFocus: false,
|
refetchOnWindowFocus: false,
|
||||||
refetchOnReconnect: false,
|
refetchOnReconnect: false,
|
||||||
|
@ -5,6 +5,8 @@ import ReactPlayer from 'react-player';
|
|||||||
import { Content, LumeEvent } from '@utils/types';
|
import { Content, LumeEvent } from '@utils/types';
|
||||||
|
|
||||||
export function parser(event: LumeEvent) {
|
export function parser(event: LumeEvent) {
|
||||||
|
if (event.kind !== 1) return;
|
||||||
|
|
||||||
const references = parseReferences(event as unknown as Event);
|
const references = parseReferences(event as unknown as Event);
|
||||||
const urls = getUrls(event.content as unknown as string);
|
const urls = getUrls(event.content as unknown as string);
|
||||||
|
|
||||||
@ -49,6 +51,7 @@ export function parser(event: LumeEvent) {
|
|||||||
references?.forEach((item) => {
|
references?.forEach((item) => {
|
||||||
const profile = item.profile;
|
const profile = item.profile;
|
||||||
const event = item.event;
|
const event = item.event;
|
||||||
|
const addr = item.address;
|
||||||
if (event) {
|
if (event) {
|
||||||
content.notes.push(event.id);
|
content.notes.push(event.id);
|
||||||
content.parsed = content.parsed.replace(item.text, '');
|
content.parsed = content.parsed.replace(item.text, '');
|
||||||
@ -56,6 +59,10 @@ export function parser(event: LumeEvent) {
|
|||||||
if (profile) {
|
if (profile) {
|
||||||
content.parsed = content.parsed.replace(item.text, `~pub${item.profile.pubkey}~`);
|
content.parsed = content.parsed.replace(item.text, `~pub${item.profile.pubkey}~`);
|
||||||
}
|
}
|
||||||
|
if (addr) {
|
||||||
|
content.notes.push(addr.identifier);
|
||||||
|
content.parsed = content.parsed.replace(item.text, '');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return content;
|
return content;
|
||||||
|
Loading…
Reference in New Issue
Block a user