mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-09-18 01:19:24 +00:00
Type fix
This commit is contained in:
parent
22d1c4a740
commit
e40d600759
@ -125,11 +125,11 @@ const FileInfoCard: React.FC<FileInfoCardProps> = ({
|
|||||||
<Divider />
|
<Divider />
|
||||||
<Box py="xs">
|
<Box py="xs">
|
||||||
<Text size="xs" c="dimmed" mb="xs">{t('fileManager.toolChain', 'Tools Applied')}</Text>
|
<Text size="xs" c="dimmed" mb="xs">{t('fileManager.toolChain', 'Tools Applied')}</Text>
|
||||||
<ToolChain
|
<ToolChain
|
||||||
toolChain={currentFile.historyInfo.toolChain}
|
toolChain={currentFile.historyInfo.toolChain}
|
||||||
displayStyle="badges"
|
displayStyle="badges"
|
||||||
size="xs"
|
size="xs"
|
||||||
maxWidth={180}
|
maxWidth={'180px'}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
|
@ -103,12 +103,12 @@ const FileListItem: React.FC<FileListItemProps> = ({
|
|||||||
<Text span c="dimmed"> • {lineagePath.length} versions</Text>
|
<Text span c="dimmed"> • {lineagePath.length} versions</Text>
|
||||||
)}
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
{/* Tool chain for processed files */}
|
{/* Tool chain for processed files */}
|
||||||
{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"
|
||||||
/>
|
/>
|
||||||
@ -163,8 +163,8 @@ const FileListItem: React.FC<FileListItemProps> = ({
|
|||||||
onToggleExpansion(leafFileId);
|
onToggleExpansion(leafFileId);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isExpanded ?
|
{isExpanded ?
|
||||||
t('fileManager.hideHistory', 'Hide History') :
|
t('fileManager.hideHistory', 'Hide History') :
|
||||||
t('fileManager.showHistory', 'Show History')
|
t('fileManager.showHistory', 'Show History')
|
||||||
}
|
}
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user