Skip to content

Develop #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {AiOutlineInfoCircle} from "react-icons/ai";
export function WhitelistDrawer() {
const setDrawerState = useSetAtom(drawerStateAtom);
const {owners, pools} = useAtomValue(chainStateAtom);
const {data, setData} = useStorage();
const {data} = useStorage();
const [selected, setSelected] = useState<string[]>([]);
const {sentryRunning, stopRuntime} = useOperatorRuntime();
const {publicKey: operatorAddress} = useOperator();
Expand Down Expand Up @@ -82,14 +82,14 @@ export function WhitelistDrawer() {
);

async function handleSubmit() {
await setData({
...data,
whitelistedWallets: selected,
});

setDrawerState(null);

if (stopRuntime) {
void stopRuntime();
void stopRuntime({
...data,
sentryRunning: false,
whitelistedWallets: selected,
});
}
}

Expand Down
10 changes: 7 additions & 3 deletions apps/sentry-client-desktop/src/hooks/useOperatorRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Challenge, NodeLicenseInformation, NodeLicenseStatusMap, operatorRuntime
import {useOperator} from "@/features/operator";
import {atom, useAtom} from "jotai";
import {useEffect, useRef, useState} from "react";
import {useStorage} from "@/features/storage";
import {IData, useStorage} from "@/features/storage";
import log from "electron-log";
import { ethers } from "ethers";

Expand Down Expand Up @@ -70,7 +70,7 @@ export function useOperatorRuntime() {
}
}

async function stopRuntime() {
async function stopRuntime(passedData?: IData) {
if (sentryRunning && stop !== undefined) {
// prevent race conditions from pressing "stop" too fast
const _stop = stop;
Expand All @@ -79,7 +79,11 @@ export function useOperatorRuntime() {
await _stop();
setNodeLicenseStatusMap(new Map<bigint, NodeLicenseInformation>());
setSentryRunning(false);
await setData({...data, sentryRunning: false});
if (passedData) {
await setData(passedData);
} else {
await setData({...data, sentryRunning: false});
}
}
}

Expand Down
8 changes: 3 additions & 5 deletions apps/web-connect/src/features/header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {useNavigate} from "react-router-dom";
import {ConnectButton, ExternalLink} from "@sentry/ui";
import {useWeb3Modal} from "@web3modal/wagmi/react";
import {useAccount} from "wagmi";
Expand All @@ -8,19 +7,18 @@ import MobileNavbar from "@/features/header/MobileNavbar";
import {useState} from "react";

export function Header() {
const navigate = useNavigate();
const {open} = useWeb3Modal();
const {address} = useAccount()
const [isNavbarOpened, setIsNavbarOpened] = useState(false)
return (
<div className="w-full">
<div className="fixed top-0 flex w-full justify-between items-center bg-transparent z-[10]">
<div
<a
className="w-full group md:max-w-[108px] md:min-h-[108px] min-h-[64px] max-w-[64px] flex items-center bg-hornetSting justify-center hover:bg-white duration-200 ease-in cursor-pointer"
onClick={() => navigate("/")}
href="https://xai.games/"
>
<XaiLogo className="md:w-[43px] md:h-[38px] w-[26px] h-[23px] fill-white group-hover:fill-hornetSting duration-200 ease-in" />
</div>
</a>
<div className="font-bold text-xl items-center gap-[20px] uppercase text-white hidden md:flex">
<ExternalLink
content={"DOCS"}
Expand Down