use enum values for category and subcategory

This commit is contained in:
EthanHealy01 2025-08-15 19:38:10 +01:00
parent 681f0abfd8
commit 50def152c7
2 changed files with 161 additions and 140 deletions

View File

@ -5,14 +5,35 @@ import CompressPdfPanel from "../tools/Compress";
import OCRPanel from '../tools/OCR'; import OCRPanel from '../tools/OCR';
import ConvertPanel from '../tools/Convert'; import ConvertPanel from '../tools/Convert';
// Category and subcategory enums for type safety
export enum ToolCategory {
STANDARD_TOOLS = 'Standard Tools',
ADVANCED_TOOLS = 'Advanced Tools',
RECOMMENDED_TOOLS = 'Recommended Tools'
}
export enum ToolSubcategory {
SIGNING = 'Signing',
DOCUMENT_SECURITY = 'Document Security',
VERIFICATION = 'Verification',
DOCUMENT_REVIEW = 'Document Review',
PAGE_FORMATTING = 'Page Formatting',
EXTRACTION = 'Extraction',
REMOVAL = 'Removal',
AUTOMATION = 'Automation',
GENERAL = 'General',
ADVANCED_FORMATTING = 'Advanced Formatting',
DEVELOPER_TOOLS = 'Developer Tools'
}
export type ToolRegistryEntry = { export type ToolRegistryEntry = {
icon: React.ReactNode; icon: React.ReactNode;
name: string; name: string;
component: React.ComponentType<any> | null; component: React.ComponentType<any> | null;
view: string; view: string;
description: string; description: string;
category: string; category: ToolCategory;
subcategory: string; subcategory: ToolSubcategory;
// Optional custom props for tools // Optional custom props for tools
maxFiles?: number; maxFiles?: number;
@ -43,41 +64,41 @@ export type ToolRegistry = {
*/ */
// Ordered list used elsewhere for display ordering // Ordered list used elsewhere for display ordering
// Subcategory display order (top to bottom, left to right) // Subcategory display order (top to bottom, left to right)
export const SUBCATEGORY_ORDER: string[] = [ export const SUBCATEGORY_ORDER: ToolSubcategory[] = [
'Signing', ToolSubcategory.SIGNING,
'Document Security', ToolSubcategory.DOCUMENT_SECURITY,
'Verification', ToolSubcategory.VERIFICATION,
'Document Review', ToolSubcategory.DOCUMENT_REVIEW,
'Page Formatting', ToolSubcategory.PAGE_FORMATTING,
'Extraction', ToolSubcategory.EXTRACTION,
'Removal', ToolSubcategory.REMOVAL,
'Automation', ToolSubcategory.AUTOMATION,
'General', ToolSubcategory.GENERAL,
'Advanced Formatting', ToolSubcategory.ADVANCED_FORMATTING,
'Developer Tools', ToolSubcategory.DEVELOPER_TOOLS,
]; ];
// Color coding for subcategories (loosely resembling the v1 color palette) // Color coding for subcategories (loosely resembling the v1 color palette)
export const SUBCATEGORY_COLOR_MAP: Record<string, string> = { export const SUBCATEGORY_COLOR_MAP: Record<ToolSubcategory, string> = {
// Security & Signing (pink) // Security & Signing (pink)
'Signing': '#FF7892', [ToolSubcategory.SIGNING]: '#FF7892',
'Document Security': '#FF7892', [ToolSubcategory.DOCUMENT_SECURITY]: '#FF7892',
// Review / Verification (blue-green) // Review / Verification (blue-green)
'Verification': '#1BB1D4', [ToolSubcategory.VERIFICATION]: '#1BB1D4',
'Document Review': '#48BD54', [ToolSubcategory.DOCUMENT_REVIEW]: '#48BD54',
// Organize / Page operations (purple/organize + blue accents) // Organize / Page operations (purple/organize + blue accents)
'Page Formatting': '#7882FF', [ToolSubcategory.PAGE_FORMATTING]: '#7882FF',
'Removal': '#7882FF', [ToolSubcategory.REMOVAL]: '#7882FF',
'Extraction': '#1BB1D4', [ToolSubcategory.EXTRACTION]: '#1BB1D4',
// Automation / General quick actions (green) // Automation / General quick actions (green)
'Automation': '#69DC95', [ToolSubcategory.AUTOMATION]: '#69DC95',
'General': '#69DC95', [ToolSubcategory.GENERAL]: '#69DC95',
// Advanced buckets (red family) // Advanced buckets (red family)
'Advanced Formatting': '#F55454', [ToolSubcategory.ADVANCED_FORMATTING]: '#F55454',
'Developer Tools': '#F55454', [ToolSubcategory.DEVELOPER_TOOLS]: '#F55454',
}; };
export const getSubcategoryColor = (subcategory: string): string => { export const getSubcategoryColor = (subcategory: ToolSubcategory): string => {
return SUBCATEGORY_COLOR_MAP[subcategory] || '#7882FF'; return SUBCATEGORY_COLOR_MAP[subcategory] || '#7882FF';
}; };
@ -98,8 +119,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "sign", view: "sign",
description: t("home.certSign.desc", "Signs a PDF with a Certificate/Key (PEM/P12)"), description: t("home.certSign.desc", "Signs a PDF with a Certificate/Key (PEM/P12)"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Signing" subcategory: ToolSubcategory.SIGNING
}, },
"sign": { "sign": {
icon: <span className="material-symbols-rounded">signature</span>, icon: <span className="material-symbols-rounded">signature</span>,
@ -107,8 +128,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "sign", view: "sign",
description: t("home.sign.desc", "Adds signature to PDF by drawing, text or image"), description: t("home.sign.desc", "Adds signature to PDF by drawing, text or image"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Signing" subcategory: ToolSubcategory.SIGNING
}, },
@ -120,8 +141,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "security", view: "security",
description: t("home.addPassword.desc", "Encrypt your PDF document with a password."), description: t("home.addPassword.desc", "Encrypt your PDF document with a password."),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Document Security" subcategory: ToolSubcategory.DOCUMENT_SECURITY
}, },
"add-watermark": { "add-watermark": {
icon: <span className="material-symbols-rounded">branding_watermark</span>, icon: <span className="material-symbols-rounded">branding_watermark</span>,
@ -129,8 +150,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.watermark.desc", "Add a custom watermark to your PDF document."), description: t("home.watermark.desc", "Add a custom watermark to your PDF document."),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Document Security" subcategory: ToolSubcategory.DOCUMENT_SECURITY
}, },
"add-stamp": { "add-stamp": {
icon: <span className="material-symbols-rounded">approval</span>, icon: <span className="material-symbols-rounded">approval</span>,
@ -138,8 +159,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.AddStampRequest.desc", "Add text or add image stamps at set locations"), description: t("home.AddStampRequest.desc", "Add text or add image stamps at set locations"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Document Security" subcategory: ToolSubcategory.DOCUMENT_SECURITY
}, },
"sanitize": { "sanitize": {
icon: <span className="material-symbols-rounded">sanitizer</span>, icon: <span className="material-symbols-rounded">sanitizer</span>,
@ -147,8 +168,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "security", view: "security",
description: t("home.sanitizePdf.desc", "Remove scripts and other elements from PDF files"), description: t("home.sanitizePdf.desc", "Remove scripts and other elements from PDF files"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Document Security" subcategory: ToolSubcategory.DOCUMENT_SECURITY
}, },
"flatten": { "flatten": {
icon: <span className="material-symbols-rounded">layers_clear</span>, icon: <span className="material-symbols-rounded">layers_clear</span>,
@ -156,8 +177,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.flatten.desc", "Remove all interactive elements and forms from a PDF"), description: t("home.flatten.desc", "Remove all interactive elements and forms from a PDF"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Document Security" subcategory: ToolSubcategory.DOCUMENT_SECURITY
}, },
"unlock-pdf-forms": { "unlock-pdf-forms": {
icon: <span className="material-symbols-rounded">preview_off</span>, icon: <span className="material-symbols-rounded">preview_off</span>,
@ -165,8 +186,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "security", view: "security",
description: t("home.unlockPDFForms.desc", "Remove read-only property of form fields in a PDF document."), description: t("home.unlockPDFForms.desc", "Remove read-only property of form fields in a PDF document."),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Document Security" subcategory: ToolSubcategory.DOCUMENT_SECURITY
}, },
"manage-certificates": { "manage-certificates": {
icon: <span className="material-symbols-rounded">license</span>, icon: <span className="material-symbols-rounded">license</span>,
@ -174,8 +195,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "security", view: "security",
description: t("home.manageCertificates.desc", "Import, export, or delete digital certificate files used for signing PDFs."), description: t("home.manageCertificates.desc", "Import, export, or delete digital certificate files used for signing PDFs."),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Document Security" subcategory: ToolSubcategory.DOCUMENT_SECURITY
}, },
@ -187,8 +208,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "extract", view: "extract",
description: t("home.getPdfInfo.desc", "Grabs any and all information possible on PDFs"), description: t("home.getPdfInfo.desc", "Grabs any and all information possible on PDFs"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Verification" subcategory: ToolSubcategory.VERIFICATION
}, },
"validate-pdf-signature": { "validate-pdf-signature": {
icon: <span className="material-symbols-rounded">verified</span>, icon: <span className="material-symbols-rounded">verified</span>,
@ -196,8 +217,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "security", view: "security",
description: t("home.validateSignature.desc", "Verify digital signatures and certificates in PDF documents"), description: t("home.validateSignature.desc", "Verify digital signatures and certificates in PDF documents"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Verification" subcategory: ToolSubcategory.VERIFICATION
}, },
@ -209,8 +230,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "view", view: "view",
description: t("home.read.desc", "View and annotate PDFs. Highlight text, draw, or insert comments for review and collaboration."), description: t("home.read.desc", "View and annotate PDFs. Highlight text, draw, or insert comments for review and collaboration."),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Document Review" subcategory: ToolSubcategory.DOCUMENT_REVIEW
}, },
"change-metadata": { "change-metadata": {
icon: <span className="material-symbols-rounded">assignment</span>, icon: <span className="material-symbols-rounded">assignment</span>,
@ -218,8 +239,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.changeMetadata.desc", "Change/Remove/Add metadata from a PDF document"), description: t("home.changeMetadata.desc", "Change/Remove/Add metadata from a PDF document"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Document Review" subcategory: ToolSubcategory.DOCUMENT_REVIEW
}, },
"change-permissions": { "change-permissions": {
icon: <span className="material-symbols-rounded">admin_panel_settings</span>, icon: <span className="material-symbols-rounded">admin_panel_settings</span>,
@ -227,8 +248,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "security", view: "security",
description: t("home.permissions.desc", "Change the permissions of your PDF document"), description: t("home.permissions.desc", "Change the permissions of your PDF document"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Document Review" subcategory: ToolSubcategory.DOCUMENT_REVIEW
}, },
@ -240,8 +261,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.crop.desc", "Crop a PDF to reduce its size (maintains text!)"), description: t("home.crop.desc", "Crop a PDF to reduce its size (maintains text!)"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Page Formatting" subcategory: ToolSubcategory.PAGE_FORMATTING
}, },
"rotate": { "rotate": {
icon: <span className="material-symbols-rounded">rotate_right</span>, icon: <span className="material-symbols-rounded">rotate_right</span>,
@ -249,8 +270,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.rotate.desc", "Easily rotate your PDFs."), description: t("home.rotate.desc", "Easily rotate your PDFs."),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Page Formatting" subcategory: ToolSubcategory.PAGE_FORMATTING
}, },
"splitPdf": { "splitPdf": {
icon: <span className="material-symbols-rounded">content_cut</span>, icon: <span className="material-symbols-rounded">content_cut</span>,
@ -258,8 +279,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: SplitPdfPanel, component: SplitPdfPanel,
view: "split", view: "split",
description: t("home.split.desc", "Split PDFs into multiple documents"), description: t("home.split.desc", "Split PDFs into multiple documents"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Page Formatting" subcategory: ToolSubcategory.PAGE_FORMATTING
}, },
"reorganize-pages": { "reorganize-pages": {
icon: <span className="material-symbols-rounded">move_down</span>, icon: <span className="material-symbols-rounded">move_down</span>,
@ -267,8 +288,8 @@ 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: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Page Formatting" subcategory: ToolSubcategory.PAGE_FORMATTING
}, },
"adjust-page-size-scale": { "adjust-page-size-scale": {
icon: <span className="material-symbols-rounded">crop_free</span>, icon: <span className="material-symbols-rounded">crop_free</span>,
@ -276,8 +297,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.scalePages.desc", "Change the size/scale of a page and/or its contents."), description: t("home.scalePages.desc", "Change the size/scale of a page and/or its contents."),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Page Formatting" subcategory: ToolSubcategory.PAGE_FORMATTING
}, },
"add-page-numbers": { "add-page-numbers": {
icon: <span className="material-symbols-rounded">123</span>, icon: <span className="material-symbols-rounded">123</span>,
@ -285,8 +306,8 @@ export function useFlatToolRegistry(): ToolRegistry {
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.add-page-numbers.desc", "Add Page numbers throughout a document in a set location"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Page Formatting" subcategory: ToolSubcategory.PAGE_FORMATTING
}, },
"multi-page-layout": { "multi-page-layout": {
icon: <span className="material-symbols-rounded">dashboard</span>, icon: <span className="material-symbols-rounded">dashboard</span>,
@ -294,8 +315,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.pageLayout.desc", "Merge multiple pages of a PDF document into a single page"), description: t("home.pageLayout.desc", "Merge multiple pages of a PDF document into a single page"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Page Formatting" subcategory: ToolSubcategory.PAGE_FORMATTING
}, },
"single-large-page": { "single-large-page": {
icon: <span className="material-symbols-rounded">looks_one</span>, icon: <span className="material-symbols-rounded">looks_one</span>,
@ -303,8 +324,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
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: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Page Formatting" subcategory: ToolSubcategory.PAGE_FORMATTING
}, },
"add-attachments": { "add-attachments": {
icon: <span className="material-symbols-rounded">attachment</span>, icon: <span className="material-symbols-rounded">attachment</span>,
@ -312,8 +333,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.attachments.desc", "Add or remove embedded files (attachments) to/from a PDF"), description: t("home.attachments.desc", "Add or remove embedded files (attachments) to/from a PDF"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Page Formatting", subcategory: ToolSubcategory.PAGE_FORMATTING,
}, },
@ -325,8 +346,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "extract", view: "extract",
description: t("home.extractPage.desc", "Extract specific pages from a PDF document"), description: t("home.extractPage.desc", "Extract specific pages from a PDF document"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Extraction" subcategory: ToolSubcategory.EXTRACTION
}, },
"extract-images": { "extract-images": {
icon: <span className="material-symbols-rounded">filter</span>, icon: <span className="material-symbols-rounded">filter</span>,
@ -334,8 +355,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "extract", view: "extract",
description: t("home.extractImages.desc", "Extract images from PDF documents"), description: t("home.extractImages.desc", "Extract images from PDF documents"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Extraction" subcategory: ToolSubcategory.EXTRACTION
}, },
@ -347,8 +368,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "remove", view: "remove",
description: t("home.removePages.desc", "Remove specific pages from a PDF document"), description: t("home.removePages.desc", "Remove specific pages from a PDF document"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Removal" subcategory: ToolSubcategory.REMOVAL
}, },
"remove-blank-pages": { "remove-blank-pages": {
icon: <span className="material-symbols-rounded">scan_delete</span>, icon: <span className="material-symbols-rounded">scan_delete</span>,
@ -356,8 +377,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "remove", view: "remove",
description: t("home.removeBlanks.desc", "Remove blank pages from PDF documents"), description: t("home.removeBlanks.desc", "Remove blank pages from PDF documents"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Removal" subcategory: ToolSubcategory.REMOVAL
}, },
"remove-annotations": { "remove-annotations": {
icon: <span className="material-symbols-rounded">thread_unread</span>, icon: <span className="material-symbols-rounded">thread_unread</span>,
@ -365,8 +386,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "remove", view: "remove",
description: t("home.removeAnnotations.desc", "Remove annotations and comments from PDF documents"), description: t("home.removeAnnotations.desc", "Remove annotations and comments from PDF documents"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Removal" subcategory: ToolSubcategory.REMOVAL
}, },
"remove-image": { "remove-image": {
icon: <span className="material-symbols-rounded">remove_selection</span>, icon: <span className="material-symbols-rounded">remove_selection</span>,
@ -374,8 +395,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.removeImagePdf.desc", "Remove images from PDF documents"), description: t("home.removeImagePdf.desc", "Remove images from PDF documents"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Removal" subcategory: ToolSubcategory.REMOVAL
}, },
"remove-password": { "remove-password": {
icon: <span className="material-symbols-rounded">lock_open_right</span>, icon: <span className="material-symbols-rounded">lock_open_right</span>,
@ -383,8 +404,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "security", view: "security",
description: t("home.removePassword.desc", "Remove password protection from PDF documents"), description: t("home.removePassword.desc", "Remove password protection from PDF documents"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Removal" subcategory: ToolSubcategory.REMOVAL
}, },
"remove-certificate-sign": { "remove-certificate-sign": {
icon: <span className="material-symbols-rounded">remove_moderator</span>, icon: <span className="material-symbols-rounded">remove_moderator</span>,
@ -392,8 +413,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "security", view: "security",
description: t("home.removeCertSign.desc", "Remove digital signatures from PDF documents"), description: t("home.removeCertSign.desc", "Remove digital signatures from PDF documents"),
category: "Standard Tools", category: ToolCategory.STANDARD_TOOLS,
subcategory: "Removal" subcategory: ToolSubcategory.REMOVAL
}, },
@ -405,8 +426,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.automate.desc", "Build multi-step workflows by chaining together PDF actions. Ideal for recurring tasks."), description: t("home.automate.desc", "Build multi-step workflows by chaining together PDF actions. Ideal for recurring tasks."),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Automation" subcategory: ToolSubcategory.AUTOMATION
}, },
"auto-rename-pdf-file": { "auto-rename-pdf-file": {
icon: <span className="material-symbols-rounded">match_word</span>, icon: <span className="material-symbols-rounded">match_word</span>,
@ -414,8 +435,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.auto-rename.desc", "Automatically rename PDF files based on their content"), description: t("home.auto-rename.desc", "Automatically rename PDF files based on their content"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Automation" subcategory: ToolSubcategory.AUTOMATION
}, },
"auto-split-pages": { "auto-split-pages": {
icon: <span className="material-symbols-rounded">split_scene_right</span>, icon: <span className="material-symbols-rounded">split_scene_right</span>,
@ -423,8 +444,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.autoSplitPDF.desc", "Automatically split PDF pages based on content detection"), description: t("home.autoSplitPDF.desc", "Automatically split PDF pages based on content detection"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Automation" subcategory: ToolSubcategory.AUTOMATION
}, },
"auto-split-by-size-count": { "auto-split-by-size-count": {
icon: <span className="material-symbols-rounded">content_cut</span>, icon: <span className="material-symbols-rounded">content_cut</span>,
@ -432,8 +453,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.autoSizeSplitPDF.desc", "Automatically split PDFs by file size or page count"), description: t("home.autoSizeSplitPDF.desc", "Automatically split PDFs by file size or page count"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Automation" subcategory: ToolSubcategory.AUTOMATION
}, },
@ -445,8 +466,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.adjust-contrast.desc", "Adjust colors and contrast of PDF documents"), description: t("home.adjust-contrast.desc", "Adjust colors and contrast of PDF documents"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Advanced Formatting" subcategory: ToolSubcategory.ADVANCED_FORMATTING
}, },
"repair": { "repair": {
icon: <span className="material-symbols-rounded">build</span>, icon: <span className="material-symbols-rounded">build</span>,
@ -454,8 +475,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.repair.desc", "Repair corrupted or damaged PDF files"), description: t("home.repair.desc", "Repair corrupted or damaged PDF files"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Advanced Formatting" subcategory: ToolSubcategory.ADVANCED_FORMATTING
}, },
"detect-split-scanned-photos": { "detect-split-scanned-photos": {
icon: <span className="material-symbols-rounded">scanner</span>, icon: <span className="material-symbols-rounded">scanner</span>,
@ -463,8 +484,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.ScannerImageSplit.desc", "Detect and split scanned photos into separate pages"), description: t("home.ScannerImageSplit.desc", "Detect and split scanned photos into separate pages"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Advanced Formatting" subcategory: ToolSubcategory.ADVANCED_FORMATTING
}, },
"overlay-pdfs": { "overlay-pdfs": {
icon: <span className="material-symbols-rounded">layers</span>, icon: <span className="material-symbols-rounded">layers</span>,
@ -472,8 +493,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.overlay-pdfs.desc", "Overlay one PDF on top of another"), description: t("home.overlay-pdfs.desc", "Overlay one PDF on top of another"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Advanced Formatting" subcategory: ToolSubcategory.ADVANCED_FORMATTING
}, },
"replace-and-invert-color": { "replace-and-invert-color": {
icon: <span className="material-symbols-rounded">format_color_fill</span>, icon: <span className="material-symbols-rounded">format_color_fill</span>,
@ -481,8 +502,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.replaceColorPdf.desc", "Replace or invert colors in PDF documents"), description: t("home.replaceColorPdf.desc", "Replace or invert colors in PDF documents"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Advanced Formatting" subcategory: ToolSubcategory.ADVANCED_FORMATTING
}, },
"add-image": { "add-image": {
icon: <span className="material-symbols-rounded">image</span>, icon: <span className="material-symbols-rounded">image</span>,
@ -490,8 +511,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.addImage.desc", "Add images to PDF documents"), description: t("home.addImage.desc", "Add images to PDF documents"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Advanced Formatting" subcategory: ToolSubcategory.ADVANCED_FORMATTING
}, },
"edit-table-of-contents": { "edit-table-of-contents": {
icon: <span className="material-symbols-rounded">bookmark_add</span>, icon: <span className="material-symbols-rounded">bookmark_add</span>,
@ -499,8 +520,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.editTableOfContents.desc", "Add or edit bookmarks and table of contents in PDF documents"), description: t("home.editTableOfContents.desc", "Add or edit bookmarks and table of contents in PDF documents"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Advanced Formatting" subcategory: ToolSubcategory.ADVANCED_FORMATTING
}, },
"scanner-effect": { "scanner-effect": {
icon: <span className="material-symbols-rounded">scanner</span>, icon: <span className="material-symbols-rounded">scanner</span>,
@ -508,8 +529,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.fakeScan.desc", "Create a PDF that looks like it was scanned"), description: t("home.fakeScan.desc", "Create a PDF that looks like it was scanned"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Advanced Formatting" subcategory: ToolSubcategory.ADVANCED_FORMATTING
}, },
@ -521,8 +542,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "extract", view: "extract",
description: t("home.showJS.desc", "Extract and display JavaScript code from PDF documents"), description: t("home.showJS.desc", "Extract and display JavaScript code from PDF documents"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Developer Tools" subcategory: ToolSubcategory.DEVELOPER_TOOLS
}, },
"dev-api": { "dev-api": {
icon: <span className="material-symbols-rounded" style={{ color: '#2F7BF6' }}>open_in_new</span>, icon: <span className="material-symbols-rounded" style={{ color: '#2F7BF6' }}>open_in_new</span>,
@ -530,8 +551,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "external", view: "external",
description: t("home.devApi.desc", "Link to API documentation"), description: t("home.devApi.desc", "Link to API documentation"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Developer Tools", subcategory: ToolSubcategory.DEVELOPER_TOOLS,
link: "https://stirlingpdf.io/swagger-ui/5.21.0/index.html" link: "https://stirlingpdf.io/swagger-ui/5.21.0/index.html"
}, },
"dev-folder-scanning": { "dev-folder-scanning": {
@ -540,8 +561,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "external", view: "external",
description: t("home.devFolderScanning.desc", "Link to automated folder scanning guide"), description: t("home.devFolderScanning.desc", "Link to automated folder scanning guide"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Developer Tools", subcategory: ToolSubcategory.DEVELOPER_TOOLS,
link: "https://docs.stirlingpdf.com/Advanced%20Configuration/Folder%20Scanning/" link: "https://docs.stirlingpdf.com/Advanced%20Configuration/Folder%20Scanning/"
}, },
"dev-sso-guide": { "dev-sso-guide": {
@ -550,8 +571,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "external", view: "external",
description: t("home.devSsoGuide.desc", "Link to SSO guide"), description: t("home.devSsoGuide.desc", "Link to SSO guide"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Developer Tools", subcategory: ToolSubcategory.DEVELOPER_TOOLS,
link: "https://docs.stirlingpdf.com/Advanced%20Configuration/Single%20Sign-On%20Configuration", link: "https://docs.stirlingpdf.com/Advanced%20Configuration/Single%20Sign-On%20Configuration",
}, },
"dev-airgapped": { "dev-airgapped": {
@ -560,8 +581,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "external", view: "external",
description: t("home.devAirgapped.desc", "Link to air-gapped setup guide"), description: t("home.devAirgapped.desc", "Link to air-gapped setup guide"),
category: "Advanced Tools", category: ToolCategory.ADVANCED_TOOLS,
subcategory: "Developer Tools", subcategory: ToolSubcategory.DEVELOPER_TOOLS,
link: "https://docs.stirlingpdf.com/Pro/#activation" link: "https://docs.stirlingpdf.com/Pro/#activation"
}, },
@ -573,8 +594,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "format", view: "format",
description: t("home.compare.desc", "Compare two PDF documents and highlight differences"), description: t("home.compare.desc", "Compare two PDF documents and highlight differences"),
category: "Recommended Tools", category: ToolCategory.RECOMMENDED_TOOLS,
subcategory: "General" subcategory: ToolSubcategory.GENERAL
}, },
"compressPdfs": { "compressPdfs": {
icon: <span className="material-symbols-rounded">zoom_in_map</span>, icon: <span className="material-symbols-rounded">zoom_in_map</span>,
@ -582,8 +603,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: CompressPdfPanel, component: CompressPdfPanel,
view: "compress", view: "compress",
description: t("home.compressPdfs.desc", "Compress PDFs to reduce their file size."), description: t("home.compressPdfs.desc", "Compress PDFs to reduce their file size."),
category: "Recommended Tools", category: ToolCategory.RECOMMENDED_TOOLS,
subcategory: "General", subcategory: ToolSubcategory.GENERAL,
maxFiles: -1 maxFiles: -1
}, },
"convert": { "convert": {
@ -592,8 +613,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: ConvertPanel, component: ConvertPanel,
view: "convert", view: "convert",
description: t("home.fileToPDF.desc", "Convert files to and from PDF format"), description: t("home.fileToPDF.desc", "Convert files to and from PDF format"),
category: "Recommended Tools", category: ToolCategory.RECOMMENDED_TOOLS,
subcategory: "General", subcategory: ToolSubcategory.GENERAL,
maxFiles: -1, maxFiles: -1,
endpoints: [ endpoints: [
"pdf-to-img", "pdf-to-img",
@ -636,8 +657,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "merge", view: "merge",
description: t("home.merge.desc", "Merge multiple PDFs into a single document"), description: t("home.merge.desc", "Merge multiple PDFs into a single document"),
category: "Recommended Tools", category: ToolCategory.RECOMMENDED_TOOLS,
subcategory: "General", subcategory: ToolSubcategory.GENERAL,
maxFiles: -1 maxFiles: -1
}, },
"multi-tool": { "multi-tool": {
@ -646,8 +667,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "pageEditor", view: "pageEditor",
description: t("home.multiTool.desc", "Use multiple tools on a single PDF document"), description: t("home.multiTool.desc", "Use multiple tools on a single PDF document"),
category: "Recommended Tools", category: ToolCategory.RECOMMENDED_TOOLS,
subcategory: "General", subcategory: ToolSubcategory.GENERAL,
maxFiles: -1 maxFiles: -1
}, },
"ocr": { "ocr": {
@ -656,8 +677,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: OCRPanel, component: OCRPanel,
view: "convert", view: "convert",
description: t("home.ocr.desc", "Extract text from scanned PDFs using Optical Character Recognition"), description: t("home.ocr.desc", "Extract text from scanned PDFs using Optical Character Recognition"),
category: "Recommended Tools", category: ToolCategory.RECOMMENDED_TOOLS,
subcategory: "General", subcategory: ToolSubcategory.GENERAL,
maxFiles: -1 maxFiles: -1
}, },
"redact": { "redact": {
@ -666,8 +687,8 @@ export function useFlatToolRegistry(): ToolRegistry {
component: null, component: null,
view: "redact", view: "redact",
description: t("home.redact.desc", "Permanently remove sensitive information from PDF documents"), description: t("home.redact.desc", "Permanently remove sensitive information from PDF documents"),
category: "Recommended Tools", category: ToolCategory.RECOMMENDED_TOOLS,
subcategory: "General" subcategory: ToolSubcategory.GENERAL
}, },
}; };
} }

