mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-18 11:13:30 +00:00
fixed remain errors
This commit is contained in:
parent
2d9689967d
commit
ac6fb3cb55
9
src/pages/create-channel/index.page.tsx
Normal file
9
src/pages/create-channel/index.page.tsx
Normal file
@ -0,0 +1,9 @@
|
||||
import NewsfeedLayout from '@components/layouts/newsfeed';
|
||||
|
||||
export function Page() {
|
||||
return (
|
||||
<NewsfeedLayout>
|
||||
<h1>TODO</h1>
|
||||
</NewsfeedLayout>
|
||||
);
|
||||
}
|
@ -1,3 +1,11 @@
|
||||
import NewsfeedLayout from '@components/layouts/newsfeed';
|
||||
|
||||
export function Page() {
|
||||
return <></>;
|
||||
return (
|
||||
<NewsfeedLayout>
|
||||
<div className="flex h-full w-full items-center justify-center">
|
||||
<p className="text-sm text-zinc-400">Sorry, this feature under development, it will come in the next version</p>
|
||||
</div>
|
||||
</NewsfeedLayout>
|
||||
);
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { createPleb } from '@utils/storage';
|
||||
|
||||
import useLocalStorage from '@rehooks/local-storage';
|
||||
import { fetch } from '@tauri-apps/api/http';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
||||
|
||||
export const fetchProfileMetadata = async (pubkey: string) => {
|
||||
const result = await fetch(`https://rbr.bio/${pubkey}/metadata.json`, {
|
||||
@ -13,6 +15,7 @@ export const fetchProfileMetadata = async (pubkey: string) => {
|
||||
};
|
||||
|
||||
export const useProfileMetadata = (pubkey: string) => {
|
||||
const [pool, relays]: any = useContext(RelayContext);
|
||||
const [activeAccount]: any = useLocalStorage('account', {});
|
||||
const [plebs] = useLocalStorage('plebs', []);
|
||||
const [profile, setProfile] = useState(null);
|
||||
@ -37,11 +40,16 @@ export const useProfileMetadata = (pubkey: string) => {
|
||||
return createPleb(pubkey, metadata);
|
||||
}, []);
|
||||
|
||||
const fetchProfileFromRelays = useCallback(async (pubkey: string) => {
|
||||
const result = await pool.fetchAndCacheMetadata(pubkey, relays);
|
||||
return result;
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let ignore = false;
|
||||
|
||||
if (!cacheProfile && !ignore) {
|
||||
fetchProfileMetadata(pubkey)
|
||||
fetchProfileFromRelays(pubkey)
|
||||
.then((res: any) => {
|
||||
// update state
|
||||
setProfile(JSON.parse(res.content));
|
||||
|
@ -38,13 +38,13 @@ export const contentParser = (noteContent, noteTags) => {
|
||||
));
|
||||
// handle mentions
|
||||
if (tags && tags.length > 0) {
|
||||
parsedContent = reactStringReplace(parsedContent, /\#\[(\d+)\]/gm, (match) => {
|
||||
parsedContent = reactStringReplace(parsedContent, /\#\[(\d+)\]/gm, (match, i) => {
|
||||
if (tags[match][0] === 'p') {
|
||||
// @-mentions
|
||||
return <UserMention key={tags[match][1]} pubkey={tags[match][1]} />;
|
||||
return <UserMention key={tags[match][1] + i} pubkey={tags[match][1]} />;
|
||||
} else if (tags[match][0] === 'e') {
|
||||
// note-quotes
|
||||
return <NoteQuote key={tags[match][1]} id={tags[match][1]} />;
|
||||
return <NoteQuote key={tags[match][1] + i} id={tags[match][1]} />;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user