From 5eeb37e32d04eadf88340b2c323793cc747fa3c2 Mon Sep 17 00:00:00 2001 From: lucaronin Date: Thu, 16 Apr 2026 16:18:45 +0200 Subject: [PATCH] fix: make pulse rows edge to edge --- src/components/PulseView.test.tsx | 20 ++++++++++++++++++++ src/components/PulseView.tsx | 21 ++++++++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/components/PulseView.test.tsx b/src/components/PulseView.test.tsx index 750090cf..a19001cc 100644 --- a/src/components/PulseView.test.tsx +++ b/src/components/PulseView.test.tsx @@ -222,6 +222,26 @@ describe('PulseView', () => { expect(screen.queryByText('my project')).not.toBeInTheDocument() }) + it('uses a full-width surface for hover, focus, and expanded commit rows', async () => { + mockInvokeFn.mockResolvedValue(mockCommits) + + render() + + const commitRow = await screen.findByRole('button', { name: /Update project notes/i }) + const hasExpandedBackground = (className: string) => /(^|\s)bg-accent\/40(\s|$)/.test(className) + + expect(commitRow.className).toContain('-mx-4') + expect(commitRow.className).toContain('px-4') + expect(commitRow.className).toContain('rounded-none') + expect(commitRow.className).toContain('hover:bg-accent/40') + expect(commitRow.className).toContain('focus-visible:bg-accent/40') + expect(hasExpandedBackground(commitRow.className)).toBe(false) + + fireEvent.click(commitRow) + + expect(hasExpandedBackground(commitRow.className)).toBe(true) + }) + it('supports keyboard activation for commit rows and file rows', async () => { mockInvokeFn.mockResolvedValue(mockCommits) const onOpenNote = vi.fn() diff --git a/src/components/PulseView.tsx b/src/components/PulseView.tsx index 49cbac35..e581e4e6 100644 --- a/src/components/PulseView.tsx +++ b/src/components/PulseView.tsx @@ -1,5 +1,6 @@ import { useState, useEffect, useCallback, useRef, memo, type KeyboardEvent } from 'react' import { invoke } from '@tauri-apps/api/core' +import { cn } from '@/lib/utils' import { isTauri, mockInvoke } from '../mock-tauri' import { useDragRegion } from '../hooks/useDragRegion' import type { PulseCommit, PulseFile } from '../types' @@ -64,6 +65,9 @@ const STATUS_COLOR = { deleted: 'var(--destructive, #dc2626)', } as const +const PULSE_ROW_FOCUS_CLASS_NAME = 'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring/70 focus-visible:ring-inset' +const PULSE_EDGE_TO_EDGE_ROW_CLASS_NAME = '-mx-4 rounded-none px-4' + function SummaryBadges({ added, modified, deleted }: { added: number; modified: number; deleted: number }) { return (
@@ -98,7 +102,10 @@ function FileItem({ return (