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
2 changes: 2 additions & 0 deletions .claude/rules/frontend/ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ paths:
- Settings pages live under `/settings/*`, built from `common/SettingsPage`. Keep the `/account/*` and `/manage/profile*` redirects: sent emails still link to them.
- `global.scss` gives every `.mantine-InputWrapper-root` and `.mantine-Switch-root` a bottom margin. For inputs inline in a row, zero it for that row (`.row :global(.mantine-InputWrapper-root) { margin-bottom: 0; }`) instead of a magic `mt`/`mb` on the sibling.
- Add a `data-testid` only to elements an E2E spec drives: buttons, menu items, and widgets with no accessible label (`CustomSelect` takes `dataTestId`; options become `<dataTestId>-option-<value>`). Kebab-case `<feature>-<element>`, e.g. `promo-code-create-button`.
- List tables use `common/TanStackTable`: one line per row, the identifying column `meta.sticky: 'left'`, the actions column `meta.sticky: 'right'`, and horizontal scroll at every width instead of a stacked mobile layout. Build cells from `TanStackTable/cells.tsx` (`IdentityCell`, `CellLink`, `CellText`, `CellCopy`, `EmptyCell`), statuses from `common/StatusBadge`, and sortable headings with `sortableHeader` + `tableSortFromQuery` (`TanStackTable/sorting.tsx`). Columns whose cells handle their own clicks set `meta.interactive` so `onRowClick` doesn't fire. A table whose identifying cell needs two lines (name over email) sets `rowLines={2}` and uses `<IdentityCell stacked>`, so every row keeps the same height; never let a cell wrap or stack to a variable height.
- A list page wraps its table in `common/TableCard`: `<ToolBar embedded>` (search, filters, then `ToolBarSlot` for the column toggle and actions), the table with `noCard`, `TableCardSkeleton` while loading and `TableCardFooter` for the range and pagination.
8 changes: 4 additions & 4 deletions e2e/pages/capacity.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export class CapacityPage {
await this.page.waitForLoadState('networkidle');
}

