From 93fcfb280a2ba2b89db98359e3b0a87349de825c Mon Sep 17 00:00:00 2001 From: Reece Date: Fri, 10 Oct 2025 17:09:36 +0100 Subject: [PATCH] Remove logs tweak visuals, use fit text component --- .../components/shared/FileDropdownMenu.tsx | 10 +++---- .../src/components/shared/TopControls.tsx | 4 +-- frontend/src/index.css | 2 +- frontend/src/tools/Sign.tsx | 28 ++----------------- frontend/src/utils/signatureFlattening.ts | 3 -- 5 files changed, 10 insertions(+), 37 deletions(-) diff --git a/frontend/src/components/shared/FileDropdownMenu.tsx b/frontend/src/components/shared/FileDropdownMenu.tsx index 4360cfe26..214179593 100644 --- a/frontend/src/components/shared/FileDropdownMenu.tsx +++ b/frontend/src/components/shared/FileDropdownMenu.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { Menu, Loader, Group, Text } from '@mantine/core'; import VisibilityIcon from '@mui/icons-material/Visibility'; import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; +import FitText from './FitText'; interface FileDropdownMenuProps { displayName: string; @@ -30,7 +31,7 @@ export const FileDropdownMenu: React.FC = ({ ) : ( )} - {displayName} + @@ -44,7 +45,6 @@ export const FileDropdownMenu: React.FC = ({ }}> {activeFiles.map((file, index) => { const itemName = file?.name || 'Untitled'; - const itemDisplayName = itemName.length > 50 ? `${itemName.substring(0, 50)}...` : itemName; const isActive = index === currentFileIndex; return ( = ({ }} > - - {itemDisplayName} - +
+ +
{file.versionNumber && file.versionNumber > 1 && ( v{file.versionNumber} diff --git a/frontend/src/components/shared/TopControls.tsx b/frontend/src/components/shared/TopControls.tsx index 3eb0f7f41..e035a2b27 100644 --- a/frontend/src/components/shared/TopControls.tsx +++ b/frontend/src/components/shared/TopControls.tsx @@ -30,9 +30,7 @@ const createViewOptions = ( const currentFile = activeFiles[currentFileIndex]; const isInViewer = currentView === 'viewer'; const fileName = currentFile?.name || ''; - const displayName = isInViewer && fileName - ? (fileName.length > 30 ? `${fileName.substring(0, 30)}...` : fileName) - : 'Viewer'; + const displayName = isInViewer && fileName ? fileName : 'Viewer'; const hasMultipleFiles = activeFiles.length > 1; const showDropdown = isInViewer && hasMultipleFiles; diff --git a/frontend/src/index.css b/frontend/src/index.css index 760ea5d39..c5a604900 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -59,5 +59,5 @@ code { } .viewer-file-tab[data-active] { - background-color: rgba(147, 197, 253, 0.8); + background-color: rgba(147, 197, 253, 0.5); } diff --git a/frontend/src/tools/Sign.tsx b/frontend/src/tools/Sign.tsx index 477bf657f..64a304042 100644 --- a/frontend/src/tools/Sign.tsx +++ b/frontend/src/tools/Sign.tsx @@ -81,10 +81,6 @@ const Sign = (props: BaseToolProps) => { const fileIndex = activeFileIndex < allFiles.length ? activeFileIndex : 0; const originalFile = allFiles[fileIndex]; - console.log('[Sign] Active file index:', activeFileIndex); - console.log('[Sign] All files:', allFiles.map(f => ({ name: f.name, id: f.fileId }))); - console.log('[Sign] Selected file for signing:', { name: originalFile?.name, id: originalFile?.fileId }); - if (!originalFile) { console.error('No file available to replace'); return; @@ -102,9 +98,6 @@ const Sign = (props: BaseToolProps) => { }); if (flattenResult) { - console.log('[Sign] About to consume - input IDs:', flattenResult.inputFileIds); - console.log('[Sign] About to consume - output file:', { name: flattenResult.outputStirlingFile.name, id: flattenResult.outputStirlingFile.fileId }); - // Now consume the files - this triggers the viewer reload await consumeFiles( flattenResult.inputFileIds, @@ -112,24 +105,9 @@ const Sign = (props: BaseToolProps) => { [flattenResult.outputStub] ); - // Find the new file's position in the updated file list and update activeFileIndex - const updatedFiles = selectors.getFiles(); - console.log('[Sign] After consume - updated files:', updatedFiles.map(f => ({ name: f.name, id: f.fileId }))); - console.log('[Sign] Looking for file ID:', flattenResult.outputStirlingFile.fileId); - - const newFileIndex = updatedFiles.findIndex(f => { - console.log('[Sign] Comparing:', f.fileId, 'with', flattenResult.outputStirlingFile.fileId, 'match:', f.fileId === flattenResult.outputStirlingFile.fileId); - return f.fileId === flattenResult.outputStirlingFile.fileId; - }); - console.log('[Sign] New file index:', newFileIndex); - - if (newFileIndex !== -1) { - setActiveFileIndex(newFileIndex); - console.log('[Sign] Set active file index to:', newFileIndex); - } else { - console.error('[Sign] Failed to find new file in updated list! Defaulting to index 0'); - setActiveFileIndex(0); - } + // According to FileReducer.processFileSwap, new files are inserted at the beginning + // So the new file will be at index 0 + setActiveFileIndex(0); // Mark signatures as applied setSignaturesApplied(true); diff --git a/frontend/src/utils/signatureFlattening.ts b/frontend/src/utils/signatureFlattening.ts index 4ed63c29b..ccb739253 100644 --- a/frontend/src/utils/signatureFlattening.ts +++ b/frontend/src/utils/signatureFlattening.ts @@ -290,9 +290,6 @@ export async function flattenSignatures(options: SignatureFlatteningOptions): Pr // Prepare input file data for replacement const inputFileIds: FileId[] = [currentFile.fileId]; - console.log('[flattenSignatures] Current file:', { name: currentFile.name, id: currentFile.fileId }); - console.log('[flattenSignatures] Input file IDs to consume:', inputFileIds); - const record = selectors.getStirlingFileStub(currentFile.fileId); if (!record) { console.error('No file record found for:', currentFile.fileId);