Remove remaining workbench references

This commit is contained in:
Reece Browne 2025-09-05 11:22:18 +01:00
parent 9eae2573fd
commit 0169145212
2 changed files with 11 additions and 11 deletions

View File

@ -6,7 +6,7 @@ import {
StirlingFileStub, StirlingFileStub,
FileContextAction, FileContextAction,
FileContextState, FileContextState,
toWorkbenchFile, toStirlingFileStub,
createFileId, createFileId,
createQuickKey createQuickKey
} from '../../types/fileContext'; } from '../../types/fileContext';
@ -163,7 +163,7 @@ export async function addFiles(
} }
// Create record with immediate thumbnail and page metadata // Create record with immediate thumbnail and page metadata
const record = toWorkbenchFile(file, fileId); const record = toStirlingFileStub(file, fileId);
if (thumbnail) { if (thumbnail) {
record.thumbnailUrl = thumbnail; record.thumbnailUrl = thumbnail;
// Track blob URLs for cleanup (images return blob URLs that need revocation) // Track blob URLs for cleanup (images return blob URLs that need revocation)
@ -205,7 +205,7 @@ export async function addFiles(
const fileId = createFileId(); const fileId = createFileId();
filesRef.current.set(fileId, file); filesRef.current.set(fileId, file);
const record = toWorkbenchFile(file, fileId); const record = toStirlingFileStub(file, fileId);
if (thumbnail) { if (thumbnail) {
record.thumbnailUrl = thumbnail; record.thumbnailUrl = thumbnail;
// Track blob URLs for cleanup (images return blob URLs that need revocation) // Track blob URLs for cleanup (images return blob URLs that need revocation)
@ -254,7 +254,7 @@ export async function addFiles(
filesRef.current.set(fileId, file); filesRef.current.set(fileId, file);
const record = toWorkbenchFile(file, fileId); const record = toStirlingFileStub(file, fileId);
// Generate processedFile metadata for stored files // Generate processedFile metadata for stored files
let pageCount: number = 1; let pageCount: number = 1;
@ -347,7 +347,7 @@ async function processFilesIntoRecords(
if (DEBUG) console.warn(`📄 Failed to generate thumbnail for file ${file.name}:`, error); if (DEBUG) console.warn(`📄 Failed to generate thumbnail for file ${file.name}:`, error);
} }
const record = toWorkbenchFile(file, fileId); const record = toStirlingFileStub(file, fileId);
if (thumbnail) { if (thumbnail) {
record.thumbnailUrl = thumbnail; record.thumbnailUrl = thumbnail;
} }

View File

@ -46,7 +46,7 @@ export interface ProcessedFileMetadata {
/** /**
* StirlingFileStub - Metadata record for files in the active workbench session * StirlingFileStub - Metadata record for files in the active workbench session
* *
* Contains UI display data and processing state. Actual File objects stored * Contains UI display data and processing state. Actual File objects stored
* separately in refs for memory efficiency. Supports multi-tool workflows * separately in refs for memory efficiency. Supports multi-tool workflows
* where files persist across tool operations. * where files persist across tool operations.
@ -117,7 +117,7 @@ export function createStirlingFile(file: File, id?: FileId): StirlingFile {
enumerable: true, enumerable: true,
configurable: false configurable: false
}); });
Object.defineProperty(file, 'quickKey', { Object.defineProperty(file, 'quickKey', {
value: quickKey, value: quickKey,
writable: false, writable: false,
@ -150,7 +150,10 @@ export function isFileObject(obj: any): obj is File | StirlingFile {
export function toWorkbenchFile(file: File, id?: FileId): StirlingFileStub { export function toStirlingFileStub(
file: File,
id?: FileId
): StirlingFileStub {
const fileId = id || createFileId(); const fileId = id || createFileId();
return { return {
id: fileId, id: fileId,
@ -350,6 +353,3 @@ export interface FileContextActionsValue {
actions: FileContextActions; actions: FileContextActions;
dispatch: (action: FileContextAction) => void; dispatch: (action: FileContextAction) => void;
} }
// TODO: URL parameter types will be redesigned for new routing system