This commit is contained in:
Connor Yoh 2025-09-03 17:57:39 +01:00
parent 22d1c4a740
commit e40d600759
3 changed files with 7 additions and 39 deletions

View File

@ -125,11 +125,11 @@ const FileInfoCard: React.FC<FileInfoCardProps> = ({
<Divider />
<Box py="xs">
<Text size="xs" c="dimmed" mb="xs">{t('fileManager.toolChain', 'Tools Applied')}</Text>
<ToolChain
<ToolChain
toolChain={currentFile.historyInfo.toolChain}
displayStyle="badges"
size="xs"
maxWidth={180}
maxWidth={'180px'}
/>
</Box>
</>

View File

@ -103,12 +103,12 @@ const FileListItem: React.FC<FileListItemProps> = ({
<Text span c="dimmed"> {lineagePath.length} versions</Text>
)}
</Text>
{/* Tool chain for processed files */}
{file.historyInfo?.toolChain && file.historyInfo.toolChain.length > 0 && (
<ToolChain
<ToolChain
toolChain={file.historyInfo.toolChain}
maxWidth={150}
maxWidth={'150px'}
displayStyle="text"
size="xs"
/>
@ -163,8 +163,8 @@ const FileListItem: React.FC<FileListItemProps> = ({
onToggleExpansion(leafFileId);
}}
>
{isExpanded ?
t('fileManager.hideHistory', 'Hide History') :
{isExpanded ?
t('fileManager.hideHistory', 'Hide History') :
t('fileManager.showHistory', 'Show History')
}
</Menu.Item>

View File

@ -13,38 +13,6 @@ export const useFileManager = () => {
throw new Error('IndexedDB context not available');
}
// Handle drafts differently from regular files
if (fileMetadata.isDraft) {
// Load draft from the drafts database
try {
const { indexedDBManager, DATABASE_CONFIGS } = await import('../services/indexedDBManager');
const db = await indexedDBManager.openDatabase(DATABASE_CONFIGS.DRAFTS);
return new Promise((resolve, reject) => {
const transaction = db.transaction(['drafts'], 'readonly');
const store = transaction.objectStore('drafts');
const request = store.get(fileMetadata.id);
request.onsuccess = () => {
const draft = request.result;
if (draft && draft.pdfData) {
const file = new File([draft.pdfData], fileMetadata.name, {
type: 'application/pdf',
lastModified: fileMetadata.lastModified
});
resolve(file);
} else {
reject(new Error('Draft data not found'));
}
};
request.onerror = () => reject(request.error);
});
} catch (error) {
throw new Error(`Failed to load draft: ${fileMetadata.name} (${error})`);
}
}
// Regular file loading
if (fileMetadata.id) {
const file = await indexedDB.loadFile(fileMetadata.id);