Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(databases): paint grid rows opaque over the row lines (#9650)

teo7b7416ec4540
diff --git a/apps/web/src/features/crm/browser-test/editor.browser.e2e.ts b/apps/web/src/features/crm/browser-test/editor.browser.e2e.ts
index 205c1a194f..bf91a63941 100644
--- a/apps/web/src/features/crm/browser-test/editor.browser.e2e.ts
+++ b/apps/web/src/features/crm/browser-test/editor.browser.e2e.ts
@@ -32,7 +32,7 @@ test.afterEach(async ({ page }) => {
test('the pipeline API powers the shared editor and respects column protections and grants', async ({
page,
}) => {
- await expect(page.getByText('Acme', { exact: true })).toBeVisible();
+ await expect(page.getByText('Acme', { exact: true }).first()).toBeVisible();
await page.getByRole('button', { name: 'Sort', exact: true }).click();
await page.getByRole('button', { name: 'Add sort', exact: true }).click();
await page.getByRole('button', { name: 'Close sort' }).click();
@@ -74,3 +74,37 @@ test('a cell in a row taller than its value takes clicks across its full height'
await page.mouse.click(box.x + box.width / 2, box.y + box.height - 8);
await expect(page.getByRole('textbox', { name: 'Edit Notes' })).toBeVisible();
});
+
+test('a wrapping cell opens and closes in place over opaque rows', async ({
+ page,
+}) => {
+ const rows = page.locator('[data-grid-row-id]');
+ const heights = () =>
+ rows.evaluateAll((elements) =>
+ elements.map((row) => row.getBoundingClientRect().height)
+ );
+ const closed = await heights();
+ await page.getByRole('button', { name: /^Notes: Oct 21 emailed/ }).dblclick();
+ const editor = page.getByRole('textbox', { name: 'Edit Notes' });
+ await editor.press('End');
+ await editor.pressSequentially(' and a follow-up call');
+ await expect
+ .poll(async () => (await heights())[0])
+ .toBeGreaterThan(closed[0]);
+ const layout = await rows.evaluateAll((elements) =>
+ elements.map((row) => {
+ const box = row.getBoundingClientRect();
+ // The row lines beneath the rows are drawn at a fixed pitch; only
+ // an opaque row hides them once it grows past it.
+ const canvas = document.createElement('canvas').getContext('2d')!;
+ canvas.fillStyle = getComputedStyle(row).backgroundColor;
+ canvas.fillRect(0, 0, 1, 1);
+ const alpha = canvas.getImageData(0, 0, 1, 1).data[3];
+ return { top: box.top, bottom: box.bottom, alpha };
+ })
+ );
+ expect(layout[1].top).toBeCloseTo(layout[0].bottom, 0);
+ expect(layout.map(({ alpha }) => alpha)).toEqual(layout.map(() => 255));
+ await page.keyboard.press('Escape');
+ await expect.poll(heights).toEqual(closed);
+});
diff --git a/apps/web/src/features/crm/browser-test/editor.tsx b/apps/web/src/features/crm/browser-test/editor.tsx
index e3147a4c1d..3b9c17d507 100644
--- a/apps/web/src/features/crm/browser-test/editor.tsx
+++ b/apps/web/src/features/crm/browser-test/editor.tsx
@@ -1,4 +1,5 @@
import '@app/index.css';
+import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
import type { DatabaseOp } from '@core/database-sql/generated/types';
import type { ColumnDetail } from '@service-storage/generated/schemas/columnDetail';
import type { OpResult } from '@service-storage/generated/schemas/opResult';
@@ -8,6 +9,10 @@ import { QueryClient, QueryClientProvider } from '@tanstack/solid-query';
import { errAsync, okAsync } from 'neverthrow';
import { createSignal } from 'solid-js';
import { render } from 'solid-js/web';
+import {
+ DatabaseTextEditor,
+ DatabaseTextValue,
+} from '../../block-database/database-mentions';
import { DatabaseEditorToolbar } from '../../database/components/database-editor-toolbar';
import { DatabaseProvider, useDatabase } from '../../database/context/database';
import type {
@@ -102,6 +107,26 @@ function Fixture() {
views: [],
};
let rows: StorageRow[] = [
+ {
+ rowId: id(9),
+ cells: {
+ [id(4)]: {
+ type: 'EntityReference',
+ value: [
+ {
+ entity_id: id(8),
+ entity_type: 'COMPANY',
+ specific_message_id: null,
+ },
+ ],
+ },
+ [id(6)]: {
+ type: 'String',
+ value:
+ 'Oct 21 emailed them a welcome note and a renewal quote, no reply yet',
+ },
+ },
+ },
{
rowId: id(7),
cells: {
@@ -211,29 +236,33 @@ function Fixture() {
Toggle editing
</button>
<output aria-label="Pipeline writes">{writes()}</output>
- <DatabaseProvider
- api={api}
- tableId={pipeline.tableId}
- view={view()}
- capabilities={{ editRows: editable(), editColumns: editable() }}
- >
- <DatabaseRecords
+ <StaticMarkdownContext>
+ <DatabaseProvider
+ api={api}
+ tableId={pipeline.tableId}
view={view()}
- stored={false}
- renderToolbar={() => (
- <FixtureToolbar
- view={view()}
- onChangeView={(change) =>
- setView((current) => ({ ...current, ...change }))
- }
- />
- )}
- onViewChange={(change) =>
- setView((view) => ({ ...view, ...change }))
- }
- renderMentionValue={() => <span>Acme</span>}
- />
- </DatabaseProvider>
+ capabilities={{ editRows: editable(), editColumns: editable() }}
+ >
+ <DatabaseRecords
+ view={view()}
+ stored={false}
+ renderToolbar={() => (
+ <FixtureToolbar
+ view={view()}
+ onChangeView={(change) =>
+ setView((current) => ({ ...current, ...change }))
+ }
+ />
+ )}
+ onViewChange={(change) =>
+ setView((view) => ({ ...view, ...change }))
+ }
+ renderTextEditor={(editor) => <DatabaseTextEditor {...editor} />}
+ renderTextValue={(value) => <DatabaseTextValue value={value} />}
+ renderMentionValue={() => <span>Acme</span>}
+ />
+ </DatabaseProvider>
+ </StaticMarkdownContext>
</main>
</QueryClientProvider>
);
diff --git a/apps/web/src/features/database/components/database-table.tsx b/apps/web/src/features/database/components/database-table.tsx
index 0f6ae7d1e4..d9518bc5ec 100644
--- a/apps/web/src/features/database/components/database-table.tsx
+++ b/apps/web/src/features/database/components/database-table.tsx
@@ -1071,9 +1071,12 @@ export function DatabaseTable(props: DatabaseTableProps) {
data-grid-row-id={row().rowId}
data-highlighted={highlighted() ? '' : undefined}
aria-rowindex={index() + 2}
- class="group absolute inset-x-0 top-0 grid min-h-10 border-b border-edge-muted/60 hover:bg-hover/50"
+ // Opaque, with its tints layered on top: a row taller
+ // than the row lines beneath it would show them through.
+ class="group absolute inset-x-0 top-0 grid min-h-10 border-b border-edge-muted/60 bg-panel hover:bg-linear-to-b hover:from-hover/50 hover:to-hover/50"
classList={{
- 'bg-accent/15': highlighted(),
+ 'bg-linear-to-b from-accent/15 to-accent/15':
+ highlighted(),
// Its presence labels paint over the sticky header
// while the row's top edge is in view.
'z-2': hostsLabels() && topInView(),