From aa4d8f49254660338b1782463134b119ea3d08ba Mon Sep 17 00:00:00 2001 From: David <33458145+davidmcpowell@users.noreply.github.com> Date: Mon, 16 Jun 2025 11:00:59 +0100 Subject: [PATCH] Merge pull request #26389 from overleaf/dp-last-suggested-fix Update ui for previous suggested ai fix in new editor GitOrigin-RevId: 2f4edbcb0614d560bad28f862408ed73d39e988c --- .../error-logs/log-entry-header.tsx | 59 ++++++++------- .../components/error-logs/log-entry.tsx | 74 +++++++++++++------ 2 files changed, 87 insertions(+), 46 deletions(-) diff --git a/services/web/frontend/js/features/ide-redesign/components/error-logs/log-entry-header.tsx b/services/web/frontend/js/features/ide-redesign/components/error-logs/log-entry-header.tsx index ff60fc63b9..fdbfb56c0d 100644 --- a/services/web/frontend/js/features/ide-redesign/components/error-logs/log-entry-header.tsx +++ b/services/web/frontend/js/features/ide-redesign/components/error-logs/log-entry-header.tsx @@ -29,6 +29,8 @@ function LogEntryHeader({ onToggleCollapsed, id, logEntry, + actionButtonsOverride, + openCollapseIconOverride, }: { headerTitle: string | React.ReactNode level: ErrorLevel @@ -40,6 +42,8 @@ function LogEntryHeader({ onToggleCollapsed: () => void id?: string logEntry?: LogEntryData + actionButtonsOverride?: React.ReactNode + openCollapseIconOverride?: string }) { const { t } = useTranslation() const logLocationSpanRef = useRef(null) @@ -101,7 +105,10 @@ function LogEntryHeader({ @@ -121,31 +128,33 @@ function LogEntryHeader({ formattedLocationText )} -
- {showSourceLocationLink && ( - - + {showSourceLocationLink && ( + + + + )} + {actionComponents.map(({ import: { default: Component }, path }) => ( + - - )} - {actionComponents.map(({ import: { default: Component }, path }) => ( - - ))} -
+ ))} + + )} ) } diff --git a/services/web/frontend/js/features/ide-redesign/components/error-logs/log-entry.tsx b/services/web/frontend/js/features/ide-redesign/components/error-logs/log-entry.tsx index 2051fe4552..a7539450ce 100644 --- a/services/web/frontend/js/features/ide-redesign/components/error-logs/log-entry.tsx +++ b/services/web/frontend/js/features/ide-redesign/components/error-logs/log-entry.tsx @@ -1,4 +1,11 @@ -import { memo, MouseEventHandler, useCallback, useState } from 'react' +import { + Dispatch, + MouseEventHandler, + useCallback, + memo, + SetStateAction, + useState, +} from 'react' import HumanReadableLogsHints from '../../../../ide/human-readable-logs/HumanReadableLogsHints' import { sendMB } from '@/infrastructure/event-tracking' import { @@ -10,24 +17,7 @@ import LogEntryHeader from './log-entry-header' import PdfLogEntryContent from '@/features/pdf-preview/components/pdf-log-entry-content' import classNames from 'classnames' -function LogEntry({ - ruleId, - headerTitle, - rawContent, - logType, - formattedContent, - extraInfoURL, - level, - sourceLocation, - showSourceLocationLink = true, - entryAriaLabel = undefined, - contentDetails, - onSourceLocationClick, - index, - logEntry, - id, - alwaysExpandRawContent = false, -}: { +type LogEntryProps = { headerTitle: string | React.ReactNode level: ErrorLevel ruleId?: string @@ -44,9 +34,49 @@ function LogEntry({ logEntry?: LogEntryData id?: string alwaysExpandRawContent?: boolean -}) { + className?: string + actionButtonsOverride?: React.ReactNode + openCollapseIconOverride?: string +} + +function LogEntry(props: LogEntryProps) { const [collapsed, setCollapsed] = useState(true) + return ( + + ) +} + +export function ControlledLogEntry({ + ruleId, + headerTitle, + rawContent, + logType, + formattedContent, + extraInfoURL, + level, + sourceLocation, + showSourceLocationLink = true, + entryAriaLabel = undefined, + contentDetails, + onSourceLocationClick, + index, + logEntry, + id, + alwaysExpandRawContent = false, + className, + collapsed, + setCollapsed, + actionButtonsOverride, + openCollapseIconOverride, +}: LogEntryProps & { + collapsed: boolean + setCollapsed: Dispatch> +}) { if (ruleId && HumanReadableLogsHints[ruleId]) { const hint = HumanReadableLogsHints[ruleId] formattedContent = hint.formattedContent(contentDetails) @@ -72,7 +102,7 @@ function LogEntry({ return (
setCollapsed(collapsed => !collapsed)} id={id} logEntry={logEntry} + actionButtonsOverride={actionButtonsOverride} + openCollapseIconOverride={openCollapseIconOverride} />