= ({ title, goBackCb, disabled }) => {
style: {
paddingLeft: 0,
paddingRight: 0,
+ backgroundColor: theme.colors.backLinkBackgroundColor,
+ ":hover": {
+ backgroundColor: theme.colors.backLinkBackgroundHoverColor,
+ },
},
},
}}
diff --git a/explorer_frontend/src/features/account-connector/components/InfoAndBalancesScreen.tsx b/explorer_frontend/src/features/account-connector/components/InfoAndBalancesScreen.tsx
new file mode 100644
index 000000000..4e65344ea
--- /dev/null
+++ b/explorer_frontend/src/features/account-connector/components/InfoAndBalancesScreen.tsx
@@ -0,0 +1,208 @@
+import { FormControl, HeadingLarge, Input, type InputProps } from "@nilfoundation/ui-kit";
+import { BUTTON_KIND, Button, COLORS, LabelLarge, LabelSmall } from "@nilfoundation/ui-kit";
+import { useStyletron } from "baseui";
+import type { ButtonOverrides } from "baseui/button";
+import { useUnit } from "effector-react";
+import lottie from "lottie-web/build/player/lottie_light";
+import { useEffect, useRef, useState } from "react";
+import { getRuntimeConfigOrThrow } from "../../runtime-config/index.ts";
+import { ActiveComponent } from "../ActiveComponent.ts";
+import asteriskIcon from "../assets/asterisk.svg";
+import animationData from "../assets/wallet-creation.json";
+import {
+ $balance,
+ $balanceToken,
+ $initializingSmartAccountError,
+ $initializingSmartAccountState,
+ $rpcUrl,
+ $smartAccount,
+ createSmartAccountFx,
+ initilizeSmartAccount,
+ setActiveComponent,
+} from "../model.ts";
+
+const btnOverrides: ButtonOverrides = {
+ Root: {
+ style: ({ $disabled }) => ({
+ backgroundColor: $disabled ? `${COLORS.gray400}!important` : "",
+ width: "100%",
+ }),
+ },
+};
+
+export const InfoAndBalancesScreen = () => {
+ const [css] = useStyletron();
+ const [error, setError] = useState("");
+ const [isDisabled, setIsDisabled] = useState(false);
+ const { RPC_TELEGRAM_BOT } = getRuntimeConfigOrThrow();
+
+ // Get initialization states
+ const [
+ smartAccount,
+ balance,
+ balanceToken,
+ initializingSmartAccountState,
+ initializingSmartAccountError,
+ isPendingSmartAccountCreation,
+ rpcUrl,
+ ] = useUnit([
+ $smartAccount,
+ $balance,
+ $balanceToken,
+ $initializingSmartAccountState,
+ $initializingSmartAccountError,
+ createSmartAccountFx.pending,
+ $rpcUrl,
+ ]);
+ const [inputValue, setInputValue] = useState(rpcUrl);
+ const animationContainerRef = useRef
(null);
+
+ // biome-ignore lint/correctness/useExhaustiveDependencies:
+ useEffect(() => {
+ if (animationContainerRef.current) {
+ const animationInstance = lottie.loadAnimation({
+ container: animationContainerRef.current as Element,
+ renderer: "svg",
+ loop: true,
+ autoplay: true,
+ animationData,
+ });
+
+ return () => animationInstance.destroy();
+ }
+ }, [isPendingSmartAccountCreation]);
+
+ const handleConnect = () => {
+ const trimmedInputValue = inputValue.trim();
+ setIsDisabled(true);
+ initilizeSmartAccount(trimmedInputValue);
+ };
+
+ const handleGetRpcUrl = () => {
+ if (RPC_TELEGRAM_BOT) {
+ window.open(RPC_TELEGRAM_BOT, "_blank");
+ } else {
+ console.error("RPC_TELEGRAM_BOT runtime variable is not set.");
+ }
+ };
+
+ const handleInputChange: InputProps["onChange"] = (e) => {
+ setError("");
+ setInputValue(e.target.value);
+ };
+
+ useEffect(() => {
+ if (smartAccount !== null && balance !== null && balanceToken !== null) {
+ setActiveComponent(ActiveComponent.Main);
+ }
+ }, [smartAccount, balance, balanceToken]);
+
+ useEffect(() => {
+ if (initializingSmartAccountError) {
+ setIsDisabled(false);
+ setError(initializingSmartAccountError);
+ }
+ }, [initializingSmartAccountError]);
+
+ return (
+
+ {!isPendingSmartAccountCreation ? (
+
+

+
Enter the RPC URL to connect the wallet
+
+ ) : (
+
+
+
+ {initializingSmartAccountState}
+
+
+ )}
+
+
+
+
+
+
{error}
+
+
+
+
+
+
+ );
+};
diff --git a/explorer_frontend/src/features/account-connector/components/MainScreen.tsx b/explorer_frontend/src/features/account-connector/components/MainScreen.tsx
index be341a1e8..123148776 100644
--- a/explorer_frontend/src/features/account-connector/components/MainScreen.tsx
+++ b/explorer_frontend/src/features/account-connector/components/MainScreen.tsx
@@ -3,7 +3,6 @@ import {
Button,
COLORS,
CopyButton,
- Input,
LabelLarge,
LabelMedium,
LabelSmall,
@@ -20,7 +19,6 @@ import { formatEther } from "viem";
import { $rpcIsHealthy } from "../../healthcheck/model";
import { OverflowEllipsis, useMobile } from "../../shared";
import { ActiveComponent } from "../ActiveComponent";
-import CheckmarkIcon from "../assets/checkmark.svg";
import Linkicon from "../assets/link.svg";
import {
$balance,
@@ -33,6 +31,7 @@ import {
setActiveComponent,
topUpSmartAccountBalanceFx,
} from "../model";
+import { AccountSettingsButton } from "./AccountSettingsButton";
import { Token } from "./Token";
import { styles } from "./styles";
@@ -114,13 +113,23 @@ const MainScreen = () => {
display: "flex",
flexDirection: "column",
position: "sticky",
- alignItems: "center",
- gap: "24px",
+ alignItems: "start",
+ gap: "12px",
top: 0,
backgroundColor: theme.colors.backgroundSecondary,
})}
>
- Smart Account
+
{address !== null && (
{
)}
- {rpcUrl !== null && (
-
- {/* Read-Only Input */}
-
- {/* Copy Button */}
-
-
- )}