Skip to content

Commit

Permalink
Remove duplicated in-app-wallet and account-abstraction settings UI f…
Browse files Browse the repository at this point in the history
…rom /connect layout (#5748)

## Problem solved

Fixes: DASH-630

In-App wallet and Account abstraction settings are already available in project settings layout

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on refactoring the `AccountAbstractionPage` and `SmartWallets` components by removing the `twAccount` property and associated logic, along with deleting unused configuration files. It streamlines the code and improves maintainability.

### Detailed summary
- Deleted files: `page.tsx` and `loading.tsx` in `connect/in-app-wallets/config`.
- Removed `twAccount` property from `AccountAbstractionPage` and `SmartWallets` components.
- Updated `AccountAbstractionPage` to only fetch `team` and `project` data.
- Removed `getValidAccount` function call.
- Deleted `Sponsorship Policies` tab and related logic from `SmartWallets`.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
  • Loading branch information
MananTank committed Dec 16, 2024
1 parent f1cf2fa commit b173ad2
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { TrackedLinkTW } from "@/components/ui/tracked-link";
import {
type Account,
type ApiKeyService,
accountStatus,
} from "@3rdweb-sdk/react/hooks/useApi";
Expand All @@ -25,7 +24,6 @@ export function AccountAbstractionPage(props: {
apiKeyServices: ApiKeyService[];
billingStatus: "validPayment" | (string & {}) | null;
tab?: string;
twAccount: Account;
}) {
const { apiKeyServices } = props;

Expand Down Expand Up @@ -81,11 +79,9 @@ export function AccountAbstractionPage(props: {

<SmartWallets
smartWalletsLayoutSlug={`/team/${props.teamSlug}/${props.projectSlug}/connect/account-abstraction`}
apiKeyServices={apiKeyServices}
trackingCategory={TRACKING_CATEGORY}
clientId={props.projectKey}
tab={props.tab}
twAccount={props.twAccount}
/>
</div>
<div className="h-14" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { ChakraProviderSetup } from "@/components/ChakraProviderSetup";
import type { Metadata } from "next";
import { notFound, redirect } from "next/navigation";
import { getAbsoluteUrl } from "../../../../../../lib/vercel-utils";
import { getValidAccount } from "../../../../../account/settings/getAccount";
import { getAPIKeyForProjectId } from "../../../../../api/lib/getAPIKeys";
import { AccountAbstractionPage } from "./AccountAbstractionPage";

Expand All @@ -14,10 +13,7 @@ export default async function Page(props: {
}) {
const { team_slug, project_slug } = await props.params;

const [account, team, project] = await Promise.all([
getValidAccount(
`/${team_slug}/${project_slug}/connect/account-abstraction`,
),
const [team, project] = await Promise.all([
getTeamBySlug(team_slug),
getProject(team_slug, project_slug),
]);
Expand Down Expand Up @@ -45,7 +41,6 @@ export default async function Page(props: {
projectKey={project.publishableKey}
apiKeyServices={apiKey.services || []}
tab={(await props.searchParams).tab}
twAccount={account}
/>
</ChakraProviderSetup>
);
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ export default async function Layout(props: {
path: `/team/${team_slug}/${project_slug}/connect/in-app-wallets/users`,
exactMatch: true,
},
{
name: "Configuration",
path: `/team/${team_slug}/${project_slug}/connect/in-app-wallets/config`,
exactMatch: true,
},
]}
/>

Expand Down
25 changes: 1 addition & 24 deletions apps/dashboard/src/components/smart-wallets/index.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
"use client";

import { TabLinks } from "@/components/ui/tabs";
import {
type Account,
type ApiKeyService,
useUserOpUsageAggregate,
} from "@3rdweb-sdk/react/hooks/useApi";
import { useUserOpUsageAggregate } from "@3rdweb-sdk/react/hooks/useApi";
import { AccountAbstractionAnalytics } from "./AccountAbstractionAnalytics";
import { AccountAbstractionSummary } from "./AccountAbstractionAnalytics/AccountAbstractionSummary";
import { AccountFactories } from "./AccountFactories";
import { AccountAbstractionSettingsPage } from "./SponsorshipPolicies";

interface SmartWalletsProps {
apiKeyServices: ApiKeyService[];
trackingCategory: string;
clientId: string;
smartWalletsLayoutSlug: string;
tab?: string;
twAccount: Account;
}

export const SmartWallets: React.FC<SmartWalletsProps> = ({
apiKeyServices,
trackingCategory,
clientId,
smartWalletsLayoutSlug,
tab = "analytics",
twAccount,
}) => {
const aggregateUserOpUsageQuery = useUserOpUsageAggregate({
clientId,
Expand All @@ -48,12 +39,6 @@ export const SmartWallets: React.FC<SmartWalletsProps> = ({
isActive: tab === "analytics",
isDisabled: false,
},
{
name: "Sponsorship Policies",
href: `${smartWalletsLayoutSlug}?tab=config`,
isActive: tab === "config",
isDisabled: false,
},
{
name: "Account Factories",
href: `${smartWalletsLayoutSlug}?tab=factories`,
Expand All @@ -72,14 +57,6 @@ export const SmartWallets: React.FC<SmartWalletsProps> = ({
{tab === "factories" && (
<AccountFactories trackingCategory={trackingCategory} />
)}

{tab === "config" && (
<AccountAbstractionSettingsPage
apiKeyServices={apiKeyServices}
trackingCategory={trackingCategory}
twAccount={twAccount}
/>
)}
</div>
);
};

0 comments on commit b173ad2

Please sign in to comment.