cardByName(name: string): Locator {
return this.page.locator('[class*="capacityCard"]').filter({ hasText: name });
rowByName(name: string): Locator {
return this.page.getByRole('row').filter({ hasText: name });
}

capacityInput(): Locator {
Expand All @@ -27,8 +27,8 @@ export class CapacityPage {
await this.page.getByRole('dialog').getByRole('button', { name: 'Create Capacity Assignment' }).click();
}

async openCardAction(name: string, action: string): Promise<void> {
await this.cardByName(name).getByRole('button').click();
async openRowAction(name: string, action: string): Promise<void> {
await this.rowByName(name).getByRole('button').click();
await this.page.getByRole('menuitem', { name: action }).click();
}

Expand Down
2 changes: 1 addition & 1 deletion e2e/pages/occurrence.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export class OccurrencePage {
}

selectionSummary(): Locator {
return this.page.locator('[class*="selectionCount"]');
return this.page.getByTestId('occurrence-selection-count');
}

async clearSelection(): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion e2e/pages/webhook.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class WebhookPage {
}

async chooseRowAction(url: string, action: string): Promise<void> {
await this.rowByUrl(url).getByRole('button').click();
await this.rowByUrl(url).getByTestId('webhook-actions-button').click();
await this.page.getByRole('menuitem', { name: action }).click();
}

Expand Down
1 change: 1 addition & 0 deletions e2e/tests/account/read-only-access.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ async function expectReadOnlyPage(page: Page, path: string, heading: RegExp): Pr
}

async function openFirstRowMenu(page: Page, rowText: string): Promise<void> {
await page.getByText(rowText).first().waitFor();
const row = page.getByRole('row').filter({ hasText: rowText }).first();
const container = (await row.count()) > 0 ? row : page.getByText(rowText).first().locator('xpath=ancestor::*[.//button][1]');
await container.getByRole('button').last().click();
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/box-office/box-office-reporting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test.describe('box office reporting', () => {
await orders.goto(event.eventId);

const row = authedPage.getByRole('row').filter({ hasText: 'Box office sale' });
await expect(row).toContainText('Box office · Sold by Robin');
await expect(row).toContainText('Sold by Robin');
await expect(row).toContainText('Cash');
await expect(row).toContainText('No email provided');

Expand Down
14 changes: 7 additions & 7 deletions e2e/tests/management/capacity-assignments.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ test.describe('capacity assignments', () => {
await capacity.goto(event.eventId);
await capacity.createAssignment({ name, capacity: 50, productTitle: event.productTitle });

const card = capacity.cardByName(name);
const card = capacity.rowByName(name);
await expect(card).toBeVisible();
await expect(card.getByText('0/50')).toBeVisible();
await expect(card.getByText(/^ACTIVE$/)).toBeVisible();
await expect(card.getByText(/^Active$/)).toBeVisible();
await expect(card.getByText('Applies to 1 product')).toBeVisible();
});

Expand All @@ -33,7 +33,7 @@ test.describe('capacity assignments', () => {
const capacity = new CapacityPage(authedPage);
await capacity.goto(event.eventId);

const card = capacity.cardByName(name);
const card = capacity.rowByName(name);
await expect(card).toBeVisible();
await expect(card.getByText('1/50')).toBeVisible();
});
Expand All @@ -50,13 +50,13 @@ test.describe('capacity assignments', () => {

const capacity = new CapacityPage(authedPage);
await capacity.goto(event.eventId);
await capacity.openCardAction(name, 'Edit Capacity');
await capacity.openRowAction(name, 'Edit Capacity');

await expect(authedPage.getByRole('heading', { name: 'Edit Capacity Assignment' })).toBeVisible();
await expect(capacity.capacityInput()).toHaveValue('50');
await capacity.submitEdit(75);

await expect(capacity.cardByName(name).getByText('0/75')).toBeVisible();
await expect(capacity.rowByName(name).getByText('0/75')).toBeVisible();
});

test('an organizer deletes a capacity assignment', async ({ authedPage, api, account }) => {
Expand All @@ -71,10 +71,10 @@ test.describe('capacity assignments', () => {

const capacity = new CapacityPage(authedPage);
await capacity.goto(event.eventId);
await capacity.openCardAction(name, 'Delete Capacity');
await capacity.openRowAction(name, 'Delete Capacity');
await capacity.confirmAction();

await expect(authedPage.getByRole('heading', { name: 'No Capacity Assignments' })).toBeVisible();
await expect(capacity.cardByName(name)).toHaveCount(0);
await expect(capacity.rowByName(name)).toHaveCount(0);
});
});
4 changes: 2 additions & 2 deletions e2e/tests/management/webhooks-event.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test.describe('event webhooks', () => {

const row = webhooks.rowByUrl(url);
await expect(row).toBeVisible();
await expect(row.getByText('ENABLED')).toBeVisible();
await expect(row.getByText('Enabled')).toBeVisible();
await expect(row.getByText('2 events')).toBeVisible();
});

Expand Down Expand Up @@ -53,7 +53,7 @@ test.describe('event webhooks', () => {
await webhooks.selectPausedStatus();
await webhooks.submitEditForm();

await expect(webhooks.rowByUrl(url).getByText(/^PAUSED$/)).toBeVisible();
await expect(webhooks.rowByUrl(url).getByText(/^Paused$/)).toBeVisible();
});

test('an organizer deletes an event webhook', async ({ authedPage, api, account }) => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/management/webhooks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ test.describe('webhooks', () => {

const row = authedPage.getByRole('row').filter({ hasText: url });
await expect(row).toBeVisible();
await expect(row.getByText('ENABLED')).toBeVisible();
await expect(row.getByText('Enabled')).toBeVisible();
});
});
11 changes: 9 additions & 2 deletions frontend/src/components/common/ActionMenu/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import {Button, Menu} from '@mantine/core';
import {ActionIcon, Button, Menu} from '@mantine/core';
import {t} from '@lingui/macro';
import {IconDotsVertical} from '@tabler/icons-react';
import {useAccess} from "../../../hooks/useAccess.ts";

Expand Down Expand Up @@ -31,6 +32,12 @@ const DefaultTarget = () => (
</Button>
);

export const RowActionsTarget = () => (
<ActionIcon variant="subtle" color="gray" aria-label={t`Actions`}>
<IconDotsVertical size={18}/>
</ActionIcon>
);

export const ActionMenu: React.FC<ActionMenuProps> = ({
itemsGroups,
target = <DefaultTarget/>,
Expand All @@ -50,7 +57,7 @@ export const ActionMenu: React.FC<ActionMenuProps> = ({

return (
<>
<Menu shadow="md" width={200}>
<Menu shadow="md" width={200} position="bottom-end">
<Menu.Target>
<div style={{cursor: 'pointer'}} data-testid={dataTestId}>
{target}
Expand Down
Loading
Loading