Skip to content
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 @@ -208,12 +208,7 @@ export const DeploymentList: React.FunctionComponent = () => {
)}

{filteredDeployments?.length === 0 && !isLoadingDeployments && !search && (
<NoDeploymentsState
onDeployClick={onDeployClick}
hasDeployments={Boolean(deployments && deployments.length > 0)}
isWalletConnected={isWalletConnected}
showTemplatesButton
/>
<NoDeploymentsState onDeployClick={onDeployClick} hasDeployments={Boolean(deployments && deployments.length > 0)} showTemplatesButton />
)}

{(!filteredDeployments || filteredDeployments?.length === 0) && isLoadingDeployments && !search && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ import { udenomToDenom } from "@src/utils/mathHelpers";
import { uaktToAKT } from "@src/utils/priceUtils";
import { UrlService } from "@src/utils/urlUtils";
import { ExternalLink } from "../shared/ExternalLink";
import { WalletConnectionButtons } from "../wallet/WalletConnectionButtons";
import { QontoConnector, QontoStepIcon } from "./Stepper";

export const DEPENDENCIES = {
useWallet,
useWalletBalance,
useChainParam,
WalletConnectionButtons,
AddFundsLink
};

Expand Down Expand Up @@ -81,13 +79,6 @@ export const GetStartedStepper: React.FunctionComponent<{ dependencies?: typeof
</StepLabel>

<StepContent>
{!isWalletConnected && (
<p className="text-muted-foreground">
You can pay using either USD (fiat) or with crypto ($AKT or $USDC). To pay with USD, click "Start Trial". To pay with crypto, click "Connect
Wallet"
</p>
)}

{isWalletConnected && !isManagedWallet && (
<div className="my-4 flex items-center space-x-2">
<Check className="text-green-600" />
Expand Down Expand Up @@ -132,13 +123,9 @@ export const GetStartedStepper: React.FunctionComponent<{ dependencies?: typeof
)}

{!isWalletConnected && (
<div>
<div className="my-4 flex items-center space-x-2">
<XmarkCircleSolid className="text-destructive" />
<span>Billing is not set up</span>
</div>

<d.WalletConnectionButtons className="gap-2" connectManagedWalletButtonClassName="mr-2 w-full md:w-auto" />
<div className="my-4 flex items-center space-x-2">
<XmarkCircleSolid className="text-destructive" />
<span>Billing is not set up</span>
</div>
)}

Comment thread
baktun14 marked this conversation as resolved.
Expand Down
45 changes: 15 additions & 30 deletions apps/deploy-web/src/components/home/NoDeploymentsState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,20 @@
import React from "react";
import { Button, Card, CardContent } from "@akashnetwork/ui/components";
import { MultiplePages, Rocket } from "iconoir-react";
import { useAtom } from "jotai";
import Link from "next/link";

import { WalletConnectionButtons } from "@src/components/wallet/WalletConnectionButtons";
import { useServices } from "@src/context/ServicesProvider";
import { useCustomUser } from "@src/hooks/useCustomUser";
import { useNewDeploymentUrl } from "@src/hooks/useNewDeploymentUrl/useNewDeploymentUrl";
import walletStore from "@src/store/walletStore";

type Props = {
onDeployClick: () => void;
hasDeployments?: boolean;
isWalletConnected?: boolean;
showTemplatesButton?: boolean;
};

export const NoDeploymentsState: React.FC<Props> = ({ onDeployClick, hasDeployments = false, isWalletConnected = true, showTemplatesButton = true }) => {
export const NoDeploymentsState: React.FC<Props> = ({ onDeployClick, hasDeployments = false, showTemplatesButton = true }) => {
const { urlService } = useServices();
const newDeploymentUrl = useNewDeploymentUrl();
const [isSignedInWithTrial] = useAtom(walletStore.isSignedInWithTrial);
const { user } = useCustomUser();

const title = hasDeployments ? "No active deployments." : "No deployments yet.";

Expand All @@ -34,36 +27,28 @@ export const NoDeploymentsState: React.FC<Props> = ({ onDeployClick, hasDeployme
</div>
<h3 className="mb-2 text-xl">{title}</h3>

{isSignedInWithTrial && !user && (
<p className="mb-4 text-center text-sm text-muted-foreground">If you are expecting to see some, you may need to sign in or connect a wallet</p>
)}

{showTemplatesButton && (
<p className="mb-6 text-center text-muted-foreground">
Use one of our most popular templates below or create your first deployment using our SDL builder.
</p>
)}

{isWalletConnected ? (
<div className="flex gap-4">
<Button onClick={onDeployClick} asChild>
<Link href={newDeploymentUrl()}>
<Rocket className="mr-2 h-4 w-4 rotate-45" />
Create Deployment
<div className="flex gap-4">
<Button onClick={onDeployClick} asChild>
<Link href={newDeploymentUrl()}>
<Rocket className="mr-2 h-4 w-4 rotate-45" />
Create Deployment
</Link>
</Button>
{showTemplatesButton && (
<Button variant="outline" asChild>
<Link href={urlService.templates()}>
<MultiplePages className="mr-2 h-4 w-4" />
Explore Templates
</Link>
</Button>
{showTemplatesButton && (
<Button variant="outline" asChild>
<Link href={urlService.templates()}>
<MultiplePages className="mr-2 h-4 w-4" />
Explore Templates
</Link>
</Button>
)}
</div>
) : (
<WalletConnectionButtons className="mt-4 justify-center" />
)}
)}
</div>
</CardContent>
</Card>
);
Expand Down
7 changes: 2 additions & 5 deletions apps/deploy-web/src/components/layout/WalletStatus.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ describe(WalletStatus.name, () => {
expect(screen.queryByLabelText("Connected wallet name and balance")).not.toBeInTheDocument();
});

it("renders the WalletConnectionButtons when no wallet is connected", () => {
const WalletConnectionButtons = vi.fn(ComponentMock);
setup({ isWalletConnected: false, dependencies: { WalletConnectionButtons } });
it("renders nothing when no wallet is connected", () => {
setup({ isWalletConnected: false });

expect(WalletConnectionButtons).toHaveBeenCalled();
expect(screen.queryByLabelText("Connected wallet name and balance")).not.toBeInTheDocument();
});

Expand Down Expand Up @@ -78,7 +76,6 @@ describe(WalletStatus.name, () => {
refetch: vi.fn()
}) as unknown as ReturnType<typeof DEPENDENCIES.useWalletBalance>,
ManagedWalletPopup: vi.fn(ComponentMock) as unknown as typeof DEPENDENCIES.ManagedWalletPopup,
WalletConnectionButtons: vi.fn(ComponentMock) as unknown as typeof DEPENDENCIES.WalletConnectionButtons,
FormattedNumber: ({ value }: { value: number }) => <span>${value}</span>,
...input.dependencies
} as unknown as typeof DEPENDENCIES;
Expand Down
6 changes: 1 addition & 5 deletions apps/deploy-web/src/components/layout/WalletStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ import { NavArrowDown, Wallet } from "iconoir-react";
import { useWallet } from "@src/context/WalletProvider";
import { useWalletBalance } from "@src/hooks/useWalletBalance";
import { ManagedWalletPopup } from "../wallet/ManagedWalletPopup/ManagedWalletPopup";
import { WalletConnectionButtons } from "../wallet/WalletConnectionButtons";

export const DEPENDENCIES = {
useWallet,
useWalletBalance,
ManagedWalletPopup,
WalletConnectionButtons,
FormattedNumber
};

Expand Down Expand Up @@ -64,9 +62,7 @@ export function WalletStatus({ dependencies: d = DEPENDENCIES }: Props = {}) {
</DropdownMenu>
</div>
</div>
) : (
<d.WalletConnectionButtons className="w-full justify-center" />
)
) : null
) : (
<div className="flex items-center space-x-2 rounded-md border bg-accent px-4 py-2">
<Skeleton className="h-4 w-4 rounded-full bg-muted-foreground/20" />
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions apps/deploy-web/src/hooks/useManagedWallet.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import { useEffect, useMemo } from "react";
import type { ApiManagedWalletOutput } from "@akashnetwork/http-sdk";
import { useIsMutating } from "@tanstack/react-query";
import { useAtom } from "jotai";

import { useUser } from "@src/hooks/useUser";
import { QueryKeys } from "@src/queries/queryKeys";
import { useCreateManagedWalletMutation, useManagedWalletQuery } from "@src/queries/useManagedWalletQuery";
import walletStore from "@src/store/walletStore";
import { ensureUserManagedWalletOwnership, updateStorageManagedWallet } from "@src/utils/walletUtils";
import { useCustomUser } from "./useCustomUser";

export const useManagedWallet = () => {
const { user } = useUser();
const { user: signedInUser } = useCustomUser();
const { data: queried, isLoading: isInitialLoading, isFetching, refetch } = useManagedWalletQuery(user?.id);
const {
mutate: create,
Expand All @@ -30,13 +26,6 @@ export const useManagedWallet = () => {
const isCreatingManagedWallet = useIsMutating({ mutationKey: QueryKeys.getManagedWalletCreateMutationKey() }) > 0;
const wallet = useMemo(() => (queried || created) as ApiManagedWalletOutput, [queried, created]);
const isLoading = isInitialLoading || isCreating || isCreatingManagedWallet;
const [, setIsSignedInWithTrial] = useAtom(walletStore.isSignedInWithTrial);

useEffect(() => {
if (signedInUser?.id && (!!queried || !!created)) {
setIsSignedInWithTrial(true);
}
}, [signedInUser?.id, queried, created, setIsSignedInWithTrial]);

useEffect(() => {
if (!wallet?.address) {
Expand Down
Loading
Loading