mirror of
https://github.com/lumehq/lume.git
synced 2025-09-26 21:46:21 +02:00
temporary fix redirect issue in nextjs export
This commit is contained in:
@@ -68,7 +68,7 @@ export default function Page() {
|
|||||||
// broadcast
|
// broadcast
|
||||||
pool.publish(event, relays);
|
pool.publish(event, relays);
|
||||||
// redirect to next step
|
// redirect to next step
|
||||||
router.push(`/onboarding/create/step-2?pubkey=${pubkey}&privkey=${privkey}`);
|
router.push(`/onboarding/create/step-2?pubkey=${pubkey}&privkey=${privkey}`, { forceOptimisticNavigation: true });
|
||||||
}, [pool, pubkey, privkey, metadata, relays, router]);
|
}, [pool, pubkey, privkey, metadata, relays, router]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@@ -40,7 +40,7 @@ export default function Page() {
|
|||||||
privkey = nip19.decode(privkey).data;
|
privkey = nip19.decode(privkey).data;
|
||||||
}
|
}
|
||||||
if (typeof getPublicKey(privkey) === 'string') {
|
if (typeof getPublicKey(privkey) === 'string') {
|
||||||
router.push(`/onboarding/login/step-2?privkey=${privkey}`);
|
router.push(`/onboarding/login/step-2?privkey=${privkey}`, { forceOptimisticNavigation: true });
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setError('key', {
|
setError('key', {
|
||||||
|
@@ -125,7 +125,9 @@ export default function Page() {
|
|||||||
undefined,
|
undefined,
|
||||||
() => {
|
() => {
|
||||||
updateLastLogin(dateToUnix(now.current));
|
updateLastLogin(dateToUnix(now.current));
|
||||||
timeout.current = setTimeout(() => router.replace('/nostr/newsfeed/following'), 5000);
|
timeout.current = setTimeout(() => {
|
||||||
|
router.replace('/nostr/newsfeed/following', { forceOptimisticNavigation: true });
|
||||||
|
}, 5000);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unsubscribeOnEose: true,
|
unsubscribeOnEose: true,
|
||||||
@@ -160,7 +162,7 @@ export default function Page() {
|
|||||||
// fetch data
|
// fetch data
|
||||||
fetchData(account, account.follows);
|
fetchData(account, account.follows);
|
||||||
} else {
|
} else {
|
||||||
router.replace('/onboarding');
|
router.replace('/onboarding', { forceOptimisticNavigation: true });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
|
@@ -1,17 +1,18 @@
|
|||||||
import { ActiveLink } from '@components/activeLink';
|
|
||||||
import { ImageWithFallback } from '@components/imageWithFallback';
|
import { ImageWithFallback } from '@components/imageWithFallback';
|
||||||
|
|
||||||
import { DEFAULT_AVATAR } from '@stores/constants';
|
import { DEFAULT_AVATAR } from '@stores/constants';
|
||||||
|
|
||||||
import { useChannelMetadata } from '@utils/hooks/useChannelMetadata';
|
import { useChannelMetadata } from '@utils/hooks/useChannelMetadata';
|
||||||
|
|
||||||
|
import Link from 'next/link';
|
||||||
|
|
||||||
export const ChannelListItem = ({ data }: { data: any }) => {
|
export const ChannelListItem = ({ data }: { data: any }) => {
|
||||||
const channel = useChannelMetadata(data.event_id, data.metadata);
|
const channel = useChannelMetadata(data.event_id, data.metadata);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ActiveLink
|
<Link
|
||||||
|
prefetch={false}
|
||||||
href={`/nostr/channel?channel-id=${data.event_id}`}
|
href={`/nostr/channel?channel-id=${data.event_id}`}
|
||||||
activeClassName="dark:bg-zinc-900 dark:text-zinc-100 hover:dark:bg-zinc-800"
|
|
||||||
className="inline-flex items-center gap-2 rounded-md px-2.5 py-1.5 hover:bg-zinc-900"
|
className="inline-flex items-center gap-2 rounded-md px-2.5 py-1.5 hover:bg-zinc-900"
|
||||||
>
|
>
|
||||||
<div className="relative h-5 w-5 shrink-0 overflow-hidden rounded">
|
<div className="relative h-5 w-5 shrink-0 overflow-hidden rounded">
|
||||||
@@ -25,6 +26,6 @@ export const ChannelListItem = ({ data }: { data: any }) => {
|
|||||||
<div>
|
<div>
|
||||||
<h5 className="truncate text-sm font-medium text-zinc-400">{channel?.name.toLowerCase()}</h5>
|
<h5 className="truncate text-sm font-medium text-zinc-400">{channel?.name.toLowerCase()}</h5>
|
||||||
</div>
|
</div>
|
||||||
</ActiveLink>
|
</Link>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@@ -7,30 +7,35 @@ import { DEFAULT_AVATAR } from '@stores/constants';
|
|||||||
import { getChats } from '@utils/storage';
|
import { getChats } from '@utils/storage';
|
||||||
|
|
||||||
import useLocalStorage from '@rehooks/local-storage';
|
import useLocalStorage from '@rehooks/local-storage';
|
||||||
import { useRouter } from 'next/navigation';
|
import Link from 'next/link';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
export default function ChatList() {
|
export default function ChatList() {
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const [list, setList] = useState([]);
|
const [list, setList] = useState([]);
|
||||||
const [activeAccount]: any = useLocalStorage('account', {});
|
const [activeAccount]: any = useLocalStorage('account', {});
|
||||||
const profile = JSON.parse(activeAccount.metadata);
|
const profile = JSON.parse(activeAccount.metadata);
|
||||||
|
|
||||||
const openSelfChat = () => {
|
|
||||||
router.push(`/nostr/chat?pubkey=${activeAccount.pubkey}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
let ignore = false;
|
||||||
|
|
||||||
getChats(activeAccount.id)
|
getChats(activeAccount.id)
|
||||||
.then((res: any) => setList(res))
|
.then((res: any) => {
|
||||||
|
if (!ignore) {
|
||||||
|
setList(res);
|
||||||
|
}
|
||||||
|
})
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
ignore = true;
|
||||||
|
};
|
||||||
}, [activeAccount.id]);
|
}, [activeAccount.id]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-px">
|
<div className="flex flex-col gap-px">
|
||||||
<div
|
<Link
|
||||||
onClick={() => openSelfChat()}
|
prefetch={false}
|
||||||
|
href={`/nostr/chat?pubkey=${activeAccount.pubkey}`}
|
||||||
className="inline-flex items-center gap-2 rounded-md px-2.5 py-1.5 hover:bg-zinc-900"
|
className="inline-flex items-center gap-2 rounded-md px-2.5 py-1.5 hover:bg-zinc-900"
|
||||||
>
|
>
|
||||||
<div className="relative h-5 w-5 shrink overflow-hidden rounded bg-white">
|
<div className="relative h-5 w-5 shrink overflow-hidden rounded bg-white">
|
||||||
@@ -46,7 +51,7 @@ export default function ChatList() {
|
|||||||
{profile?.display_name || profile?.name} <span className="text-zinc-500">(you)</span>
|
{profile?.display_name || profile?.name} <span className="text-zinc-500">(you)</span>
|
||||||
</h5>
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Link>
|
||||||
{list.map((item) => (
|
{list.map((item) => (
|
||||||
<ChatListItem key={item.id} pubkey={item.pubkey} />
|
<ChatListItem key={item.id} pubkey={item.pubkey} />
|
||||||
))}
|
))}
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import { ActiveLink } from '@components/activeLink';
|
|
||||||
import { ImageWithFallback } from '@components/imageWithFallback';
|
import { ImageWithFallback } from '@components/imageWithFallback';
|
||||||
|
|
||||||
import { DEFAULT_AVATAR } from '@stores/constants';
|
import { DEFAULT_AVATAR } from '@stores/constants';
|
||||||
@@ -6,13 +5,15 @@ import { DEFAULT_AVATAR } from '@stores/constants';
|
|||||||
import { useProfileMetadata } from '@utils/hooks/useProfileMetadata';
|
import { useProfileMetadata } from '@utils/hooks/useProfileMetadata';
|
||||||
import { shortenKey } from '@utils/shortenKey';
|
import { shortenKey } from '@utils/shortenKey';
|
||||||
|
|
||||||
|
import Link from 'next/link';
|
||||||
|
|
||||||
export const ChatListItem = ({ pubkey }: { pubkey: string }) => {
|
export const ChatListItem = ({ pubkey }: { pubkey: string }) => {
|
||||||
const profile = useProfileMetadata(pubkey);
|
const profile = useProfileMetadata(pubkey);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ActiveLink
|
<Link
|
||||||
|
prefetch={false}
|
||||||
href={`/nostr/chat?pubkey=${pubkey}`}
|
href={`/nostr/chat?pubkey=${pubkey}`}
|
||||||
activeClassName="dark:bg-zinc-900 dark:text-zinc-100 hover:dark:bg-zinc-800"
|
|
||||||
className="inline-flex items-center gap-2 rounded-md px-2.5 py-1.5 hover:bg-zinc-900"
|
className="inline-flex items-center gap-2 rounded-md px-2.5 py-1.5 hover:bg-zinc-900"
|
||||||
>
|
>
|
||||||
<div className="relative h-5 w-5 shrink overflow-hidden rounded">
|
<div className="relative h-5 w-5 shrink overflow-hidden rounded">
|
||||||
@@ -28,6 +29,6 @@ export const ChatListItem = ({ pubkey }: { pubkey: string }) => {
|
|||||||
{profile?.display_name || profile?.name || shortenKey(pubkey)}
|
{profile?.display_name || profile?.name || shortenKey(pubkey)}
|
||||||
</h5>
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
</ActiveLink>
|
</Link>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@@ -11,7 +11,7 @@ export const ChatModal = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getPlebs()
|
getPlebs()
|
||||||
.then((res) => setPlebs(res))
|
.then((res: any) => setPlebs(res))
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ export const ChatModal = () => {
|
|||||||
<Dialog.Root>
|
<Dialog.Root>
|
||||||
<Dialog.Trigger asChild>
|
<Dialog.Trigger asChild>
|
||||||
<div className="group inline-flex items-center gap-2 rounded-md px-2.5 py-1.5 hover:bg-zinc-900">
|
<div className="group inline-flex items-center gap-2 rounded-md px-2.5 py-1.5 hover:bg-zinc-900">
|
||||||
<div className="group-hover:800 inline-flex h-5 w-5 shrink items-center justify-center rounded bg-zinc-900">
|
<div className="group-hover:800 inline-flex h-5 w-5 shrink items-center justify-center rounded bg-zinc-900 group-hover:bg-zinc-800">
|
||||||
<Plus width={12} height={12} className="text-zinc-500" />
|
<Plus width={12} height={12} className="text-zinc-500" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@@ -11,7 +11,7 @@ export const ChatModalUser = ({ data }: { data: any }) => {
|
|||||||
const profile = JSON.parse(data.metadata);
|
const profile = JSON.parse(data.metadata);
|
||||||
|
|
||||||
const openNewChat = () => {
|
const openNewChat = () => {
|
||||||
router.push(`/chats/${data.pubkey}`);
|
router.push(`/nostr/chat?pubkey=${data.pubkey}`, { forceOptimisticNavigation: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@@ -14,7 +14,7 @@ export const ActiveAccount = ({ user }: { user: any }) => {
|
|||||||
const userData = JSON.parse(user.metadata);
|
const userData = JSON.parse(user.metadata);
|
||||||
|
|
||||||
const openProfilePage = () => {
|
const openProfilePage = () => {
|
||||||
router.push(`/nostr/users/${user.pubkey}`);
|
router.push(`/nostr/user?pubkey=${user.pubkey}`, { forceOptimisticNavigation: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
const copyPublicKey = async () => {
|
const copyPublicKey = async () => {
|
||||||
|
@@ -22,13 +22,13 @@ export const NoteBase = memo(function NoteBase({ event }: { event: any }) {
|
|||||||
|
|
||||||
const openUserPage = (e) => {
|
const openUserPage = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
router.push(`/nostr/user?pubkey=${event.pubkey}`);
|
router.push(`/nostr/user?pubkey=${event.pubkey}`, { forceOptimisticNavigation: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
const openThread = (e) => {
|
const openThread = (e) => {
|
||||||
const selection = window.getSelection();
|
const selection = window.getSelection();
|
||||||
if (selection.toString().length === 0) {
|
if (selection.toString().length === 0) {
|
||||||
router.push(`/nostr/newsfeed/note?id=${event.parent_id}`);
|
router.push(`/nostr/newsfeed/note?id=${event.parent_id}`, { forceOptimisticNavigation: true });
|
||||||
} else {
|
} else {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,7 @@ export const NoteComment = ({
|
|||||||
const profile = activeAccount.metadata ? JSON.parse(activeAccount.metadata) : null;
|
const profile = activeAccount.metadata ? JSON.parse(activeAccount.metadata) : null;
|
||||||
|
|
||||||
const openThread = () => {
|
const openThread = () => {
|
||||||
router.push(`/nostr/newsfeed/${eventID}`);
|
router.push(`/nostr/newsfeed/note?id=${eventID}`, { forceOptimisticNavigation: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
const submitEvent = () => {
|
const submitEvent = () => {
|
||||||
|
@@ -16,13 +16,13 @@ export const RootNote = memo(function RootNote({ event }: { event: any }) {
|
|||||||
|
|
||||||
const openUserPage = (e) => {
|
const openUserPage = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
router.push(`/nostr/user?pubkey=${event.pubkey}`);
|
router.push(`/nostr/user?pubkey=${event.pubkey}`, { forceOptimisticNavigation: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
const openThread = (e) => {
|
const openThread = (e) => {
|
||||||
const selection = window.getSelection();
|
const selection = window.getSelection();
|
||||||
if (selection.toString().length === 0) {
|
if (selection.toString().length === 0) {
|
||||||
router.push(`/nostr/newsfeed/note?id=${event.parent_id}`);
|
router.push(`/nostr/newsfeed/note?id=${event.parent_id}`, { forceOptimisticNavigation: true });
|
||||||
} else {
|
} else {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user