mirror of
https://github.com/lumehq/lume.git
synced 2025-04-07 03:18:12 +02:00
small fixes
This commit is contained in:
parent
a1fa777f8c
commit
10036500cb
13
src/app.tsx
13
src/app.tsx
@ -1,3 +1,4 @@
|
||||
import { message } from '@tauri-apps/api/dialog';
|
||||
import { RouterProvider, createBrowserRouter, redirect } from 'react-router-dom';
|
||||
|
||||
import { AuthCreateScreen } from '@app/auth/create';
|
||||
@ -19,18 +20,20 @@ import './index.css';
|
||||
async function Loader() {
|
||||
try {
|
||||
const account = await checkActiveAccount();
|
||||
|
||||
const stronghold = sessionStorage.getItem('stronghold');
|
||||
const privkey = JSON.parse(stronghold).state.privkey || null;
|
||||
|
||||
const onboarding = localStorage.getItem('onboarding');
|
||||
const step = JSON.parse(onboarding).state.step || null;
|
||||
|
||||
if (step) {
|
||||
return redirect(step);
|
||||
}
|
||||
|
||||
if (!account) {
|
||||
return redirect('/auth/welcome');
|
||||
} else {
|
||||
if (step) {
|
||||
return redirect(step);
|
||||
}
|
||||
|
||||
if (!privkey) {
|
||||
return redirect('/auth/unlock');
|
||||
}
|
||||
@ -38,7 +41,7 @@ async function Loader() {
|
||||
|
||||
return null;
|
||||
} catch (e) {
|
||||
throw new Error('App failed to load');
|
||||
await message(e, { title: 'An unexpected error has occurred', type: 'error' });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,8 @@ export function OnboardStep3Screen() {
|
||||
}
|
||||
);
|
||||
|
||||
const relaysAsArray = Array.from(data?.keys() || []);
|
||||
|
||||
const toggleRelay = (relay: string) => {
|
||||
if (relays.has(relay)) {
|
||||
setRelays((prev) => {
|
||||
@ -61,8 +63,9 @@ export function OnboardStep3Screen() {
|
||||
};
|
||||
|
||||
const submit = async (skip?: boolean) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
setLoading(true);
|
||||
|
||||
if (!skip) {
|
||||
for (const relay of relays) {
|
||||
await db.createRelay(relay);
|
||||
@ -87,8 +90,6 @@ export function OnboardStep3Screen() {
|
||||
}
|
||||
};
|
||||
|
||||
const relaysAsArray = Array.from(data?.keys() || []);
|
||||
|
||||
useEffect(() => {
|
||||
// save current step, if user close app and reopen it
|
||||
setStep('/auth/onboarding/step-3');
|
||||
@ -179,7 +180,7 @@ export function OnboardStep3Screen() {
|
||||
onClick={() => submit(true)}
|
||||
className="inline-flex h-11 w-full items-center justify-center rounded-lg px-6 font-medium leading-none text-white backdrop-blur-xl hover:bg-white/10 focus:outline-none"
|
||||
>
|
||||
Skip, use default relays
|
||||
Skip, use Lume default relays
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -24,10 +24,6 @@ export function SplashScreen() {
|
||||
};
|
||||
|
||||
const prefetch = async () => {
|
||||
const onboarding = localStorage.getItem('onboarding');
|
||||
const step = JSON.parse(onboarding).state.step || null;
|
||||
if (step) await invoke('close_splashscreen');
|
||||
|
||||
try {
|
||||
const user = await fetchUserData();
|
||||
const data = await prefetchEvents();
|
||||
@ -51,11 +47,24 @@ export function SplashScreen() {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (ndk) {
|
||||
if (!db.account) invoke('close_splashscreen');
|
||||
async function initial() {
|
||||
if (!db.account) {
|
||||
await invoke('close_splashscreen');
|
||||
} else {
|
||||
const onboarding = localStorage.getItem('onboarding');
|
||||
const step = JSON.parse(onboarding).state.step || null;
|
||||
|
||||
console.log('prefetching...');
|
||||
prefetch();
|
||||
if (step) {
|
||||
await invoke('close_splashscreen');
|
||||
} else {
|
||||
console.log('prefetching...');
|
||||
prefetch();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ndk) {
|
||||
initial();
|
||||
}
|
||||
}, [ndk, db.account]);
|
||||
|
||||
|
@ -57,7 +57,12 @@ export const NDKInstance = () => {
|
||||
|
||||
async function initNDK() {
|
||||
const explicitRelayUrls = await getExplicitRelays();
|
||||
const instance = new NDK({ explicitRelayUrls, cacheAdapter });
|
||||
const instance = new NDK({
|
||||
explicitRelayUrls,
|
||||
cacheAdapter,
|
||||
// outboxRelayUrls: ['wss://purplepag.es'],
|
||||
// enableOutboxModel: true,
|
||||
});
|
||||
|
||||
try {
|
||||
await instance.connect(10000);
|
||||
|
Loading…
x
Reference in New Issue
Block a user