mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-09-18 09:29:24 +00:00
Type fix
This commit is contained in:
parent
22d1c4a740
commit
e40d600759
@ -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>
|
||||||
</>
|
</>
|
||||||
|
@ -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"
|
||||||
/>
|
/>
|
||||||
|
@ -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