-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ManagedGroups section to user page
- Loading branch information
Showing
5 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/app/(pages)/users/[user]/components/ManagedGroups/Table.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Link from "@/components/Link"; | ||
import { ManagedGroup } from "@/models/groups"; | ||
|
||
type ManagedGroupsTableProps = { | ||
managedGroups: ManagedGroup[]; | ||
}; | ||
|
||
export default function ManagedGroupsTable( | ||
props: Readonly<ManagedGroupsTableProps> | ||
) { | ||
const { managedGroups } = props; | ||
return ( | ||
<table className="w-full table-auto rounded-lg"> | ||
<tbody> | ||
{managedGroups.map(group => ( | ||
<tr key={group.id} className="tbl-tr"> | ||
<td className="tbl-td"> | ||
<Link href={`/groups/${group.id}`}>{group.name}</Link> | ||
</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
src/app/(pages)/users/[user]/components/ManagedGroups/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { User } from "@/models/scim"; | ||
import { fetchManagedGroups } from "@/services/groups"; | ||
import ManagedGroupsTable from "./Table"; | ||
import { Section } from "@/components/Layout"; | ||
|
||
type ManagedGroupsProps = { | ||
user: User; | ||
}; | ||
|
||
export default async function ManagedGroups( | ||
props: Readonly<ManagedGroupsProps> | ||
) { | ||
const { user } = props; | ||
const { managedGroups } = await fetchManagedGroups(user.id); | ||
if (managedGroups.length === 0) { | ||
return null; | ||
} | ||
return ( | ||
<Section title="Managed Groups"> | ||
<ManagedGroupsTable managedGroups={managedGroups} /> | ||
</Section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters