Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds "added by" and "added at" columns to the table, changes to API header #490

Merged
merged 5 commits into from
Dec 5, 2024
Merged
Changes from 1 commit
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
28 changes: 15 additions & 13 deletions apps/web/src/components/Dashboard/Team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@ import {
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from '../ui/alert-dialog'
import Spinner from '@/components/Spinner'

interface TeamMember {
id: string
email: string
addedBy: {
id: string
email: string
} | null
addedAt: string
}

const emailRegex = new RegExp(
Expand Down Expand Up @@ -62,7 +66,7 @@ export const TeamContent = ({
`${process.env.NEXT_PUBLIC_BILLING_API_URL}/teams/${team.id}/users`,
{
headers: {
'X-Team-API-Key': team.apiKeys[0],
'X-User-Access-Token': user.accessToken,
jakubno marked this conversation as resolved.
Show resolved Hide resolved
},
}
)
Expand Down Expand Up @@ -261,6 +265,8 @@ export const TeamContent = ({
<TableHeader>
<TableRow className="hover:bg-inherit dark:hover:bg-inherit border-b border-white/5">
<TableHead>Email</TableHead>
<TableHead>Added by</TableHead>
<TableHead>Added at</TableHead>
<TableHead></TableHead>
</TableRow>
</TableHeader>
Expand All @@ -278,13 +284,14 @@ export const TeamContent = ({
key={user.id}
>
<TableCell>{user.email}</TableCell>
mishushakov marked this conversation as resolved.
Show resolved Hide resolved
<TableCell>
<TableCell>{user.addedBy?.email}</TableCell>
<TableCell>{user.addedAt}</TableCell>
mishushakov marked this conversation as resolved.
Show resolved Hide resolved
<TableCell align="right">
<Button
className="text-sm"
variant="desctructive"
onClick={() => openDialog(user.id)}
>
Remove team member
Remove
</Button>
</TableCell>
</TableRow>
Expand All @@ -295,18 +302,13 @@ export const TeamContent = ({
)}

<AlertDialog open={isDialogOpen} onOpenChange={setIsDialogOpen}>
<AlertDialogTrigger asChild>
<Button variant="outline" style={{ display: 'none' }}>
Show Dialog
</Button>
</AlertDialogTrigger>
<AlertDialogContent className="bg-inherit text-white border-black">
<AlertDialogHeader>
<AlertDialogTitle>
You are about to delete a member from the team
You are about to remove a member from the team
</AlertDialogTitle>
<AlertDialogDescription className="text-white/90">
This action cannot be undone. This will permanently delete the
This action cannot be undone. This will permanently remove the
member from the team.
</AlertDialogDescription>
</AlertDialogHeader>
Expand All @@ -321,7 +323,7 @@ export const TeamContent = ({
className="bg-red-500 text-white hover:bg-red-600"
onClick={() => deleteUserFromTeam()}
>
Continue
Remove
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
Expand Down
Loading