V2 hide incomplete tools (#4250)

# Description of Changes
Filters out tools which don't exist in All Tools list. Also fixes a
bunch of translation warnings in the log.
This commit is contained in:
James Brunton 2025-08-21 09:26:17 +01:00 committed by GitHub
parent a6706fcb0c
commit a33e51351b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 96 additions and 107 deletions

View File

@ -366,14 +366,6 @@
"title": "Convert", "title": "Convert",
"desc": "Convert files between different formats" "desc": "Convert files between different formats"
}, },
"imageToPDF": {
"title": "Image to PDF",
"desc": "Convert a image (PNG, JPEG, GIF) to PDF."
},
"pdfToImage": {
"title": "PDF to Image",
"desc": "Convert a PDF to a image. (PNG, JPEG, GIF)"
},
"pdfOrganiser": { "pdfOrganiser": {
"title": "Organise", "title": "Organise",
"desc": "Remove/Rearrange pages in any order" "desc": "Remove/Rearrange pages in any order"
@ -390,14 +382,6 @@
"title": "Add Watermark", "title": "Add Watermark",
"desc": "Add a custom watermark to your PDF document." "desc": "Add a custom watermark to your PDF document."
}, },
"permissions": {
"title": "Change Permissions",
"desc": "Change the permissions of your PDF document"
},
"pageRemover": {
"title": "Remove",
"desc": "Delete unwanted pages from your PDF document."
},
"removePassword": { "removePassword": {
"title": "Remove Password", "title": "Remove Password",
"desc": "Remove password protection from your PDF document." "desc": "Remove password protection from your PDF document."
@ -414,10 +398,6 @@
"title": "Change Metadata", "title": "Change Metadata",
"desc": "Change/Remove/Add metadata from a PDF document" "desc": "Change/Remove/Add metadata from a PDF document"
}, },
"fileToPDF": {
"title": "Convert file to PDF",
"desc": "Convert nearly any file to PDF (DOCX, PNG, XLS, PPT, TXT and more)"
},
"ocr": { "ocr": {
"title": "OCR / Cleanup scans", "title": "OCR / Cleanup scans",
"desc": "Cleanup scans and detects text from images within a PDF and re-adds it as text." "desc": "Cleanup scans and detects text from images within a PDF and re-adds it as text."
@ -426,30 +406,6 @@
"title": "Extract Images", "title": "Extract Images",
"desc": "Extracts all images from a PDF and saves them to zip" "desc": "Extracts all images from a PDF and saves them to zip"
}, },
"pdfToPDFA": {
"title": "PDF to PDF/A",
"desc": "Convert PDF to PDF/A for long-term storage"
},
"PDFToWord": {
"title": "PDF to Word",
"desc": "Convert PDF to Word formats (DOC, DOCX and ODT)"
},
"PDFToPresentation": {
"title": "PDF to Presentation",
"desc": "Convert PDF to Presentation formats (PPT, PPTX and ODP)"
},
"PDFToText": {
"title": "PDF to RTF (Text)",
"desc": "Convert PDF to Text or RTF format"
},
"PDFToHTML": {
"title": "PDF to HTML",
"desc": "Convert PDF to HTML format"
},
"PDFToXML": {
"title": "PDF to XML",
"desc": "Convert PDF to XML format"
},
"ScannerImageSplit": { "ScannerImageSplit": {
"title": "Detect/Split Scanned photos", "title": "Detect/Split Scanned photos",
"desc": "Splits multiple photos from within a photo/PDF" "desc": "Splits multiple photos from within a photo/PDF"
@ -518,34 +474,14 @@
"title": "Auto Split Pages", "title": "Auto Split Pages",
"desc": "Auto Split Scanned PDF with physical scanned page splitter QR Code" "desc": "Auto Split Scanned PDF with physical scanned page splitter QR Code"
}, },
"sanitizePdf": { "sanitize": {
"title": "Sanitise", "title": "Sanitise",
"desc": "Remove scripts and other elements from PDF files" "desc": "Remove potentially harmful elements from PDF files"
},
"URLToPDF": {
"title": "URL/Website To PDF",
"desc": "Converts any http(s)URL to PDF"
},
"HTMLToPDF": {
"title": "HTML to PDF",
"desc": "Converts any HTML file or zip to PDF"
},
"MarkdownToPDF": {
"title": "Markdown to PDF",
"desc": "Converts any Markdown file to PDF"
},
"PDFToMarkdown": {
"title": "PDF to Markdown",
"desc": "Converts any PDF to Markdown"
}, },
"getPdfInfo": { "getPdfInfo": {
"title": "Get ALL Info on PDF", "title": "Get ALL Info on PDF",
"desc": "Grabs any and all information possible on PDFs" "desc": "Grabs any and all information possible on PDFs"
}, },
"pageExtracter": {
"title": "Extract page(s)",
"desc": "Extracts select pages from PDF"
},
"pdfToSinglePage": { "pdfToSinglePage": {
"title": "PDF to Single Large Page", "title": "PDF to Single Large Page",
"desc": "Merges all PDF pages into one large single page" "desc": "Merges all PDF pages into one large single page"
@ -562,14 +498,6 @@
"title": "Manual Redaction", "title": "Manual Redaction",
"desc": "Redacts a PDF based on selected text, drawn shapes and/or selected page(s)" "desc": "Redacts a PDF based on selected text, drawn shapes and/or selected page(s)"
}, },
"PDFToCSV": {
"title": "PDF to CSV",
"desc": "Extracts Tables from a PDF converting it to CSV"
},
"split-by-size-or-count": {
"title": "Auto Split by Size/Count",
"desc": "Split a single PDF into multiple documents based on size, page count, or document count"
},
"overlay-pdfs": { "overlay-pdfs": {
"title": "Overlay PDFs", "title": "Overlay PDFs",
"desc": "Overlays PDFs on-top of another PDF" "desc": "Overlays PDFs on-top of another PDF"
@ -625,6 +553,54 @@
"reorganizePages": { "reorganizePages": {
"title": "Reorganize Pages", "title": "Reorganize Pages",
"desc": "Rearrange, duplicate, or delete PDF pages with visual drag-and-drop control." "desc": "Rearrange, duplicate, or delete PDF pages with visual drag-and-drop control."
},
"extractPages": {
"title": "Extract Pages",
"desc": "Extract specific pages from a PDF document"
},
"removePages": {
"title": "Remove Pages",
"desc": "Remove specific pages from a PDF document"
},
"removeImagePdf": {
"title": "Remove Image",
"desc": "Remove images from PDF documents"
},
"autoSizeSplitPDF": {
"title": "Auto Split by Size/Count",
"desc": "Automatically split PDFs by file size or page count"
},
"adjust-contrast": {
"title": "Adjust Colours/Contrast",
"desc": "Adjust colours and contrast of PDF documents"
},
"replaceColorPdf": {
"title": "Replace & Invert Colour",
"desc": "Replace or invert colours in PDF documents"
},
"devApi": {
"title": "API",
"desc": "Link to API documentation"
},
"devFolderScanning": {
"title": "Automated Folder Scanning",
"desc": "Link to automated folder scanning guide"
},
"devSsoGuide": {
"title": "SSO Guide",
"desc": "Link to SSO guide"
},
"devAirgapped": {
"title": "Air-gapped Setup",
"desc": "Link to air-gapped setup guide"
},
"addPassword": {
"title": "Add Password",
"desc": "Add password protection and restrictions to PDF files"
},
"changePermissions": {
"title": "Change Permissions",
"desc": "Change document restrictions and permissions"
} }
}, },
"viewPdf": { "viewPdf": {

View File

@ -1,5 +1,6 @@
import { type TFunction } from 'i18next'; import { type TFunction } from 'i18next';
import React from 'react'; import React from 'react';
import { BaseToolProps } from '../types/tool';
export enum SubcategoryId { export enum SubcategoryId {
SIGNING = 'signing', SIGNING = 'signing',
@ -24,7 +25,7 @@ export enum ToolCategory {
export type ToolRegistryEntry = { export type ToolRegistryEntry = {
icon: React.ReactNode; icon: React.ReactNode;
name: string; name: string;
component: React.ComponentType<any> | null; component: React.ComponentType<BaseToolProps> | null;
view: 'sign' | 'security' | 'format' | 'extract' | 'view' | 'merge' | 'pageEditor' | 'convert' | 'redact' | 'split' | 'convert' | 'remove' | 'compress' | 'external'; view: 'sign' | 'security' | 'format' | 'extract' | 'view' | 'merge' | 'pageEditor' | 'convert' | 'redact' | 'split' | 'convert' | 'remove' | 'compress' | 'external';
description: string; description: string;
category: ToolCategory; category: ToolCategory;

View File

@ -15,13 +15,13 @@ import SingleLargePage from '../tools/SingleLargePage';
import UnlockPdfForms from '../tools/UnlockPdfForms'; import UnlockPdfForms from '../tools/UnlockPdfForms';
import RemoveCertificateSign from '../tools/RemoveCertificateSign'; import RemoveCertificateSign from '../tools/RemoveCertificateSign';
const showPlaceholderTools = false; // For development purposes. Allows seeing the full list of tools, even if they're unimplemented
// Hook to get the translated tool registry // Hook to get the translated tool registry
export function useFlatToolRegistry(): ToolRegistry { export function useFlatToolRegistry(): ToolRegistry {
const { t } = useTranslation(); const { t } = useTranslation();
return { const allTools: ToolRegistry = {
// Signing // Signing
"certSign": { "certSign": {
@ -56,8 +56,8 @@ export function useFlatToolRegistry(): ToolRegistry {
subcategory: SubcategoryId.DOCUMENT_SECURITY, subcategory: SubcategoryId.DOCUMENT_SECURITY,
maxFiles: -1, maxFiles: -1,
endpoints: ["add-password"] endpoints: ["add-password"]
}, },
"add-watermark": { "watermark": {
icon: <span className="material-symbols-rounded">branding_watermark</span>, icon: <span className="material-symbols-rounded">branding_watermark</span>,
name: t("home.watermark.title", "Add Watermark"), name: t("home.watermark.title", "Add Watermark"),
component: AddWatermark, component: AddWatermark,
@ -148,8 +148,8 @@ export function useFlatToolRegistry(): ToolRegistry {
category: ToolCategory.STANDARD_TOOLS, category: ToolCategory.STANDARD_TOOLS,
subcategory: SubcategoryId.VERIFICATION subcategory: SubcategoryId.VERIFICATION
}, },
// Document Review // Document Review
"read": { "read": {
@ -205,7 +205,7 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "pageEditor", view: "pageEditor",
description: t("home.reorganizePages.desc", "Rearrange, duplicate, or delete PDF pages with visual drag-and-drop control."), description: t("home.reorganizePages.desc", "Rearrange, duplicate, or delete PDF pages with visual drag-and-drop control."),
category: ToolCategory.STANDARD_TOOLS, category: ToolCategory.STANDARD_TOOLS,
subcategory: SubcategoryId.PAGE_FORMATTING subcategory: SubcategoryId.PAGE_FORMATTING
}, },
"adjust-page-size-scale": { "adjust-page-size-scale": {
@ -217,12 +217,12 @@ export function useFlatToolRegistry(): ToolRegistry {
category: ToolCategory.STANDARD_TOOLS, category: ToolCategory.STANDARD_TOOLS,
subcategory: SubcategoryId.PAGE_FORMATTING subcategory: SubcategoryId.PAGE_FORMATTING
}, },
"add-page-numbers": { "addPageNumbers": {
icon: <span className="material-symbols-rounded">123</span>, icon: <span className="material-symbols-rounded">123</span>,
name: t("home.add-page-numbers.title", "Add Page Numbers"), name: t("home.addPageNumbers.title", "Add Page Numbers"),
component: null, component: null,
view: "format", view: "format",
description: t("home.add-page-numbers.desc", "Add Page numbers throughout a document in a set location"), description: t("home.addPageNumbers.desc", "Add Page numbers throughout a document in a set location"),
category: ToolCategory.STANDARD_TOOLS, category: ToolCategory.STANDARD_TOOLS,
subcategory: SubcategoryId.PAGE_FORMATTING subcategory: SubcategoryId.PAGE_FORMATTING
}, },
@ -237,10 +237,10 @@ export function useFlatToolRegistry(): ToolRegistry {
}, },
"single-large-page": { "single-large-page": {
icon: <span className="material-symbols-rounded">looks_one</span>, icon: <span className="material-symbols-rounded">looks_one</span>,
name: t("home.PdfToSinglePage.title", "PDF to Single Large Page"), name: t("home.pdfToSinglePage.title", "PDF to Single Large Page"),
component: SingleLargePage, component: SingleLargePage,
view: "format", view: "format",
description: t("home.PdfToSinglePage.desc", "Merges all PDF pages into one large single page"), description: t("home.pdfToSinglePage.desc", "Merges all PDF pages into one large single page"),
category: ToolCategory.STANDARD_TOOLS, category: ToolCategory.STANDARD_TOOLS,
subcategory: SubcategoryId.PAGE_FORMATTING, subcategory: SubcategoryId.PAGE_FORMATTING,
maxFiles: -1, maxFiles: -1,
@ -259,12 +259,12 @@ export function useFlatToolRegistry(): ToolRegistry {
// Extraction // Extraction
"extract-pages": { "extractPages": {
icon: <span className="material-symbols-rounded">upload</span>, icon: <span className="material-symbols-rounded">upload</span>,
name: t("home.extractPage.title", "Extract Pages"), name: t("home.extractPages.title", "Extract Pages"),
component: null, component: null,
view: "extract", view: "extract",
description: t("home.extractPage.desc", "Extract specific pages from a PDF document"), description: t("home.extractPages.desc", "Extract specific pages from a PDF document"),
category: ToolCategory.STANDARD_TOOLS, category: ToolCategory.STANDARD_TOOLS,
subcategory: SubcategoryId.EXTRACTION subcategory: SubcategoryId.EXTRACTION
}, },
@ -281,7 +281,7 @@ export function useFlatToolRegistry(): ToolRegistry {
// Removal // Removal
"remove": { "removePages": {
icon: <span className="material-symbols-rounded">delete</span>, icon: <span className="material-symbols-rounded">delete</span>,
name: t("home.removePages.title", "Remove Pages"), name: t("home.removePages.title", "Remove Pages"),
component: null, component: null,
@ -331,10 +331,10 @@ export function useFlatToolRegistry(): ToolRegistry {
}, },
"remove-certificate-sign": { "remove-certificate-sign": {
icon: <span className="material-symbols-rounded">remove_moderator</span>, icon: <span className="material-symbols-rounded">remove_moderator</span>,
name: t("home.removeCertSign.title", "Remove Certificate Signatures"), name: t("home.removeCertSign.title", "Remove Certificate Sign"),
component: RemoveCertificateSign, component: RemoveCertificateSign,
view: "security", view: "security",
description: t("home.removeCertSign.desc", "Remove digital signatures from PDF documents"), description: t("home.removeCertSign.desc", "Remove digital signature from PDF documents"),
category: ToolCategory.STANDARD_TOOLS, category: ToolCategory.STANDARD_TOOLS,
subcategory: SubcategoryId.REMOVAL, subcategory: SubcategoryId.REMOVAL,
maxFiles: -1, maxFiles: -1,
@ -384,12 +384,12 @@ export function useFlatToolRegistry(): ToolRegistry {
// Advanced Formatting // Advanced Formatting
"adjust-colors-contrast": { "adjustContrast": {
icon: <span className="material-symbols-rounded">palette</span>, icon: <span className="material-symbols-rounded">palette</span>,
name: t("home.adjust-contrast.title", "Adjust Colors/Contrast"), name: t("home.adjustContrast.title", "Adjust Colors/Contrast"),
component: null, component: null,
view: "format", view: "format",
description: t("home.adjust-contrast.desc", "Adjust colors and contrast of PDF documents"), description: t("home.adjustContrast.desc", "Adjust colors and contrast of PDF documents"),
category: ToolCategory.ADVANCED_TOOLS, category: ToolCategory.ADVANCED_TOOLS,
subcategory: SubcategoryId.ADVANCED_FORMATTING subcategory: SubcategoryId.ADVANCED_FORMATTING
}, },
@ -523,22 +523,22 @@ export function useFlatToolRegistry(): ToolRegistry {
category: ToolCategory.RECOMMENDED_TOOLS, category: ToolCategory.RECOMMENDED_TOOLS,
subcategory: SubcategoryId.GENERAL subcategory: SubcategoryId.GENERAL
}, },
"compressPdfs": { "compress": {
icon: <span className="material-symbols-rounded">zoom_in_map</span>, icon: <span className="material-symbols-rounded">zoom_in_map</span>,
name: t("home.compressPdfs.title", "Compress"), name: t("home.compress.title", "Compress"),
component: CompressPdfPanel, component: CompressPdfPanel,
view: "compress", view: "compress",
description: t("home.compressPdfs.desc", "Compress PDFs to reduce their file size."), description: t("home.compress.desc", "Compress PDFs to reduce their file size."),
category: ToolCategory.RECOMMENDED_TOOLS, category: ToolCategory.RECOMMENDED_TOOLS,
subcategory: SubcategoryId.GENERAL, subcategory: SubcategoryId.GENERAL,
maxFiles: -1 maxFiles: -1
}, },
"convert": { "convert": {
icon: <span className="material-symbols-rounded">sync_alt</span>, icon: <span className="material-symbols-rounded">sync_alt</span>,
name: t("home.fileToPDF.title", "Convert"), name: t("home.convert.title", "Convert"),
component: ConvertPanel, component: ConvertPanel,
view: "convert", view: "convert",
description: t("home.fileToPDF.desc", "Convert files to and from PDF format"), description: t("home.convert.desc", "Convert files to and from PDF format"),
category: ToolCategory.RECOMMENDED_TOOLS, category: ToolCategory.RECOMMENDED_TOOLS,
subcategory: SubcategoryId.GENERAL, subcategory: SubcategoryId.GENERAL,
maxFiles: -1, maxFiles: -1,
@ -616,5 +616,17 @@ export function useFlatToolRegistry(): ToolRegistry {
category: ToolCategory.RECOMMENDED_TOOLS, category: ToolCategory.RECOMMENDED_TOOLS,
subcategory: SubcategoryId.GENERAL subcategory: SubcategoryId.GENERAL
}, },
}; };
}
if (showPlaceholderTools) {
return allTools;
} else {
const filteredTools = Object.keys(allTools)
.filter(key => allTools[key].component !== null || allTools[key].link)
.reduce((obj, key) => {
obj[key] = allTools[key];
return obj;
}, {} as ToolRegistry);
return filteredTools;
}
}

View File

@ -48,8 +48,8 @@ export const useToolManagement = (): ToolManagementResult => {
const baseTool = baseRegistry[toolKey as keyof typeof baseRegistry]; const baseTool = baseRegistry[toolKey as keyof typeof baseRegistry];
availableToolRegistry[toolKey] = { availableToolRegistry[toolKey] = {
...baseTool, ...baseTool,
name: t(baseTool.name), name: baseTool.name,
description: t(baseTool.description) description: baseTool.description,
}; };
} }
}); });