Skip to content

Commit

Permalink
couple more little css fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul committed Mar 12, 2024
1 parent 256953b commit 2a7399a
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 120 deletions.
2 changes: 1 addition & 1 deletion src/components/Fab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function FabMenu(props: {
return (
<nav
ref={(el) => (navRef = el)}
class="fixed rounded-xl bg-neutral-700/30 px-2 backdrop-blur-lg"
class="fixed z-50 rounded-xl bg-m-grey-800/90 px-2 backdrop-blur-lg"
classList={{
"right-8 bottom-[calc(2rem+5rem)]": props.right,
"left-2 bottom-[calc(2rem+2rem)]": props.left
Expand Down
69 changes: 0 additions & 69 deletions src/components/OverlayScanner.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export * from "./SimpleInput";
export * from "./LabelCircle";
export * from "./SharpButton";
export * from "./HomeSubnav";
export * from "./OverlayScanner";
export * from "./SocialActionRow";
export * from "./ContactButton";
export * from "./GenericItem";
Expand Down
1 change: 1 addition & 0 deletions src/components/layout/Misc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ const FullscreenLoader = () => {

export const MutinyWalletGuard: ParentComponent = (props) => {
const [state, _] = useMegaStore();

return (
<Suspense fallback={<FullscreenLoader />}>
<Switch>
Expand Down
1 change: 0 additions & 1 deletion src/components/successfail/SuccessModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export function SuccessModal(props: SuccessModalProps) {
props.onConfirm ? props.onConfirm() : props.setOpen(false);
};

// <div class="flex flex-col items-center gap-8 h-full max-w-[400px]">
return (
<Dialog.Root open={props.open} onOpenChange={props.setOpen}>
<Dialog.Portal>
Expand Down
1 change: 0 additions & 1 deletion src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ function ChildrenOrError(props: { children: JSX.Element }) {
);
}

// TODO: do we still need setup error display?
export function Router() {
return (
<SolidRouter
Expand Down
6 changes: 5 additions & 1 deletion src/routes/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,11 @@ function MessageList(props: {
)}
</For>
</div>
<div ref={(el) => (scrollRef = el)} id="scroll-to-me" />
<div
class="h-16"
ref={(el) => (scrollRef = el)}
id="scroll-to-me"
/>
<Show when={detailsId() && detailsKind()}>
<ActivityDetailsModal
open={detailsOpen()}
Expand Down
13 changes: 4 additions & 9 deletions src/routes/Main.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createAsync, useNavigate } from "@solidjs/router";
import { createMemo, createSignal, Show, Suspense } from "solid-js";
import { createMemo, Show, Suspense } from "solid-js";

import {
Circle,
Expand All @@ -11,7 +11,6 @@ import {
LabelCircle,
LoadingIndicator,
NavBar,
OverlayScanner,
ReloadPrompt,
SocialActionRow
} from "~/components";
Expand Down Expand Up @@ -77,8 +76,6 @@ export function Main() {

const navigate = useNavigate();

const [scanner, setScanner] = createSignal(false);

return (
<DefaultMain>
<Show when={state.load_stage !== "done"}>
Expand All @@ -95,7 +92,7 @@ export function Main() {

<Show when={!state.wallet_loading && !state.safe_mode}>
<SocialActionRow
onScan={() => setScanner(true)}
onScan={() => navigate("/scanner")}
onSearch={() => navigate("/search")}
/>
</Show>
Expand All @@ -107,11 +104,9 @@ export function Main() {

<Fab
onSearch={() => navigate("/search")}
onScan={() => setScanner(true)}
onScan={() => navigate("/scanner")}
/>
<Show when={scanner()}>
<OverlayScanner onClose={() => setScanner(false)} />
</Show>

<DecryptDialog />
<HomePrompt />
<NavBar activeTab="home" />
Expand Down
82 changes: 47 additions & 35 deletions src/state/megaStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export const Provider: ParentComponent = (props) => {
console.error(e);
}
},
async setup(password?: string): Promise<void> {
async preSetup(): Promise<void> {
try {
// If we're already in an error state there should be no reason to continue
if (state.setup_error) {
Expand All @@ -185,7 +185,13 @@ export const Provider: ParentComponent = (props) => {
await doubleInitDefense();
setState({ load_stage: "downloading" });
await initializeWasm();

} catch (e) {
console.error(e);
setState({ setup_error: eify(e) });
}
},
async setup(password?: string): Promise<void> {
try {
const settings = await getSettings();
setState({ load_stage: "setup" });

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

// Get balance
console.time("get_balance");
const balance = await mutinyWallet.get_balance();
console.timeEnd("get_balance");

// Get federations
console.time("list_federations");
const federations =
(await mutinyWallet.list_federations()) as MutinyFederationIdentity[];
console.timeEnd("list_federations");

setState({
mutiny_wallet: mutinyWallet,
Expand All @@ -220,6 +222,8 @@ export const Provider: ParentComponent = (props) => {
balance,
federations
});

await actions.postSetup();
} catch (e) {
console.error(e);
if (eify(e).message === "Incorrect password entered.") {
Expand All @@ -231,7 +235,6 @@ export const Provider: ParentComponent = (props) => {
}
},
async postSetup(): Promise<void> {
console.time("post_setup");
if (!state.mutiny_wallet) {
console.error(
"Unable to run post setup, no mutiny_wallet is set"
Expand All @@ -257,7 +260,23 @@ export const Provider: ParentComponent = (props) => {
} catch (e) {
console.error("error checking subscription", e);
}
console.timeEnd("post_setup");

// Set up syncing
setInterval(async () => {
await actions.sync();
}, 3 * 1000); // Poll every 3 seconds

// Run our first price check
console.log("running first price check");
await actions.priceCheck();

// Set up price checking every minute
setInterval(
async () => {
await actions.priceCheck();
},
60 * 1000 * state.price_sync_backoff_multiple
); // Poll every minute * backoff multiple
},
async deleteMutinyWallet(): Promise<void> {
try {
Expand Down Expand Up @@ -474,7 +493,7 @@ export const Provider: ParentComponent = (props) => {
});
});

onMount(async () => {
async function checkForExistingTab() {
// Set up existing tab detector
const channel = new BroadcastChannel("tab-detector");

Expand All @@ -500,6 +519,13 @@ export const Provider: ParentComponent = (props) => {
channel.postMessage({ type: "EXISTING_TAB" });
}
};
}

onMount(async () => {
await checkForExistingTab();
if (state.existing_tab_detected) {
return;
}

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

await actions.preSetup();

setState({ load_stage: "checking_for_existing_wallet" });
const existing = await MutinyWallet.has_node_manager();

if (!existing) {
navigate("/setup");
return;
}

// Setup catches its own errors and sets state itself
console.log("running setup node manager");
if (
Expand All @@ -520,37 +556,13 @@ export const Provider: ParentComponent = (props) => {
await actions.setup();
} else {
console.warn("setup aborted");
return;
}

// After we have the mutiny wallet we still need to check for subscription and sync nostr
await actions.postSetup();
// await actions.postSetup();

console.log("node manager setup done");

// Setup an event listener to stop the mutiny wallet when the page unloads
window.onunload = async (_e) => {
console.log("stopping mutiny_wallet");
await state.mutiny_wallet?.stop();
console.log("mutiny_wallet stopped");
sessionStorage.removeItem("MUTINY_WALLET_INITIALIZED");
};

// Set up syncing
setInterval(async () => {
await actions.sync();
}, 3 * 1000); // Poll every 3 seconds

// Run our first price check
console.log("running first price check");
await actions.priceCheck();

// Set up price checking every minute
setInterval(
async () => {
await actions.priceCheck();
},
60 * 1000 * state.price_sync_backoff_multiple
); // Poll every minute * backoff multiple
});

const store = [state, actions] as MegaStore;
Expand Down
5 changes: 3 additions & 2 deletions src/styles/dialogs.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const DIALOG_POSITIONER = "fixed inset-0 h-[100dvh] z-50";
export const DIALOG_POSITIONER =
"fixed inset-0 h-[100dvh] z-50 bg-m-grey-900 safe-top safe-bottom";
export const DIALOG_CONTENT =
"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";
"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 comments on commit 2a7399a

Please sign in to comment.