Stirling-PDF/src/main/resources/templates/split-pdf-by-chapters.html

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

157 lines
5.8 KiB
HTML
Raw Normal View History

2025-05-13 23:32:54 +01:00
import React, { useState } from "react";
import PictureAsPdfIcon from '@mui/icons-material/PictureAsPdf';
2024-10-14 22:34:41 +01:00
2025-05-13 23:32:54 +01:00
const tools = [
{ id: "split-pdf", icon: <PictureAsPdfIcon />, name: "Split PDF" }
];
2024-10-14 22:34:41 +01:00
2025-05-13 23:32:54 +01:00
function SplitPdfPanel() {
const [mode, setMode] = useState("byPages");
return (
<div className="p-2 border rounded bg-white shadow-sm space-y-4 text-sm">
<h3 className="font-semibold">Split PDF</h3>
2024-10-14 22:34:41 +01:00
2025-05-13 23:32:54 +01:00
<div>
<label className="block mb-1 font-medium">Split Mode</label>
<select
value={mode}
onChange={(e) => setMode(e.target.value)}
className="w-full border px-2 py-1 rounded"
>
<option value="byPages">Split by Pages (e.g. 1,3,5-10)</option>
<option value="bySections">Split by Grid Sections</option>
<option value="bySizeOrCount">Split by Size or Count</option>
<option value="byChapters">Split by Chapters</option>
</select>
</div>
2024-10-14 22:34:41 +01:00
2025-05-13 23:32:54 +01:00
{mode === "byPages" && (
<div>
<label className="block font-medium mb-1">Pages</label>
<input
type="text"
className="w-full border px-2 py-1 rounded"
placeholder="e.g. 1,3,5-10"
/>
</div>
)}
2024-10-14 22:34:41 +01:00
2025-05-13 23:32:54 +01:00
{mode === "bySections" && (
<div className="space-y-2">
<div>
<label className="block font-medium mb-1">Horizontal Divisions</label>
<input type="number" className="w-full border px-2 py-1 rounded" min="0" max="300" defaultValue="0" />
</div>
<div>
<label className="block font-medium mb-1">Vertical Divisions</label>
<input type="number" className="w-full border px-2 py-1 rounded" min="0" max="300" defaultValue="1" />
</div>
<div className="flex items-center space-x-2">
<input type="checkbox" id="merge" />
<label htmlFor="merge">Merge sections into one PDF</label>
</div>
</div>
)}
2024-10-14 22:34:41 +01:00
2025-05-13 23:32:54 +01:00
{mode === "bySizeOrCount" && (
<div className="space-y-2">
<div>
<label className="block font-medium mb-1">Split Type</label>
<select className="w-full border px-2 py-1 rounded">
<option value="size">By Size</option>
<option value="pages">By Page Count</option>
<option value="docs">By Document Count</option>
</select>
</div>
<div>
<label className="block font-medium mb-1">Split Value</label>
<input type="text" className="w-full border px-2 py-1 rounded" placeholder="e.g. 10MB or 5 pages" />
</div>
</div>
)}
2024-10-14 22:34:41 +01:00
2025-05-13 23:32:54 +01:00
{mode === "byChapters" && (
<div className="space-y-2">
<div>
<label className="block font-medium mb-1">Bookmark Level</label>
<input type="number" className="w-full border px-2 py-1 rounded" defaultValue="0" min="0" />
</div>
<div className="flex items-center space-x-2">
<input type="checkbox" id="includeMetadata" />
<label htmlFor="includeMetadata">Include Metadata</label>
</div>
<div className="flex items-center space-x-2">
<input type="checkbox" id="allowDuplicates" />
<label htmlFor="allowDuplicates">Allow Duplicate Bookmarks</label>
Fixed firefox compatibility and added missing icons to feature pages (#2863) # Description of Changes Fixed icon incompatibility with firefox Added missing icons to feature pages Closes #(2833) ![image](https://github.com/user-attachments/assets/51ba008a-f6ab-4e29-9a79-99d85d152689) --- ## Checklist ### General - [ x] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ x] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ x] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md) (if applicable) - [ x] I have performed a self-review of my own code - [ x] My changes generate no new warnings ### Documentation - [ x] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ x] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ x] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ x] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing) for more details. Co-authored-by: Reece Browne <reece@stirling.pdf>
2025-02-03 15:19:18 +00:00
</div>
2024-10-14 22:34:41 +01:00
</div>
2025-05-13 23:32:54 +01:00
)}
<button className="bg-blue-600 text-white px-4 py-2 rounded mt-2">Split PDF</button>
2024-10-14 22:34:41 +01:00
</div>
2025-05-13 23:32:54 +01:00
);
}
export default function HomePage() {
const [selectedTool, setSelectedTool] = useState(null);
const [search, setSearch] = useState("");
const filteredTools = tools.filter(tool =>
tool.name.toLowerCase().includes(search.toLowerCase())
);
return (
<div className="flex h-screen overflow-hidden">
{/* Left Sidebar */}
<div className="w-64 bg-gray-100 p-4 flex flex-col space-y-2 overflow-y-auto border-r">
<input
type="text"
placeholder="Search tools..."
value={search}
onChange={(e) => setSearch(e.target.value)}
className="mb-3 px-2 py-1 border rounded text-sm"
/>
{filteredTools.map(tool => (
<button
key={tool.id}
title={tool.name}
onClick={() => setSelectedTool(tool)}
className="flex items-center space-x-3 p-2 hover:bg-gray-200 rounded text-left"
>
<div className="text-xl leading-none flex items-center justify-center h-6 w-6">
{tool.icon}
</div>
<span className="text-sm font-medium">{tool.name}</span>
</button>
))}
</div>
{/* Central PDF Viewer Area */}
<div className="flex-1 bg-white flex items-center justify-center overflow-hidden">
<div className="w-full h-full max-w-5xl max-h-[95vh] border rounded shadow-md bg-gray-50 flex items-center justify-center">
<span className="text-gray-400 text-lg">PDF Viewer Placeholder</span>
</div>
</div>
2024-10-14 22:34:41 +01:00
2025-05-13 23:32:54 +01:00
{/* Right Sidebar: Tool Interactions */}
<div className="w-72 bg-gray-50 p-4 border-l overflow-y-auto">
<h2 className="text-lg font-semibold mb-4">Tool Panel</h2>
<div className="space-y-3">
{selectedTool?.id === "split-pdf" ? (
<SplitPdfPanel />
) : selectedTool ? (
<div className="p-2 border rounded bg-white shadow-sm">
<h3 className="font-semibold text-sm mb-2">{selectedTool.name}</h3>
<p className="text-xs text-gray-600">This is the panel for {selectedTool.name}.</p>
</div>
) : (
<div className="p-2 border rounded bg-white shadow-sm">
<p className="text-sm">Select a tool to begin interacting with the PDF.</p>
</div>
)}
</div>
</div>
</div>
);
}