View File

@ -1,5 +1,5 @@
import { useMemo } from 'react'; import { useMemo } from 'react';
import { type ToolRegistryEntry, SUBCATEGORY_ORDER } from '../data/toolRegistry'; import { type ToolRegistryEntry, SUBCATEGORY_ORDER, ToolCategory } from '../data/toolRegistry';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
type GroupedTools = { type GroupedTools = {
@ -25,7 +25,7 @@ export function useToolSections(filteredTools: [string, ToolRegistryEntry][]) {
const sections = useMemo(() => { const sections = useMemo(() => {
const getOrderIndex = (name: string) => { const getOrderIndex = (name: string) => {
const idx = SUBCATEGORY_ORDER.indexOf(name); const idx = SUBCATEGORY_ORDER.indexOf(name as any);
return idx === -1 ? Number.MAX_SAFE_INTEGER : idx; return idx === -1 ? Number.MAX_SAFE_INTEGER : idx;
}; };
@ -40,7 +40,7 @@ export function useToolSections(filteredTools: [string, ToolRegistryEntry][]) {
all[sub].push(...tools); all[sub].push(...tools);
}); });
if (upperCat === 'RECOMMENDED TOOLS') { if (upperCat === ToolCategory.RECOMMENDED_TOOLS.toUpperCase()) {
Object.entries(subs).forEach(([sub, tools]) => { Object.entries(subs).forEach(([sub, tools]) => {
if (!quick[sub]) quick[sub] = []; if (!quick[sub]) quick[sub] = [];
quick[sub].push(...tools); quick[sub].push(...tools);