diff --git a/.changeset/brown-rules-cut.md b/.changeset/brown-rules-cut.md new file mode 100644 index 00000000000..3c6251b5d0e --- /dev/null +++ b/.changeset/brown-rules-cut.md @@ -0,0 +1,6 @@ +--- +"@tryghost/adapter-base-scheduling": patch +"@tryghost/adapter-base-sso": patch +--- + +Bumped framework dependencies diff --git a/apps/admin/src/automations/automations.tsx b/apps/admin/src/automations/automations.tsx index 008834b19dc..78f5326d0dd 100644 --- a/apps/admin/src/automations/automations.tsx +++ b/apps/admin/src/automations/automations.tsx @@ -17,7 +17,7 @@ const Automations: React.FC = () => { } return ( - + diff --git a/apps/admin/src/automations/components/automations-list.test.tsx b/apps/admin/src/automations/components/automations-list.test.tsx index b6d20714d99..b0710dad327 100644 --- a/apps/admin/src/automations/components/automations-list.test.tsx +++ b/apps/admin/src/automations/components/automations-list.test.tsx @@ -1,8 +1,8 @@ import AutomationsList from './automations-list'; import React from 'react'; -import {MemoryRouter} from 'react-router'; +import {MemoryRouter, Route, Routes, useParams} from 'react-router'; import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'; -import {render, screen} from '@testing-library/react'; +import {fireEvent, render, screen} from '@testing-library/react'; const automations = [{ id: 'automation-id-1', @@ -28,6 +28,21 @@ const automations = [{ const renderWithRouter = (ui: React.ReactElement) => render({ui}); +const AutomationEditorRoute = () => { + const {id} = useParams(); + + return
Automation editor: {id}
; +}; + +const renderWithRoutes = () => render( + + + } path="/automations" /> + } path="/automations/:id" /> + + +); + describe('AutomationsList', () => { beforeEach(() => { vi.useFakeTimers(); @@ -80,6 +95,33 @@ describe('AutomationsList', () => { expect(screen.getByRole('link', {name: 'Paid member welcome flow'})).toHaveAttribute('href', '/automations/automation-id-2'); }); + it('follows the row link when clicking another cell', () => { + renderWithRoutes(); + + fireEvent.click(screen.getByText('1,432')); + + expect(screen.getByText('Automation editor: automation-id-1')).toBeInTheDocument(); + }); + + it('lets the existing row link handle its own navigation', () => { + renderWithRoutes(); + + fireEvent.click(screen.getByRole('link', {name: 'Free member welcome flow'})); + + expect(screen.getByText('Automation editor: automation-id-1')).toBeInTheDocument(); + }); + + it('does not follow the row link when the click is default-prevented', () => { + renderWithRoutes(); + const analyticsCell = screen.getByText('1,432'); + analyticsCell.addEventListener('click', event => event.preventDefault(), {once: true}); + + fireEvent.click(analyticsCell); + + expect(screen.queryByText('Automation editor: automation-id-1')).not.toBeInTheDocument(); + expect(analyticsCell).toBeInTheDocument(); + }); + it('renders a table skeleton while loading', () => { renderWithRouter(); diff --git a/apps/admin/src/automations/components/automations-list.tsx b/apps/admin/src/automations/components/automations-list.tsx index 3179c0d617b..f4cb20aff89 100644 --- a/apps/admin/src/automations/components/automations-list.tsx +++ b/apps/admin/src/automations/components/automations-list.tsx @@ -17,6 +17,14 @@ const AUTOMATION_STAT_COLUMNS = [ {key: 'inProgressEntries', label: 'In progress', widthClassName: 'w-32', skeletonWidthClassName: 'w-10'} ] as const; +const handleRowClick = (event: React.MouseEvent) => { + if (event.defaultPrevented || !(event.target instanceof Element) || event.target.closest('a, button, input, select, textarea')) { + return; + } + + event.currentTarget.querySelector('a')?.click(); +}; + interface AutomationsListProps { automations?: AutomationBrowseItem[]; isLoading?: boolean; @@ -94,12 +102,13 @@ const AutomationsList: React.FC = ({automations = [], isLo return ( - + diff --git a/apps/admin/src/automations/components/email-modal/email-content-modal.tsx b/apps/admin/src/automations/components/email-modal/email-content-modal.tsx index d0832c02493..b1a305410d3 100644 --- a/apps/admin/src/automations/components/email-modal/email-content-modal.tsx +++ b/apps/admin/src/automations/components/email-modal/email-content-modal.tsx @@ -278,6 +278,7 @@ const EmailContentModal: React.FC = ({ ref={setDialogContentNode} aria-describedby={undefined} className='top-0 left-0 h-[100dvh] w-full max-w-full translate-0 grid-rows-[1fr] gap-0 rounded-none border-0 p-0 shadow-none outline-hidden sm:rounded-none dark:bg-[#151719]' + data-sentry-mask='true' onEscapeKeyDown={(event) => { if (isKoenigPortalFocused()) { // prevent Radix dismissing the dialog but let the diff --git a/apps/admin/src/automations/components/email-modal/preview-frame.tsx b/apps/admin/src/automations/components/email-modal/preview-frame.tsx index db87b5fdf0f..aefcf136074 100644 --- a/apps/admin/src/automations/components/email-modal/preview-frame.tsx +++ b/apps/admin/src/automations/components/email-modal/preview-frame.tsx @@ -135,6 +135,7 @@ const EmailPreviewFrame: React.FC = ({previewState}) =>