Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"@mui/material/Box": "Use a <div> instead.",
"@mui/material/Button": "Use a components/Button/Button instead.",
"@mui/material/styles": "Import from @emotion/react instead.",
"@mui/material/Table*": "Import from components/Table/Table instead.",
"lodash": "Use lodash/<name> instead."
}
}
Expand Down
12 changes: 6 additions & 6 deletions site/e2e/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export async function verifyConfigFlagBoolean(
const value = opt.value ? "Enabled" : "Disabled";

const configOption = page.locator(
`div.options-table .option-${flag} .${type}`,
`table.options-table .option-${flag} .${type}`,
);
await expect(configOption).toHaveText(value);
}
Expand All @@ -225,7 +225,7 @@ export async function verifyConfigFlagNumber(
) {
const opt = findConfigOption(config, flag);
const configOption = page.locator(
`div.options-table .option-${flag} .option-value-number`,
`table.options-table .option-${flag} .option-value-number`,
);
await expect(configOption).toHaveText(String(opt.value));
}
Expand All @@ -238,7 +238,7 @@ export async function verifyConfigFlagString(
const opt = findConfigOption(config, flag);

const configOption = page.locator(
`div.options-table .option-${flag} .option-value-string`,
`table.options-table .option-${flag} .option-value-string`,
);
// biome-ignore lint/suspicious/noExplicitAny: opt.value is any
await expect(configOption).toHaveText(opt.value as any);
Expand All @@ -251,7 +251,7 @@ export async function verifyConfigFlagArray(
) {
const opt = findConfigOption(config, flag);
const configOption = page.locator(
`div.options-table .option-${flag} .option-array`,
`table.options-table .option-${flag} .option-array`,
);

// Verify array of options with simple dots
Expand All @@ -268,7 +268,7 @@ export async function verifyConfigFlagEntries(
) {
const opt = findConfigOption(config, flag);
const configOption = page.locator(
`div.options-table .option-${flag} .option-array`,
`table.options-table .option-${flag} .option-array`,
);

// Verify array of options with green marks.
Expand Down Expand Up @@ -296,7 +296,7 @@ export async function verifyConfigFlagDuration(
);
}
const configOption = page.locator(
`div.options-table .option-${flag} .option-value-string`,
`table.options-table .option-${flag} .option-value-string`,
);
await expect(configOption).toHaveText(humanDuration(opt.value / 1e6));
}
Expand Down
2 changes: 1 addition & 1 deletion site/e2e/tests/deployment/general.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test("experiments", async ({ page }) => {
await page.goto("/deployment/overview", { waitUntil: "domcontentloaded" });

const experimentsLocator = page.locator(
"div.options-table tr.option-experiments ul.option-array",
"table.options-table tr.option-experiments ul.option-array",
);
await expect(experimentsLocator).toBeVisible();

Expand Down
2 changes: 1 addition & 1 deletion site/e2e/tests/deployment/security.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async function verifyStrictTransportSecurity(
}

const configOption = page.locator(
`div.options-table .option-${flag} .option-value-string`,
`table.options-table .option-${flag} .option-value-string`,
);
await expect(configOption).toHaveText("Disabled");
}
35 changes: 18 additions & 17 deletions site/src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const TableBody = React.forwardRef<
/>
));

const _TableFooter = React.forwardRef<
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how did this end up unused?

Copy link
Contributor Author

@BrunoQuaresma BrunoQuaresma Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tables we had weren’t using it 😕

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not really doing anything novel/complicated. I would rather we delete unused code than ignore it.

