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

@ -129,7 +129,7 @@ const FileInfoCard: React.FC<FileInfoCardProps> = ({
toolChain={currentFile.historyInfo.toolChain} toolChain={currentFile.historyInfo.toolChain}
displayStyle="badges" displayStyle="badges"
size="xs" size="xs"
maxWidth={180} maxWidth={'180px'}
/> />
</Box> </Box>
</> </>

View File

@ -108,7 +108,7 @@ const FileListItem: React.FC<FileListItemProps> = ({
{file.historyInfo?.toolChain && file.historyInfo.toolChain.length > 0 && ( {file.historyInfo?.toolChain && file.historyInfo.toolChain.length > 0 && (
<ToolChain <ToolChain
toolChain={file.historyInfo.toolChain} toolChain={file.historyInfo.toolChain}
maxWidth={150} maxWidth={'150px'}
displayStyle="text" displayStyle="text"
size="xs" size="xs"
/> />

View File

@ -13,38 +13,6 @@ export const useFileManager = () => {
throw new Error('IndexedDB context not available'); 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 // Regular file loading
if (fileMetadata.id) { if (fileMetadata.id) {
const file = await indexedDB.loadFile(fileMetadata.id); const file = await indexedDB.loadFile(fileMetadata.id);