Skip to content

Commit ad3036e

Browse files
committed
Dashboard: Header UI improvement for contract layout
1 parent 8bb4d4b commit ad3036e

File tree

4 files changed

+58
-5
lines changed

4 files changed

+58
-5
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/layout.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { redirect } from "next/navigation";
2+
import { getAuthToken, getAuthTokenWalletAddress } from "@/api/auth-token";
23
import { getProjects } from "@/api/projects";
34
import { getTeams } from "@/api/team";
45
import { AppFooter } from "@/components/footers/app-footer";
56
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
6-
import {
7-
getAuthToken,
8-
getAuthTokenWalletAddress,
9-
} from "../../../../../../../../@/api/auth-token";
10-
import { ErrorProvider } from "../../../../../../../../@/contexts/error-handler";
7+
import { ErrorProvider } from "@/contexts/error-handler";
8+
import { ContractIcon } from "@/icons/ContractIcon";
119
import { SharedContractLayout } from "../../../../../../(dashboard)/(chain)/[chain_id]/[contractAddress]/shared-layout";
1210
import { getValidAccount } from "../../../../../../account/settings/getAccount";
1311
import { TeamHeaderLoggedIn } from "../../../../../components/TeamHeader/team-header-logged-in.client";
@@ -66,6 +64,11 @@ export default async function ContractLayout(props: {
6664
<TeamHeaderLoggedIn
6765
account={account}
6866
accountAddress={accountAddress}
67+
activeProjectSubpageLink={{
68+
href: `/team/${params.team_slug}/${params.project_slug}/contracts`,
69+
icon: <ContractIcon />,
70+
label: "Contracts",
71+
}}
6972
client={client}
7073
currentProject={project}
7174
currentTeam={team}

apps/dashboard/src/app/(app)/team/components/TeamHeader/TeamHeaderUI.stories.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Meta, StoryObj } from "@storybook/nextjs";
2+
import { BoxIcon } from "lucide-react";
23
import { ThirdwebProvider } from "thirdweb/react";
34
import type { Project } from "@/api/projects";
45
import type { Team } from "@/api/team";
@@ -119,6 +120,19 @@ function Variants(props: { type: "mobile" | "desktop" }) {
119120
type={props.type}
120121
/>
121122
</BadgeContainer>
123+
124+
<BadgeContainer label="Pro Plan - active subpage">
125+
<Variant
126+
activeProjectSubpageLink={{
127+
href: "/team/project/foo",
128+
icon: <BoxIcon />,
129+
label: "Foo",
130+
}}
131+
currentProject={proTeam.projects[0]}
132+
team={proTeam.team}
133+
type={props.type}
134+
/>
135+
</BadgeContainer>
122136
</div>
123137
</ThirdwebProvider>
124138
);
@@ -132,6 +146,11 @@ function Variant(props: {
132146
team: Team;
133147
type: "mobile" | "desktop";
134148
currentProject?: Project;
149+
activeProjectSubpageLink?: {
150+
label: string;
151+
href: string;
152+
icon: React.ReactNode;
153+
};
135154
}) {
136155
const Comp =
137156
props.type === "mobile" ? TeamHeaderMobileUI : TeamHeaderDesktopUI;
@@ -144,6 +163,7 @@ function Variant(props: {
144163
id: "foo",
145164
}}
146165
accountAddress={"0x1F846F6DAE38E1C88D71EAA191760B15f38B7A37"}
166+
activeProjectSubpageLink={props.activeProjectSubpageLink}
147167
client={storybookThirdwebClient}
148168
connectButton={<ConnectButtonStub />}
149169
createProject={() => {}}

apps/dashboard/src/app/(app)/team/components/TeamHeader/TeamHeaderUI.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ export type TeamHeaderCompProps = {
2929
createTeam: () => void;
3030
client: ThirdwebClient;
3131
accountAddress: string;
32+
activeProjectSubpageLink:
33+
| {
34+
label: string;
35+
icon: React.ReactNode;
36+
href: string;
37+
}
38+
| undefined;
3239
};
3340

3441
export function TeamHeaderDesktopUI(props: TeamHeaderCompProps) {
@@ -107,6 +114,23 @@ export function TeamHeaderDesktopUI(props: TeamHeaderCompProps) {
107114
teamsAndProjects={props.teamsAndProjects}
108115
/>
109116
</div>
117+
118+
{props.activeProjectSubpageLink && (
119+
<>
120+
<SlashSeparator />
121+
<div className="flex items-center gap-1.5">
122+
<div className="flex items-center justify-center rounded-full border size-6 [&>svg]:size-[50%] [&>svg]:text-muted-foreground">
123+
{props.activeProjectSubpageLink.icon}
124+
</div>
125+
<Link
126+
className="flex flex-row items-center gap-2 font-semibold text-sm"
127+
href={props.activeProjectSubpageLink.href}
128+
>
129+
{props.activeProjectSubpageLink.label}
130+
</Link>
131+
</div>
132+
</>
133+
)}
110134
</>
111135
)}
112136
</div>

apps/dashboard/src/app/(app)/team/components/TeamHeader/team-header-logged-in.client.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ export function TeamHeaderLoggedIn(props: {
2828
account: Pick<Account, "email" | "id">;
2929
accountAddress: string;
3030
client: ThirdwebClient;
31+
activeProjectSubpageLink?: {
32+
label: string;
33+
href: string;
34+
icon: React.ReactNode;
35+
};
3136
}) {
3237
// identify the account
3338
useIdentifyAccount({
@@ -63,6 +68,7 @@ export function TeamHeaderLoggedIn(props: {
6368
const headerProps: TeamHeaderCompProps = {
6469
account: props.account,
6570
accountAddress: props.accountAddress,
71+
activeProjectSubpageLink: props.activeProjectSubpageLink,
6672
client: props.client,
6773
connectButton: (
6874
<CustomConnectWallet client={props.client} isLoggedIn={true} />

0 commit comments

Comments
 (0)