Skip to content

Commit 32568fd

Browse files
committed
Add "Invite Team Members" button to team overview page (#6755)
# Add "Invite Team Members" Button to Team Overview Page This PR adds a new "Invite Team Members" button to the Team Overview page, replacing the previous implementation. The changes include: - Created a new reusable `InviteTeamMembersButton` component - Added the button to the Team Overview page header - Removed the old "Share Button" component from the TeamProjectsPage - Improved the layout of the Team Overview page header to accommodate the new button - Maintained analytics tracking for the invite action The button links to the team members settings page and includes a user plus icon for better visual indication of its purpose.
1 parent 9091e81 commit 32568fd

File tree

3 files changed

+39
-33
lines changed

3 files changed

+39
-33
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"use client";
2+
3+
import { Button } from "@/components/ui/button";
4+
import { useTrack } from "hooks/analytics/useTrack";
5+
import { UserPlusIcon } from "lucide-react";
6+
import Link from "next/link";
7+
8+
export function InviteTeamMembersButton(props: { teamSlug: string }) {
9+
const trackEvent = useTrack();
10+
return (
11+
<Button
12+
asChild
13+
variant="outline"
14+
className="gap-2"
15+
onClick={() =>
16+
trackEvent({
17+
category: "inviteTeam",
18+
action: "click",
19+
label: "invite-team",
20+
})
21+
}
22+
>
23+
<Link href={`/team/${props.teamSlug}/~/settings/members`}>
24+
<UserPlusIcon className="size-4" />
25+
<span>Invite Team Members</span>
26+
</Link>
27+
</Button>
28+
);
29+
}

apps/dashboard/src/app/team/[team_slug]/(team)/page.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { subDays } from "date-fns";
66
import { redirect } from "next/navigation";
77
import { getAuthToken } from "../../../api/lib/getAuthToken";
88
import { loginRedirect } from "../../../login/loginRedirect";
9+
import { InviteTeamMembersButton } from "./_components/invite-team-members-button";
910
import {
1011
type ProjectWithAnalytics,
1112
TeamProjectsPage,
@@ -33,11 +34,14 @@ export default async function Page(props: {
3334

3435
return (
3536
<div className="flex grow flex-col">
36-
<div className="border-border border-b py-10">
37-
<div className="container">
38-
<h1 className="font-semibold text-3xl tracking-tight">
39-
Team Overview
40-
</h1>
37+
<div className="border-border border-b">
38+
<div className="container flex flex-col items-start gap-3 py-10 md:flex-row md:items-center">
39+
<div className="flex-1">
40+
<h1 className="font-semibold text-3xl tracking-tight">
41+
Team Overview
42+
</h1>
43+
</div>
44+
<InviteTeamMembersButton teamSlug={params.team_slug} />
4145
</div>
4246
</div>
4347

apps/dashboard/src/app/team/[team_slug]/(team)/~/projects/TeamProjectsPage.tsx

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ import { useDashboardRouter } from "@/lib/DashboardRouter";
2626
import { cn } from "@/lib/utils";
2727
import { LazyCreateProjectDialog } from "components/settings/ApiKeys/Create/LazyCreateAPIKeyDialog";
2828
import { formatDate } from "date-fns";
29-
import { useTrack } from "hooks/analytics/useTrack";
30-
import { PlusIcon, SearchIcon, UserPlus } from "lucide-react";
29+
import { PlusIcon, SearchIcon } from "lucide-react";
3130
import Link from "next/link";
3231
import { useMemo, useState } from "react";
3332
import type { ThirdwebClient } from "thirdweb";
@@ -120,9 +119,6 @@ export function TeamProjectsPage(props: {
120119
createProject={() => setIsCreateProjectDialogOpen(true)}
121120
teamMembersSettingsPath={`/team/${props.team.slug}/~/settings/members`}
122121
/>
123-
<Link href={`/team/${props.team.slug}/~/settings/members`}>
124-
<ShareButton />
125-
</Link>
126122
</div>
127123
</div>
128124
</div>
@@ -283,29 +279,6 @@ function AddNewButton(props: {
283279
);
284280
}
285281

286-
function ShareButton() {
287-
//track event click
288-
const trackEvent = useTrack();
289-
return (
290-
<Button
291-
variant="default"
292-
className="absolute top-0 right-0 gap-2 lg:static"
293-
onClick={() =>
294-
trackEvent({
295-
category: "inviteTeam",
296-
action: "click",
297-
label: "invite-team",
298-
})
299-
}
300-
>
301-
<UserPlus className="size-4" />
302-
<span>
303-
<span className="hidden lg:inline">Invite</span>to Team
304-
</span>
305-
</Button>
306-
);
307-
}
308-
309282
function SelectBy(props: {
310283
value: SortById;
311284
onChange: (value: SortById) => void;

0 commit comments

Comments
 (0)