Skip to content

chore: migrate settings page tables from mui to shadcn #16896

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

Merged
merged 8 commits into from
Mar 13, 2025
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
Next Next commit
chore: migrate to shadcn table
  • Loading branch information
jaaydenh committed Mar 12, 2025
commit e2cdf2206b1353fb5ae2fd88c0c6f41f0d96fd7b
106 changes: 53 additions & 53 deletions site/src/pages/GroupsPage/GroupsPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ import AddOutlined from "@mui/icons-material/AddOutlined";
import KeyboardArrowRight from "@mui/icons-material/KeyboardArrowRight";
import AvatarGroup from "@mui/material/AvatarGroup";
import Skeleton from "@mui/material/Skeleton";
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
import TableCell from "@mui/material/TableCell";
import TableContainer from "@mui/material/TableContainer";
import TableHead from "@mui/material/TableHead";
import TableRow from "@mui/material/TableRow";
import type { Group } from "api/typesGenerated";
import { Avatar } from "components/Avatar/Avatar";
import { AvatarData } from "components/Avatar/AvatarData";
Expand All @@ -17,6 +11,14 @@ import { Button } from "components/Button/Button";
import { ChooseOne, Cond } from "components/Conditionals/ChooseOne";
import { EmptyState } from "components/EmptyState/EmptyState";
import { Paywall } from "components/Paywall/Paywall";
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "components/Table/Table";
import {
TableLoaderSkeleton,
TableRowSkeleton,
Expand Down Expand Up @@ -51,55 +53,53 @@ export const GroupsPageView: FC<GroupsPageViewProps> = ({
/>
</Cond>
<Cond>
<TableContainer>
<Table>
<TableHead>
<TableRow>
<TableCell width="50%">Name</TableCell>
<TableCell width="49%">Users</TableCell>
<TableCell width="1%" />
</TableRow>
</TableHead>
<TableBody>
<ChooseOne>
<Cond condition={isLoading}>
<TableLoader />
</Cond>
<Table>
<TableHeader>
<TableRow>
<TableHead className="w-1/2">Name</TableHead>
<TableHead className="w-[49%]">Users</TableHead>
<TableHead className="w-[1%]" />
</TableRow>
</TableHeader>
<TableBody>
<ChooseOne>
<Cond condition={isLoading}>
<TableLoader />
</Cond>

<Cond condition={isEmpty}>
<TableRow>
<TableCell colSpan={999}>
<EmptyState
message="No groups yet"
description={
canCreateGroup
? "Create your first group"
: "You don't have permission to create a group"
}
cta={
canCreateGroup && (
<Button asChild>
<RouterLink to="create">
<AddOutlined />
Create group
</RouterLink>
</Button>
)
}
/>
</TableCell>
</TableRow>
</Cond>
<Cond condition={isEmpty}>
<TableRow>
<TableCell colSpan={999}>
<EmptyState
message="No groups yet"
description={
canCreateGroup
? "Create your first group"
: "You don't have permission to create a group"
}
cta={
canCreateGroup && (
<Button asChild>
<RouterLink to="create">
<AddOutlined />
Create group
</RouterLink>
</Button>
)
}
/>
</TableCell>
</TableRow>
</Cond>

<Cond>
{groups?.map((group) => (
<GroupRow key={group.id} group={group} />
))}
</Cond>
</ChooseOne>
</TableBody>
</Table>
</TableContainer>
<Cond>
{groups?.map((group) => (
<GroupRow key={group.id} group={group} />
))}
</Cond>
</ChooseOne>
</TableBody>
</Table>
</Cond>
</ChooseOne>
</>
Expand Down