diff --git a/frontend/src/components/shared/TopControls.tsx b/frontend/src/components/shared/TopControls.tsx
index 308f3d483..bf42b773f 100644
--- a/frontend/src/components/shared/TopControls.tsx
+++ b/frontend/src/components/shared/TopControls.tsx
@@ -19,8 +19,8 @@ const viewOptionStyle = {
// Build view options showing text always
-const createViewOptions = (currentView: WorkbenchType, switchingTo: WorkbenchType | null) => [
- {
+const createViewOptions = (currentView: WorkbenchType, switchingTo: WorkbenchType | null, isToolSelected: boolean) => {
+ const viewerOption = {
label: (
{switchingTo === "viewer" ? (
@@ -32,8 +32,9 @@ const createViewOptions = (currentView: WorkbenchType, switchingTo: WorkbenchTyp
),
value: "viewer",
- },
- {
+ };
+
+ const pageEditorOption = {
label: (
{currentView === "pageEditor" ? (
@@ -50,8 +51,9 @@ const createViewOptions = (currentView: WorkbenchType, switchingTo: WorkbenchTyp
),
value: "pageEditor",
- },
- {
+ };
+
+ const fileEditorOption = {
label: (
{currentView === "fileEditor" ? (
@@ -68,8 +70,15 @@ const createViewOptions = (currentView: WorkbenchType, switchingTo: WorkbenchTyp
),
value: "fileEditor",
- },
-];
+ };
+
+ // Build options array conditionally
+ return [
+ viewerOption,
+ ...(isToolSelected ? [] : [pageEditorOption]),
+ fileEditorOption,
+ ];
+};
interface TopControlsProps {
currentView: WorkbenchType;
@@ -91,7 +100,7 @@ const TopControls = ({
if (!isValidWorkbench(view)) {
return;
}
-
+
const workbench = view;
// Show immediate feedback
@@ -111,39 +120,37 @@ const TopControls = ({
return (
- {!isToolSelected && (
-
-
-
- )}
+
+
+
);
};
diff --git a/frontend/src/types/fileContext.ts b/frontend/src/types/fileContext.ts
index a7a745c5f..12e911621 100644
--- a/frontend/src/types/fileContext.ts
+++ b/frontend/src/types/fileContext.ts
@@ -8,26 +8,6 @@ import { FileId, BaseFileMetadata } from './file';
// Re-export FileId for convenience
export type { FileId };
-export type ModeType =
- | 'viewer'
- | 'pageEditor'
- | 'fileEditor'
- | 'merge'
- | 'split'
- | 'compress'
- | 'ocr'
- | 'convert'
- | 'sanitize'
- | 'addPassword'
- | 'changePermissions'
- | 'addWatermark'
- | 'removePassword'
- | 'single-large-page'
- | 'repair'
- | 'unlockPdfForms'
- | 'removeCertificateSign'
- | 'auto-rename-pdf-file';
-
// Normalized state types
export interface ProcessedFilePage {
thumbnail?: string;
@@ -209,32 +189,6 @@ export function revokeFileResources(record: StirlingFileStub): void {
}
}
-export type OperationType = 'merge' | 'split' | 'compress' | 'add' | 'remove' | 'replace' | 'convert' | 'upload' | 'ocr' | 'sanitize';
-
-export interface FileOperation {
- id: string;
- type: OperationType;
- timestamp: number;
- fileIds: FileId[];
- status: 'pending' | 'applied' | 'failed';
- data?: any;
- metadata?: {
- originalFileName?: string;
- outputFileNames?: string[];
- fileSize?: number;
- pageCount?: number;
- error?: string;
- };
-}
-
-export interface FileOperationHistory {
- fileId: FileId;
- fileName: string;
- operations: (FileOperation | PageOperation)[];
- createdAt: number;
- lastModified: number;
-}
-
export interface ViewerConfig {
zoom: number;
currentPage: number;
diff --git a/frontend/src/types/workbench.ts b/frontend/src/types/workbench.ts
index 8943638f2..37ff0a41f 100644
--- a/frontend/src/types/workbench.ts
+++ b/frontend/src/types/workbench.ts
@@ -9,4 +9,4 @@ export const getDefaultWorkbench = (): WorkbenchType => 'fileEditor';
// Type guard using the same source of truth
export const isValidWorkbench = (value: string): value is WorkbenchType => {
return WORKBENCH_TYPES.includes(value as WorkbenchType);
-};
\ No newline at end of file
+};
diff --git a/frontend/src/utils/toolOperationTracker.ts b/frontend/src/utils/toolOperationTracker.ts
deleted file mode 100644
index b4feb1c8c..000000000
--- a/frontend/src/utils/toolOperationTracker.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { FileId } from '../types/file';
-import { FileOperation } from '../types/fileContext';
-
-/**
- * Creates operation tracking data for FileContext integration
- */
-export const createOperation = (
- operationType: string,
- _params: TParams,
- selectedFiles: File[]
-): { operation: FileOperation; operationId: string; fileId: FileId } => {
- const operationId = `${operationType}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
- const fileId = selectedFiles.map(f => f.name).join(',') as FileId;
-
- const operation: FileOperation = {
- id: operationId,
- type: operationType,
- timestamp: Date.now(),
- fileIds: selectedFiles.map(f => f.name),
- status: 'pending',
- metadata: {
- originalFileName: selectedFiles[0]?.name,
- fileSize: selectedFiles.reduce((sum, f) => sum + f.size, 0)
- }
- } as any /* FIX ME*/;
-
- return { operation, operationId, fileId };
-};