Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit 2a7399a

Browse files
committed
couple more little css fixes
1 parent 256953b commit 2a7399a

File tree

10 files changed

+61
-120
lines changed

10 files changed

+61
-120
lines changed

src/components/Fab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function FabMenu(props: {
4747
return (
4848
<nav
4949
ref={(el) => (navRef = el)}
50-
class="fixed rounded-xl bg-neutral-700/30 px-2 backdrop-blur-lg"
50+
class="fixed z-50 rounded-xl bg-m-grey-800/90 px-2 backdrop-blur-lg"
5151
classList={{
5252
"right-8 bottom-[calc(2rem+5rem)]": props.right,
5353
"left-2 bottom-[calc(2rem+2rem)]": props.left

src/components/OverlayScanner.tsx

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/components/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export * from "./SimpleInput";
5151
export * from "./LabelCircle";
5252
export * from "./SharpButton";
5353
export * from "./HomeSubnav";
54-
export * from "./OverlayScanner";
5554
export * from "./SocialActionRow";
5655
export * from "./ContactButton";
5756
export * from "./GenericItem";

src/components/layout/Misc.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ const FullscreenLoader = () => {
172172

173173
export const MutinyWalletGuard: ParentComponent = (props) => {
174174
const [state, _] = useMegaStore();
175+
175176
return (
176177
<Suspense fallback={<FullscreenLoader />}>
177178
<Switch>

src/components/successfail/SuccessModal.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export function SuccessModal(props: SuccessModalProps) {
1919
props.onConfirm ? props.onConfirm() : props.setOpen(false);
2020
};
2121

22-
// <div class="flex flex-col items-center gap-8 h-full max-w-[400px]">
2322
return (
2423
<Dialog.Root open={props.open} onOpenChange={props.setOpen}>
2524
<Dialog.Portal>

src/router.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ function ChildrenOrError(props: { children: JSX.Element }) {
123123
);
124124
}
125125

126-
// TODO: do we still need setup error display?
127126
export function Router() {
128127
return (
129128
<SolidRouter

src/routes/Chat.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,11 @@ function MessageList(props: {
250250
)}
251251
</For>
252252
</div>
253-
<div ref={(el) => (scrollRef = el)} id="scroll-to-me" />
253+
<div
254+
class="h-16"
255+
ref={(el) => (scrollRef = el)}
256+
id="scroll-to-me"
257+
/>
254258
<Show when={detailsId() && detailsKind()}>
255259
<ActivityDetailsModal
256260
open={detailsOpen()}

src/routes/Main.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createAsync, useNavigate } from "@solidjs/router";
2-
import { createMemo, createSignal, Show, Suspense } from "solid-js";
2+
import { createMemo, Show, Suspense } from "solid-js";
33

44
import {
55
Circle,
@@ -11,7 +11,6 @@ import {
1111
LabelCircle,
1212
LoadingIndicator,
1313
NavBar,
14-
OverlayScanner,
1514
ReloadPrompt,
1615
SocialActionRow
1716
} from "~/components";
@@ -77,8 +76,6 @@ export function Main() {
7776

7877
const navigate = useNavigate();
7978

80-
const [scanner, setScanner] = createSignal(false);
81-
8279
return (
8380
<DefaultMain>
8481
<Show when={state.load_stage !== "done"}>
@@ -95,7 +92,7 @@ export function Main() {
9592

9693
<Show when={!state.wallet_loading && !state.safe_mode}>
9794
<SocialActionRow
98-
onScan={() => setScanner(true)}
95+
onScan={() => navigate("/scanner")}
9996
onSearch={() => navigate("/search")}
10097
/>
10198
</Show>
@@ -107,11 +104,9 @@ export function Main() {
107104

108105
<Fab
109106
onSearch={() => navigate("/search")}
110-
onScan={() => setScanner(true)}
107+
onScan={() => navigate("/scanner")}
111108
/>
112-
<Show when={scanner()}>
113-
<OverlayScanner onClose={() => setScanner(false)} />
114-
</Show>
109+
115110
<DecryptDialog />
116111
<HomePrompt />
117112
<NavBar activeTab="home" />

src/state/megaStore.tsx

Lines changed: 47 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export const Provider: ParentComponent = (props) => {
160160
console.error(e);
161161
}
162162
},
163-
async setup(password?: string): Promise<void> {
163+
async preSetup(): Promise<void> {
164164
try {
165165
// If we're already in an error state there should be no reason to continue
166166
if (state.setup_error) {
@@ -185,7 +185,13 @@ export const Provider: ParentComponent = (props) => {
185185
await doubleInitDefense();
186186
setState({ load_stage: "downloading" });
187187
await initializeWasm();
188-
188+
} catch (e) {
189+
console.error(e);
190+
setState({ setup_error: eify(e) });
191+
}
192+
},
193+
async setup(password?: string): Promise<void> {
194+
try {
189195
const settings = await getSettings();
190196
setState({ load_stage: "setup" });
191197

@@ -203,15 +209,11 @@ export const Provider: ParentComponent = (props) => {
203209
setState({ needs_password: false });
204210

205211
// Get balance
206-
console.time("get_balance");
207212
const balance = await mutinyWallet.get_balance();
208-
console.timeEnd("get_balance");
209213

210214
// Get federations
211-
console.time("list_federations");
212215
const federations =
213216
(await mutinyWallet.list_federations()) as MutinyFederationIdentity[];
214-
console.timeEnd("list_federations");
215217

216218
setState({
217219
mutiny_wallet: mutinyWallet,
@@ -220,6 +222,8 @@ export const Provider: ParentComponent = (props) => {
220222
balance,
221223
federations
222224
});
225+
226+
await actions.postSetup();
223227
} catch (e) {
224228
console.error(e);
225229
if (eify(e).message === "Incorrect password entered.") {
@@ -231,7 +235,6 @@ export const Provider: ParentComponent = (props) => {
231235
}
232236
},
233237
async postSetup(): Promise<void> {
234-
console.time("post_setup");
235238
if (!state.mutiny_wallet) {
236239
console.error(
237240
"Unable to run post setup, no mutiny_wallet is set"
@@ -257,7 +260,23 @@ export const Provider: ParentComponent = (props) => {
257260
} catch (e) {
258261
console.error("error checking subscription", e);
259262
}
260-
console.timeEnd("post_setup");
263+
264+
// Set up syncing
265+
setInterval(async () => {
266+
await actions.sync();
267+
}, 3 * 1000); // Poll every 3 seconds
268+
269+
// Run our first price check
270+
console.log("running first price check");
271+
await actions.priceCheck();
272+
273+
// Set up price checking every minute
274+
setInterval(
275+
async () => {
276+
await actions.priceCheck();
277+
},
278+
60 * 1000 * state.price_sync_backoff_multiple
279+
); // Poll every minute * backoff multiple
261280
},
262281
async deleteMutinyWallet(): Promise<void> {
263282
try {
@@ -474,7 +493,7 @@ export const Provider: ParentComponent = (props) => {
474493
});
475494
});
476495

477-
onMount(async () => {
496+
async function checkForExistingTab() {
478497
// Set up existing tab detector
479498
const channel = new BroadcastChannel("tab-detector");
480499

@@ -500,6 +519,13 @@ export const Provider: ParentComponent = (props) => {
500519
channel.postMessage({ type: "EXISTING_TAB" });
501520
}
502521
};
522+
}
523+
524+
onMount(async () => {
525+
await checkForExistingTab();
526+
if (state.existing_tab_detected) {
527+
return;
528+
}
503529

504530
console.log("checking for browser compatibility");
505531
try {
@@ -509,6 +535,16 @@ export const Provider: ParentComponent = (props) => {
509535
return;
510536
}
511537

538+
await actions.preSetup();
539+
540+
setState({ load_stage: "checking_for_existing_wallet" });
541+
const existing = await MutinyWallet.has_node_manager();
542+
543+
if (!existing) {
544+
navigate("/setup");
545+
return;
546+
}
547+
512548
// Setup catches its own errors and sets state itself
513549
console.log("running setup node manager");
514550
if (
@@ -520,37 +556,13 @@ export const Provider: ParentComponent = (props) => {
520556
await actions.setup();
521557
} else {
522558
console.warn("setup aborted");
559+
return;
523560
}
524561

525562
// After we have the mutiny wallet we still need to check for subscription and sync nostr
526-
await actions.postSetup();
563+
// await actions.postSetup();
527564

528565
console.log("node manager setup done");
529-
530-
// Setup an event listener to stop the mutiny wallet when the page unloads
531-
window.onunload = async (_e) => {
532-
console.log("stopping mutiny_wallet");
533-
await state.mutiny_wallet?.stop();
534-
console.log("mutiny_wallet stopped");
535-
sessionStorage.removeItem("MUTINY_WALLET_INITIALIZED");
536-
};
537-
538-
// Set up syncing
539-
setInterval(async () => {
540-
await actions.sync();
541-
}, 3 * 1000); // Poll every 3 seconds
542-
543-
// Run our first price check
544-
console.log("running first price check");
545-
await actions.priceCheck();
546-
547-
// Set up price checking every minute
548-
setInterval(
549-
async () => {
550-
await actions.priceCheck();
551-
},
552-
60 * 1000 * state.price_sync_backoff_multiple
553-
); // Poll every minute * backoff multiple
554566
});
555567

556568
const store = [state, actions] as MegaStore;

src/styles/dialogs.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
export const DIALOG_POSITIONER = "fixed inset-0 h-[100dvh] z-50";
1+
export const DIALOG_POSITIONER =
2+
"fixed inset-0 h-[100dvh] z-50 bg-m-grey-900 safe-top safe-bottom";
23
export const DIALOG_CONTENT =
3-
"safe-top safe-bottom h-full flex flex-col justify-between px-4 pt-4 pb-8 bg-m-grey-900 touch-manipulation select-none overflow-y-scroll disable-scrollbars";
4+
"h-full flex flex-col justify-between px-4 pt-4 pb-8 bg-m-grey-900 touch-manipulation select-none overflow-y-scroll disable-scrollbars";

0 commit comments

Comments
 (0)