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
32 changes: 32 additions & 0 deletions apps/dashboard/src/@/api/linked-wallets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { getAuthToken } from "../../app/api/lib/getAuthToken";
import { API_SERVER_URL } from "../constants/env";

export type LinkedWallet = {
createdAt: string;
id: string;
walletAddress: string;
};

export async function getLinkedWallets() {
const token = await getAuthToken();

if (!token) {
return null;
}

const res = await fetch(`${API_SERVER_URL}/v1/account/wallets`, {
headers: {
Authorization: `Bearer ${token}`,
},
});

if (res.ok) {
const json = (await res.json()) as {
data: LinkedWallet[];
};

return json.data;
}

return null;
}
27 changes: 7 additions & 20 deletions apps/dashboard/src/app/account/devices/AccountDevicesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,12 @@ export function AccountDevicesPage() {
const authorizedWalletsQuery = useAuthorizedWallets();

return (
<div className="container py-8">
<div className="flex flex-col gap-8">
<div className="flex flex-col gap-2">
<div className="flex flex-col justify-between gap-4">
<h1 className="font-semibold text-3xl tracking-tight">Devices</h1>
<p className="text-muted-foreground">
List of authorized devices that can perform actions on behalf of
your account.
</p>
<ChakraProviderSetup>
<AuthorizedWalletsTable
authorizedWallets={authorizedWalletsQuery.data || []}
isPending={authorizedWalletsQuery.isPending}
isFetched={authorizedWalletsQuery.isFetched}
/>
</ChakraProviderSetup>
</div>
</div>
</div>
</div>
<ChakraProviderSetup>
<AuthorizedWalletsTable
authorizedWallets={authorizedWalletsQuery.data || []}
isPending={authorizedWalletsQuery.isPending}
isFetched={authorizedWalletsQuery.isFetched}
/>
</ChakraProviderSetup>
);
}
18 changes: 17 additions & 1 deletion apps/dashboard/src/app/account/devices/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,21 @@ export default async function Page() {
// enforce valid account
await getValidAccount("/account/devices");

return <AccountDevicesPage />;
return (
<div>
<header className="border-border border-b py-10">
<div className="container max-w-[950px]">
<h1 className="font-semibold text-3xl tracking-tight">Devices</h1>
<p className="mt-1 text-muted-foreground text-sm">
List of authorized devices that can perform actions on behalf of
your account.
</p>
</div>
</header>

<div className="container max-w-[950px] py-8">
<AccountDevicesPage />
</div>
</div>
);
}
9 changes: 4 additions & 5 deletions apps/dashboard/src/app/account/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ async function HeaderAndNav(props: {
path: "/account/settings",
name: "Settings",
},
// TODO - enable these links after they are functional
// {
// path: "/account/wallets",
// name: "Wallets",
// },
{
path: "/account/wallets",
name: "Linked Wallets",
},
{
path: "/account/devices",
name: "Devices",
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/app/account/overview/AccountTeamsUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ export function AccountTeamsUI(props: {
</div>

<ToolTipLabel label="Coming Soon">
<Button variant="primary" disabled className="gap-2 max-sm:w-full">
<Button disabled className="gap-2 max-sm:w-full">
<PlusIcon className="size-4" />
Create a Team
Create Team
</Button>
</ToolTipLabel>
</div>
Expand Down
29 changes: 21 additions & 8 deletions apps/dashboard/src/app/account/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { getTeams } from "@/api/team";
import { getMembers } from "@/api/team-members";
import { getThirdwebClient } from "@/constants/thirdweb.server";
import { getAuthToken } from "../api/lib/getAuthToken";
import { loginRedirect } from "../login/loginRedirect";
import { AccountTeamsUI } from "./overview/AccountTeamsUI";
import { getValidAccount } from "./settings/getAccount";

export default async function Page() {
const account = await getValidAccount("/account");
const teams = await getTeams();
if (!teams) {
const [authToken, account, teams] = await Promise.all([
getAuthToken(),
getValidAccount("/account"),
getTeams(),
]);

if (!authToken || !teams) {
loginRedirect("/account");
}

Expand Down Expand Up @@ -36,11 +41,19 @@ export default async function Page() {
).filter((x) => !!x);

return (
<div className="container grow py-8">
<AccountTeamsUI
teamsWithRole={teamsWithRole}
client={getThirdwebClient()}
/>
<div className="flex grow flex-col">
<header className="border-border border-b py-10">
<div className="container max-w-[950px]">
<h1 className="font-semibold text-3xl tracking-tight">Overview</h1>
</div>
</header>

<div className="container flex max-w-[950px] grow flex-col py-8">
<AccountTeamsUI
teamsWithRole={teamsWithRole}
client={getThirdwebClient(authToken)}
/>
</div>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ export function AccountSettingsPage(props: {
const router = useDashboardRouter();
return (
<div>
<div className="border-border border-b py-10">
<header className="border-border border-b py-10">
<div className="container max-w-[950px]">
<h1 className="font-semibold text-3xl tracking-tight">
Account Settings
</h1>
</div>
</div>
</header>

<div className="container max-w-[950px] grow pt-8 pb-20">
<AccountSettingsPageUI
hideDeleteAccount
Expand Down
Loading
Loading