export const TableFooter = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes<HTMLTableSectionElement>
>(({ className, ...props }, ref) => (
Expand Down Expand Up @@ -82,22 +82,23 @@ const tableRowVariants = cva(
},
);

export const TableRow = React.forwardRef<
HTMLTableRowElement,
React.HTMLAttributes<HTMLTableRowElement> &
VariantProps<typeof tableRowVariants>
>(({ className, hover, ...props }, ref) => (
<tr
ref={ref}
className={cn(
"border-0 border-b border-solid border-border transition-colors",
"data-[state=selected]:bg-muted",
tableRowVariants({ hover }),
className,
)}
{...props}
/>
));
export type TableRowProps = React.HTMLAttributes<HTMLTableRowElement> &
VariantProps<typeof tableRowVariants>;

export const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(
({ className, hover, ...props }, ref) => (
<tr
ref={ref}
className={cn(
"border-0 border-b border-solid border-border transition-colors",
"data-[state=selected]:bg-muted",
tableRowVariants({ hover }),
className,
)}
{...props}
/>
),
);

export const TableHead = React.forwardRef<
HTMLTableCellElement,
Expand Down
16 changes: 6 additions & 10 deletions site/src/components/TableEmpty/TableEmpty.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
import TableContainer from "@mui/material/TableContainer";
import type { Meta, StoryObj } from "@storybook/react-vite";
import { CodeExample } from "components/CodeExample/CodeExample";
import { Table, TableBody } from "components/Table/Table";
import { TableEmpty } from "./TableEmpty";

const meta: Meta<typeof TableEmpty> = {
Expand All @@ -13,13 +11,11 @@ const meta: Meta<typeof TableEmpty> = {
},
decorators: [
(Story) => (
<TableContainer>
<Table>
<TableBody>
<Story />
</TableBody>
</Table>
</TableContainer>
<Table>
<TableBody>
<Story />
</TableBody>
</Table>
),
],
};
Expand Down
3 changes: 1 addition & 2 deletions site/src/components/TableEmpty/TableEmpty.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import TableCell from "@mui/material/TableCell";
import TableRow from "@mui/material/TableRow";
import {
EmptyState,
type EmptyStateProps,
} from "components/EmptyState/EmptyState";
import { TableCell, TableRow } from "components/Table/Table";
import type { FC } from "react";

type TableEmptyProps = EmptyStateProps;
Expand Down
16 changes: 6 additions & 10 deletions site/src/components/TableLoader/TableLoader.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
import TableContainer from "@mui/material/TableContainer";
import type { Meta, StoryObj } from "@storybook/react-vite";
import { Table, TableBody } from "components/Table/Table";
import { TableLoader } from "./TableLoader";

const meta: Meta<typeof TableLoader> = {
title: "components/TableLoader",
component: TableLoader,
decorators: [
(Story) => (
<TableContainer>
<Table>
<TableBody>
<Story />
</TableBody>
</Table>
</TableContainer>
<Table>
<TableBody>
<Story />
</TableBody>
</Table>
),
],
};
Expand Down
7 changes: 5 additions & 2 deletions site/src/components/TableLoader/TableLoader.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import TableCell from "@mui/material/TableCell";
import TableRow, { type TableRowProps } from "@mui/material/TableRow";
import {
TableCell,
TableRow,
type TableRowProps,
} from "components/Table/Table";
import { cloneElement, type FC, isValidElement, type ReactNode } from "react";
import { Loader } from "../Loader/Loader";

Expand Down
3 changes: 1 addition & 2 deletions site/src/components/Timeline/TimelineDateRow.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { css, useTheme } from "@emotion/react";
import TableCell from "@mui/material/TableCell";
import TableRow from "@mui/material/TableRow";
import { TableCell, TableRow } from "components/Table/Table";
import type { FC } from "react";
import { createDisplayDate } from "./utils";

Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Timeline/TimelineEntry.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TableRow, { type TableRowProps } from "@mui/material/TableRow";
import { TableRow, type TableRowProps } from "components/Table/Table";
import { forwardRef } from "react";
import { cn } from "utils/cn";

Expand Down
24 changes: 6 additions & 18 deletions site/src/pages/AuditPage/AuditLogRow/AuditLogRow.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,20 @@ import {
MockAuditLogWithWorkspaceBuild,
MockUserOwner,
} from "testHelpers/entities";
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 { Meta, StoryObj } from "@storybook/react-vite";
import { Table, TableBody } from "components/Table/Table";
import { AuditLogRow } from "./AuditLogRow";

const meta: Meta<typeof AuditLogRow> = {
title: "pages/AuditPage/AuditLogRow",
component: AuditLogRow,
decorators: [
(Story) => (
<TableContainer>
<Table>
<TableHead>
<TableRow>
<TableCell style={{ paddingLeft: 32 }}>Logs</TableCell>
</TableRow>
</TableHead>
<TableBody>
<Story />
</TableBody>
</Table>
</TableContainer>
<Table>
<TableBody>
<Story />
</TableBody>
</Table>
),
],
};
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { CSSObject, Interpolation, Theme } from "@emotion/react";
import Collapse from "@mui/material/Collapse";
import Link from "@mui/material/Link";
import TableCell from "@mui/material/TableCell";
import Tooltip from "@mui/material/Tooltip";
import type { AuditLog, BuildReason } from "api/typesGenerated";
import { Avatar } from "components/Avatar/Avatar";
import { DropdownArrow } from "components/DropdownArrow/DropdownArrow";
import { Stack } from "components/Stack/Stack";
import { StatusPill } from "components/StatusPill/StatusPill";
import { TableCell } from "components/Table/Table";
import { TimelineEntry } from "components/Timeline/TimelineEntry";
import { InfoIcon, NetworkIcon } from "lucide-react";
import { type FC, useState } from "react";
Expand Down
Loading
Loading