mirror of
https://github.com/lumehq/lume.git
synced 2025-09-19 02:02:03 +02:00
fixed remain errors
This commit is contained in:
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() {
|
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 { createPleb } from '@utils/storage';
|
||||||
|
|
||||||
import useLocalStorage from '@rehooks/local-storage';
|
import useLocalStorage from '@rehooks/local-storage';
|
||||||
import { fetch } from '@tauri-apps/api/http';
|
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) => {
|
export const fetchProfileMetadata = async (pubkey: string) => {
|
||||||
const result = await fetch(`https://rbr.bio/${pubkey}/metadata.json`, {
|
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) => {
|
export const useProfileMetadata = (pubkey: string) => {
|
||||||
|
const [pool, relays]: any = useContext(RelayContext);
|
||||||
const [activeAccount]: any = useLocalStorage('account', {});
|
const [activeAccount]: any = useLocalStorage('account', {});
|
||||||
const [plebs] = useLocalStorage('plebs', []);
|
const [plebs] = useLocalStorage('plebs', []);
|
||||||
const [profile, setProfile] = useState(null);
|
const [profile, setProfile] = useState(null);
|
||||||
@@ -37,11 +40,16 @@ export const useProfileMetadata = (pubkey: string) => {
|
|||||||
return createPleb(pubkey, metadata);
|
return createPleb(pubkey, metadata);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const fetchProfileFromRelays = useCallback(async (pubkey: string) => {
|
||||||
|
const result = await pool.fetchAndCacheMetadata(pubkey, relays);
|
||||||
|
return result;
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let ignore = false;
|
let ignore = false;
|
||||||
|
|
||||||
if (!cacheProfile && !ignore) {
|
if (!cacheProfile && !ignore) {
|
||||||
fetchProfileMetadata(pubkey)
|
fetchProfileFromRelays(pubkey)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
// update state
|
// update state
|
||||||
setProfile(JSON.parse(res.content));
|
setProfile(JSON.parse(res.content));
|
||||||
|
@@ -38,13 +38,13 @@ export const contentParser = (noteContent, noteTags) => {
|
|||||||
));
|
));
|
||||||
// handle mentions
|
// handle mentions
|
||||||
if (tags && tags.length > 0) {
|
if (tags && tags.length > 0) {
|
||||||
parsedContent = reactStringReplace(parsedContent, /\#\[(\d+)\]/gm, (match) => {
|
parsedContent = reactStringReplace(parsedContent, /\#\[(\d+)\]/gm, (match, i) => {
|
||||||
if (tags[match][0] === 'p') {
|
if (tags[match][0] === 'p') {
|
||||||
// @-mentions
|
// @-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') {
|
} else if (tags[match][0] === 'e') {
|
||||||
// note-quotes
|
// note-quotes
|
||||||
return <NoteQuote key={tags[match][1]} id={tags[match][1]} />;
|
return <NoteQuote key={tags[match][1] + i} id={tags[match][1]} />;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user