mirror of
https://github.com/lumehq/lume.git
synced 2025-09-20 11:00:37 +02:00
disabled prefetch in link component and other fixes
This commit is contained in:
@@ -167,7 +167,7 @@ export default function Page({ params }: { params: { slug: string } }) {
|
|||||||
></path>
|
></path>
|
||||||
</svg>
|
</svg>
|
||||||
) : (
|
) : (
|
||||||
<span className="drop-shadow-lg">Done →</span>
|
<span className="drop-shadow-lg">Done! Go to newsfeed</span>
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -10,16 +10,14 @@ import { createAccount, createPleb, updateAccount } from '@utils/storage';
|
|||||||
import { nip02ToArray } from '@utils/transform';
|
import { nip02ToArray } from '@utils/transform';
|
||||||
|
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { useRouter } from 'next/navigation';
|
import Link from 'next/link';
|
||||||
import { getPublicKey } from 'nostr-tools';
|
import { getPublicKey } from 'nostr-tools';
|
||||||
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
|
|
||||||
export default function Page({ params }: { params: { privkey: string } }) {
|
export default function Page({ params }: { params: { privkey: string } }) {
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const [pool, relays]: any = useContext(RelayContext);
|
const [pool, relays]: any = useContext(RelayContext);
|
||||||
const pubkey = useMemo(() => (params.privkey ? getPublicKey(params.privkey) : null), [params.privkey]);
|
const pubkey = useMemo(() => (params.privkey ? getPublicKey(params.privkey) : null), [params.privkey]);
|
||||||
const eose = useRef(0);
|
const timeout = useRef(null);
|
||||||
|
|
||||||
const [profile, setProfile] = useState({ metadata: null });
|
const [profile, setProfile] = useState({ metadata: null });
|
||||||
const [done, setDone] = useState(false);
|
const [done, setDone] = useState(false);
|
||||||
@@ -60,7 +58,7 @@ export default function Page({ params }: { params: { privkey: string } }) {
|
|||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
() => {
|
() => {
|
||||||
setDone(true);
|
timeout.current = setTimeout(() => setDone(true), 5000);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unsubscribeOnEose: true,
|
unsubscribeOnEose: true,
|
||||||
@@ -70,14 +68,10 @@ export default function Page({ params }: { params: { privkey: string } }) {
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
unsubscribe;
|
unsubscribe;
|
||||||
|
clearTimeout(timeout.current);
|
||||||
};
|
};
|
||||||
}, [pool, relays, pubkey, params.privkey, createPlebs]);
|
}, [pool, relays, pubkey, params.privkey, createPlebs]);
|
||||||
|
|
||||||
// submit then redirect to home
|
|
||||||
const submit = () => {
|
|
||||||
router.replace('/');
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="grid h-full w-full grid-rows-5">
|
<div className="grid h-full w-full grid-rows-5">
|
||||||
<div className="row-span-1 flex items-center justify-center">
|
<div className="row-span-1 flex items-center justify-center">
|
||||||
@@ -131,12 +125,13 @@ export default function Page({ params }: { params: { privkey: string } }) {
|
|||||||
></path>
|
></path>
|
||||||
</svg>
|
</svg>
|
||||||
) : (
|
) : (
|
||||||
<button
|
<Link
|
||||||
onClick={() => submit()}
|
prefetch={false}
|
||||||
|
href="/"
|
||||||
className="inline-flex w-full transform items-center justify-center rounded-lg bg-gradient-to-r from-fuchsia-300 via-orange-100 to-amber-300 px-3.5 py-2.5 font-medium text-zinc-800 active:translate-y-1 disabled:cursor-not-allowed disabled:opacity-30"
|
className="inline-flex w-full transform items-center justify-center rounded-lg bg-gradient-to-r from-fuchsia-300 via-orange-100 to-amber-300 px-3.5 py-2.5 font-medium text-zinc-800 active:translate-y-1 disabled:cursor-not-allowed disabled:opacity-30"
|
||||||
>
|
>
|
||||||
<span className="drop-shadow-lg">Done →</span>
|
<span className="drop-shadow-lg">Done! Go to newsfeed</span>
|
||||||
</button>
|
</Link>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -108,6 +108,7 @@ export default function Page() {
|
|||||||
</h1>
|
</h1>
|
||||||
<div className="mt-4 flex flex-col items-center gap-1.5">
|
<div className="mt-4 flex flex-col items-center gap-1.5">
|
||||||
<Link
|
<Link
|
||||||
|
prefetch={false}
|
||||||
href="/onboarding/create"
|
href="/onboarding/create"
|
||||||
className="relative inline-flex h-14 w-64 items-center justify-center gap-2 rounded-full bg-zinc-900 px-6 text-lg font-medium ring-1 ring-zinc-800 hover:bg-zinc-800"
|
className="relative inline-flex h-14 w-64 items-center justify-center gap-2 rounded-full bg-zinc-900 px-6 text-lg font-medium ring-1 ring-zinc-800 hover:bg-zinc-800"
|
||||||
>
|
>
|
||||||
@@ -115,6 +116,7 @@ export default function Page() {
|
|||||||
<ArrowRight width={20} height={20} />
|
<ArrowRight width={20} height={20} />
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
<Link
|
||||||
|
prefetch={false}
|
||||||
href="/onboarding/login"
|
href="/onboarding/login"
|
||||||
className="inline-flex h-14 w-64 items-center justify-center gap-2 rounded-full px-6 text-base font-medium text-zinc-300 hover:bg-zinc-800"
|
className="inline-flex h-14 w-64 items-center justify-center gap-2 rounded-full px-6 text-base font-medium text-zinc-300 hover:bg-zinc-800"
|
||||||
>
|
>
|
||||||
|
@@ -27,7 +27,7 @@ export default function Page() {
|
|||||||
const [lastLogin] = useLocalStorage('lastLogin', new Date());
|
const [lastLogin] = useLocalStorage('lastLogin', new Date());
|
||||||
|
|
||||||
const now = useRef(new Date());
|
const now = useRef(new Date());
|
||||||
const eose = useRef(0);
|
const timeout = useRef(null);
|
||||||
const unsubscribe = useRef(null);
|
const unsubscribe = useRef(null);
|
||||||
|
|
||||||
const fetchData = useCallback(
|
const fetchData = useCallback(
|
||||||
@@ -119,7 +119,7 @@ export default function Page() {
|
|||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
() => {
|
() => {
|
||||||
router.replace('/nostr/newsfeed/following');
|
timeout.current = setTimeout(() => router.replace('/nostr/newsfeed/following'), 5000);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unsubscribeOnEose: true,
|
unsubscribeOnEose: true,
|
||||||
@@ -157,6 +157,7 @@ export default function Page() {
|
|||||||
if (unsubscribe.current) {
|
if (unsubscribe.current) {
|
||||||
unsubscribe.current();
|
unsubscribe.current();
|
||||||
}
|
}
|
||||||
|
clearTimeout(timeout.current);
|
||||||
};
|
};
|
||||||
}, [fetchData, router]);
|
}, [fetchData, router]);
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@ export const ActiveLink = ({
|
|||||||
const isActive = href.includes(segments[1]);
|
const isActive = href.includes(segments[1]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link href={href} className={`${className}` + ' ' + (isActive ? `${activeClassName}` : '')}>
|
<Link prefetch={false} href={href} className={`${className}` + ' ' + (isActive ? `${activeClassName}` : '')}>
|
||||||
{children}
|
{children}
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
|
@@ -39,6 +39,7 @@ export default function MultiAccounts() {
|
|||||||
<div className="flex h-full flex-col items-center justify-between px-2 pb-4 pt-3">
|
<div className="flex h-full flex-col items-center justify-between px-2 pb-4 pt-3">
|
||||||
<div className="flex flex-col gap-4">
|
<div className="flex flex-col gap-4">
|
||||||
<Link
|
<Link
|
||||||
|
prefetch={false}
|
||||||
href="/explore"
|
href="/explore"
|
||||||
className="group relative flex h-11 w-11 shrink cursor-pointer items-center justify-center rounded-lg bg-zinc-900 hover:bg-zinc-800"
|
className="group relative flex h-11 w-11 shrink cursor-pointer items-center justify-center rounded-lg bg-zinc-900 hover:bg-zinc-800"
|
||||||
>
|
>
|
||||||
@@ -46,6 +47,7 @@ export default function MultiAccounts() {
|
|||||||
</Link>
|
</Link>
|
||||||
<div>{users.map((user) => renderAccount(user))}</div>
|
<div>{users.map((user) => renderAccount(user))}</div>
|
||||||
<Link
|
<Link
|
||||||
|
prefetch={false}
|
||||||
href="/onboarding"
|
href="/onboarding"
|
||||||
className="group relative flex h-11 w-11 shrink cursor-pointer items-center justify-center rounded-lg border-2 border-dashed border-zinc-600 hover:border-zinc-400"
|
className="group relative flex h-11 w-11 shrink cursor-pointer items-center justify-center rounded-lg border-2 border-dashed border-zinc-600 hover:border-zinc-400"
|
||||||
>
|
>
|
||||||
|
Reference in New Issue
Block a user