feat: add Simple Mode for internal organizational use

This commit is contained in:
Lalit Sudhir
2025-10-20 01:42:50 -07:00
parent 6270080045
commit f037e27535
7 changed files with 181 additions and 2 deletions

View File

@@ -9,6 +9,9 @@ RUN npm ci
COPY . . COPY . .
# Build without type checking (vite build only) # Build without type checking (vite build only)
# Pass SIMPLE_MODE environment variable if provided
ARG SIMPLE_MODE=false
ENV SIMPLE_MODE=$SIMPLE_MODE
RUN npm run build -- --mode production RUN npm run build -- --mode production
# Production stage # Production stage

View File

@@ -130,6 +130,18 @@ docker-compose up -d
The application will be available at `http://localhost:3000`. The application will be available at `http://localhost:3000`.
### 🏢 Simple Mode for Internal Use
For organizations that want a clean, distraction-free interface focused solely on PDF tools, BentoPDF supports a **Simple Mode** that hides all branding and marketing content.
**What Simple Mode does:**
- Hides navigation, hero section, features, FAQ, testimonials, and footer
- Shows only the essential PDF tools
- Updates page title to "PDF Tools"
- Perfect for internal company tools and educational institutions
For more details, see [SIMPLE_MODE.md](SIMPLE_MODE.md).
### 📦 Version Management ### 📦 Version Management
BentoPDF supports semantic versioning with multiple Docker tags: BentoPDF supports semantic versioning with multiple Docker tags:

85
SIMPLE_MODE.md Normal file
View File

@@ -0,0 +1,85 @@
# Simple Mode for BentoPDF
Simple Mode is designed for internal organizational use where you want to hide all branding and marketing content, showing only the essential PDF tools for your users.
## What Simple Mode Does
When enabled, Simple Mode will:
- Hide the navigation bar
- Hide the hero section with marketing content
- Hide the features section
- Hide the security/compliance section
- Hide the FAQ section
- Hide the testimonials section
- Hide the support section
- Hide the footer
- Update the page title to "PDF Tools"
- Make the tools section more prominent
## How to Enable Simple Mode
### Using Docker Compose
1. Create a `.env` file in your project root:
```bash
SIMPLE_MODE=true
```
2. Run with docker-compose:
```bash
docker-compose up -d
```
### Using Docker Build
Build the image with the SIMPLE_MODE environment variable:
```bash
docker build --build-arg SIMPLE_MODE=true -t bentopdf-simple .
```
### Using Environment Variables
Set the environment variable before building:
```bash
export SIMPLE_MODE=true
npm run build
```
## 🧪 Testing Simple Mode Locally
After building with Simple Mode enabled, you need to serve the built files locally.
```bash
# Build with simple mode
SIMPLE_MODE=true npm run build
# Serve the built files
npx serve dist -p 3000
```
Then open `http://localhost:3000` in your browser.
## 🔍 What to Look For
When Simple Mode is working correctly, you should see:
- ✅ Clean "PDF Tools" header (no marketing hero section)
- ✅ "Select a tool to get started" subtitle
- ✅ Search bar for tools
- ✅ All PDF tool cards organized by category
- ❌ No navigation bar
- ❌ No hero section with "The PDF Toolkit built for privacy"
- ❌ No features, FAQ, testimonials, or footer sections
## Example Docker Compose Configuration
```yaml
services:
bentopdf:
image: bentopdf/bentopdf:latest
container_name: bentopdf
restart: unless-stopped
ports:
- '3000:80'
environment:
- SIMPLE_MODE=true
```

View File

@@ -5,3 +5,5 @@ services:
restart: unless-stopped restart: unless-stopped
ports: ports:
- '3000:80' - '3000:80'
environment:
- SIMPLE_MODE=${SIMPLE_MODE:-false}

View File

@@ -5,12 +5,85 @@ import { createIcons, icons } from 'lucide';
import * as pdfjsLib from 'pdfjs-dist'; import * as pdfjsLib from 'pdfjs-dist';
import '../css/styles.css'; import '../css/styles.css';
const hideBrandingSections = () => {
const nav = document.querySelector('nav');
if (nav) {
nav.style.display = 'none';
}
const heroSection = document.getElementById('hero-section');
if (heroSection) {
heroSection.style.display = 'none';
}
const featuresSection = document.getElementById('features-section');
if (featuresSection) {
featuresSection.style.display = 'none';
}
const securitySection = document.getElementById('security-compliance-section');
if (securitySection) {
securitySection.style.display = 'none';
}
const faqSection = document.getElementById('faq-accordion');
if (faqSection) {
faqSection.style.display = 'none';
}
const testimonialsSection = document.getElementById('testimonials-section');
if (testimonialsSection) {
testimonialsSection.style.display = 'none';
}
const supportSection = document.getElementById('support-section');
if (supportSection) {
supportSection.style.display = 'none';
}
const footer = document.querySelector('footer');
if (footer) {
footer.style.display = 'none';
}
const sectionDividers = document.querySelectorAll('.section-divider');
sectionDividers.forEach(divider => {
(divider as HTMLElement).style.display = 'none';
});
document.title = 'PDF Tools';
const toolsHeader = document.getElementById('tools-header');
if (toolsHeader) {
const title = toolsHeader.querySelector('h2');
const subtitle = toolsHeader.querySelector('p');
if (title) {
title.textContent = 'PDF Tools';
title.className = 'text-4xl md:text-5xl font-bold text-white mb-3';
}
if (subtitle) {
subtitle.textContent = 'Select a tool to get started';
subtitle.className = 'text-lg text-gray-400';
}
}
const app = document.getElementById('app');
if (app) {
app.style.paddingTop = '2rem';
}
};
const init = () => { const init = () => {
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL( pdfjsLib.GlobalWorkerOptions.workerSrc = new URL(
'pdfjs-dist/build/pdf.worker.min.mjs', 'pdfjs-dist/build/pdf.worker.min.mjs',
import.meta.url import.meta.url
).toString(); ).toString();
// Handle simple mode - hide branding sections
if (__SIMPLE_MODE__) {
hideBrandingSections();
}
dom.toolGrid.textContent = ''; dom.toolGrid.textContent = '';
categories.forEach((category) => { categories.forEach((category) => {

1
src/types/globals.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
declare const __SIMPLE_MODE__: boolean;

View File

@@ -3,7 +3,7 @@ import tailwindcss from '@tailwindcss/vite';
import { nodePolyfills } from 'vite-plugin-node-polyfills'; import { nodePolyfills } from 'vite-plugin-node-polyfills';
import { resolve } from 'path'; import { resolve } from 'path';
export default defineConfig({ export default defineConfig(({ mode }) => ({
plugins: [ plugins: [
tailwindcss(), tailwindcss(),
nodePolyfills({ nodePolyfills({
@@ -15,6 +15,9 @@ export default defineConfig({
}, },
}), }),
], ],
define: {
__SIMPLE_MODE__: JSON.stringify(process.env.SIMPLE_MODE === 'true'),
},
resolve: { resolve: {
alias: { alias: {
stream: 'stream-browserify', stream: 'stream-browserify',
@@ -52,4 +55,4 @@ export default defineConfig({
], ],
}, },
}, },
}); }));