Compare commits

..

45 Commits

Author SHA1 Message Date
bc73fcebd3 added pragma statements in .sql 2025-10-28 17:39:45 +01:00
82533ae616 added .env.production to .gitignore 2025-10-28 17:33:26 +01:00
840b4384a5 using static frontend build path for static expresss 2025-10-28 17:29:15 +01:00
5a8b7e89d7 removed unused imports 2025-10-28 16:49:53 +01:00
289c80eea1 removed unused .css files 2025-10-28 16:45:57 +01:00
1884a16220 changed setup button color 2025-10-28 15:58:24 +01:00
478578308d changed noting 2025-10-26 17:15:08 +01:00
93a52aa196 changed production routing for frontend build 2025-10-26 16:56:50 +01:00
donpat1to
b11c55c1d9 Update docker.yml 2025-10-26 16:13:43 +01:00
16302f2105 changed tagging logic for latest versions 2025-10-26 16:09:02 +01:00
57aff5c858 changed tagging logic for latest versions 2025-10-26 16:07:52 +01:00
b4abe459c2 changed tagging logic for latest versions 2025-10-26 15:35:07 +01:00
06bc27a6ce Merge branch 'main' of https://github.com/donpat1to/Schichtenplaner 2025-10-26 12:53:52 +01:00
0aad8f0a56 fixed footer 2025-10-26 12:40:16 +01:00
b52e9d57c7 new package lock generated 2025-10-26 12:24:20 +01:00
15f3183bc0 added esbuild 2025-10-26 12:14:24 +01:00
ca3a5d1c0e changed install to only-production 2025-10-26 12:13:37 +01:00
6a1509d807 removed esbuild 2025-10-26 11:44:39 +01:00
donpat1to
308ae74e37 Update LICENSE-COMMERCIAL 2025-10-26 10:27:11 +01:00
e876f5eb02 fixed login ui 2025-10-26 10:24:07 +01:00
dabd2dff3b added ecosystem file to builder 2025-10-26 09:54:32 +01:00
84d7be052d added expicit copying database schema.sql 2025-10-26 01:51:08 +02:00
9460f10278 added expicit copying database schema.sql 2025-10-26 01:42:34 +02:00
6e1927fe2f added expicit copying database schema.sql 2025-10-26 01:37:13 +02:00
e5a6fc73fe not using rollup package 2025-10-26 01:24:41 +02:00
c773740634 using npm install instead of npm ci 2025-10-26 01:18:25 +02:00
23acd88ced compiling allowed unused values 2025-10-25 13:32:01 +02:00
aa1a2d4d72 removed invalid statement in compileroptions 2025-10-25 13:27:45 +02:00
cf3866ee21 added copying all files so package-lock findable 2025-10-25 13:20:56 +02:00
7ab3e0a5fb removed unreachable cache dir 2025-10-25 13:12:12 +02:00
41aa77e45d fixed unreachable cache dir 2025-10-25 13:07:25 +02:00
8e782a5290 added vite config 2025-10-25 12:44:18 +02:00
3856f93484 ignoring peerdepencdecies in frontend build 2025-10-25 11:50:07 +02:00
dae255e2c1 changed from workspace build to independet build 2025-10-25 11:41:53 +02:00
8f96368f5a changed mode_modules dir cause of workspace configuration 2025-10-25 11:27:49 +02:00
636b892ece fixed monorepo package struct 2025-10-25 00:41:09 +02:00
8be6a7b474 changed version dependencies 2025-10-25 00:28:15 +02:00
a2b2b76665 changed version dependencies 2025-10-25 00:24:03 +02:00
6d00ab695c changed version dependencies 2025-10-25 00:19:22 +02:00
2608acc2d9 added test env 2025-10-25 00:11:02 +02:00
4dacf94077 added neccessary env 2025-10-25 00:04:00 +02:00
5e7c5aabfb added community version 2025-10-24 23:52:57 +02:00
05fa87c638 added routing in app.tsx 2025-10-24 17:52:47 +02:00
875db3aeb7 added singlerepo structure 2025-10-24 15:58:43 +02:00
809a838e27 changing repo structure 2025-10-23 23:53:57 +02:00
54 changed files with 795 additions and 23526 deletions

4
.env.production Normal file
View File

@@ -0,0 +1,4 @@
# .env.production example
NODE_ENV=production
JWT_SECRET=your-super-secure-minimum-32-character-secret-key-here
DATABASE_PATH=/app/data/production.db

View File

@@ -16,11 +16,21 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
tag_name: ${{ steps.set_tag.outputs.tag_name }} tag_name: ${{ steps.set_tag.outputs.tag_name }}
is_main_branch: ${{ steps.branch_check.outputs.is_main }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 # Fetch all history for tags fetch-depth: 0
- name: Check if main branch
id: branch_check
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" || "${{ github.ref }}" == "refs/heads/master" ]]; then
echo "is_main=true" >> $GITHUB_OUTPUT
else
echo "is_main=false" >> $GITHUB_OUTPUT
fi
- name: Determine next semantic version tag - name: Determine next semantic version tag
id: set_tag id: set_tag
@@ -29,24 +39,31 @@ jobs:
# Find latest tag matching vX.Y.Z # Find latest tag matching vX.Y.Z
latest_tag=$(git tag --list 'v*.*.*' --sort=-v:refname | head -n 1) latest_tag=$(git tag --list 'v*.*.*' --sort=-v:refname | head -n 1)
echo "Latest tag found: $latest_tag"
if [[ -z "$latest_tag" ]]; then if [[ -z "$latest_tag" ]]; then
major=0 major=0
minor=0 minor=0
patch=0 patch=0
echo "No existing tags found, starting from v0.0.0"
else else
version="${latest_tag#v}" version="${latest_tag#v}"
IFS='.' read -r major minor patch <<< "$version" IFS='.' read -r major minor patch <<< "$version"
echo "Parsed version: major=$major, minor=$minor, patch=$patch"
fi fi
if [[ "${GITHUB_REF}" == "refs/heads/main" || "${GITHUB_REF}" == "refs/heads/master" ]]; then if [[ "${{ github.ref }}" == "refs/heads/main" || "${{ github.ref }}" == "refs/heads/master" ]]; then
major=$((major + 1)) major=$((major + 1))
minor=0 minor=0
patch=0 patch=0
elif [[ "${GITHUB_REF}" == "refs/heads/development" ]]; then echo "Main branch - major version bump"
elif [[ "${{ github.ref }}" == "refs/heads/development" ]]; then
minor=$((minor + 1)) minor=$((minor + 1))
patch=0 patch=0
echo "Development branch - minor version bump"
else else
patch=$((patch + 1)) patch=$((patch + 1))
echo "Other branch - patch version bump"
fi fi
new_tag="v${major}.${minor}.${patch}" new_tag="v${major}.${minor}.${patch}"
@@ -65,14 +82,10 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '20' node-version: '20'
cache: 'npm'
cache-dependency-path: backend/package-lock.json
- name: Install backend dependencies - name: Install backend dependencies
working-directory: ./backend working-directory: ./backend
run: | run: npm install
# Try npm ci first, if it fails use npm install
npm ci || (echo "package-lock.json out of sync, using npm install..." && npm install)
- name: Run TypeScript check - name: Run TypeScript check
working-directory: ./backend working-directory: ./backend
@@ -81,7 +94,6 @@ jobs:
- name: Run backend tests - name: Run backend tests
working-directory: ./backend working-directory: ./backend
run: | run: |
# Skip tests if jest is not installed
if [ -f "node_modules/.bin/jest" ]; then if [ -f "node_modules/.bin/jest" ]; then
npm test npm test
else else
@@ -134,11 +146,8 @@ jobs:
with: with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: | tags: |
type=ref,event=branch type=raw,value=${{ needs.set-tag.outputs.tag_name }}
type=semver,pattern={{version}} type=raw,value=latest,enable=${{ fromJSON(needs.set-tag.outputs.is_main_branch) }}
type=sha
# Add the dynamically generated semantic version
${{ needs.set-tag.outputs.tag_name }}
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
@@ -168,3 +177,4 @@ jobs:
echo "- Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" echo "- Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
echo "- Tags: ${{ steps.meta.outputs.tags }}" echo "- Tags: ${{ steps.meta.outputs.tags }}"
echo "- New version: ${{ needs.set-tag.outputs.tag_name }}" echo "- New version: ${{ needs.set-tag.outputs.tag_name }}"
echo "- Is main branch: ${{ needs.set-tag.outputs.is_main_branch }}"

27
.gitignore vendored
View File

@@ -64,6 +64,7 @@ build/
.env.development.local .env.development.local
.env.test.local .env.test.local
.env.production.local .env.production.local
.env.production
# Database # Database
database/*.db database/*.db
@@ -110,3 +111,29 @@ Thumbs.db
# Optional eslint cache # Optional eslint cache
.eslintcache .eslintcache
# Ignore contents of premium folder in public repo
premium/*
!premium/README-PREMIUM.md
!premium/.gitkeep
.git
.gitignore
node_modules
npm-debug.log
README.md
.env
.nyc_output
coverage
.cache
dist
build
logs
*.tsbuildinfo
# Frontend specific
frontend/dist
frontend/.vite
# Backend specific
backend/dist

View File

@@ -1,7 +1,7 @@
# Multi-stage build for combined frontend + backend # Single stage build for workspaces
FROM node:20-bullseye AS backend-builder FROM node:20-bullseye AS builder
WORKDIR /app/backend WORKDIR /app
# Install Python + OR-Tools # Install Python + OR-Tools
RUN apt-get update && apt-get install -y python3 python3-pip build-essential \ RUN apt-get update && apt-get install -y python3 python3-pip build-essential \
@@ -10,78 +10,58 @@ RUN apt-get update && apt-get install -y python3 python3-pip build-essential \
# Create symlink so python3 is callable as python # Create symlink so python3 is callable as python
RUN ln -sf /usr/bin/python3 /usr/bin/python RUN ln -sf /usr/bin/python3 /usr/bin/python
# Copy backend files # Copy root package files first
COPY backend/package*.json ./ COPY package*.json ./
COPY backend/tsconfig.json ./ COPY tsconfig.base.json ./
COPY ecosystem.config.cjs ./
# Install backend dependencies # Install root dependencies
RUN npm ci RUN npm install --only=production
# Copy backend source # Copy workspace files
COPY backend/src/ ./src/ COPY backend/ ./backend/
COPY frontend/ ./frontend/
# Build backend # Install workspace dependencies individually
RUN npm run build RUN npm install --workspace=backend
RUN npm install --workspace=frontend
# Copy database files manually # Build backend first
RUN cp -r src/database/ dist/database/ RUN npm run build --only=production --workspace=backend
# Build frontend
RUN npm run build --only=production --workspace=frontend
# Verify Python and OR-Tools installation # Verify Python and OR-Tools installation
RUN python -c "from ortools.sat.python import cp_model; print('OR-Tools installed successfully')" RUN python -c "from ortools.sat.python import cp_model; print('OR-Tools installed successfully')"
# Frontend build stage # Production stage (same as above)
FROM node:20-bullseye AS frontend-builder
WORKDIR /app/frontend
# Copy frontend files
COPY frontend/package*.json ./
COPY frontend/tsconfig.json ./
# Install frontend dependencies
RUN npm ci
# Copy frontend source
COPY frontend/src/ ./src/
COPY frontend/public/ ./public/
# Build frontend
RUN npm run build
# Production stage
FROM node:20-bookworm FROM node:20-bookworm
WORKDIR /app WORKDIR /app
# Install PM2 for process management
RUN npm install -g pm2 RUN npm install -g pm2
# Create data directory for SQLite database with proper permissions
RUN mkdir -p /app/data RUN mkdir -p /app/data
# Copy backend built files COPY --from=builder /app/backend/dist/ ./dist/
COPY --from=backend-builder /app/backend/package*.json ./ COPY --from=builder /app/backend/package*.json ./
COPY --from=backend-builder /app/backend/dist/ ./dist/
COPY --from=backend-builder /app/backend/node_modules/ ./node_modules/
# Copy frontend built files COPY --from=builder /app/node_modules/ ./node_modules/
COPY --from=frontend-builder /app/frontend/build/ ./frontend-build/ COPY --from=builder /app/frontend/dist/ ./frontend-build/
# Copy PM2 configuration COPY --from=builder /app/ecosystem.config.cjs ./
COPY ecosystem.config.cjs ./
COPY --from=builder /app/backend/src/database/ ./dist/database/
COPY --from=builder /app/backend/src/database/ ./database/
# Create a non-root user and group - DEBIAN STYLE
RUN groupadd -g 1001 nodejs && \ RUN groupadd -g 1001 nodejs && \
useradd -m -u 1001 -s /bin/bash -g nodejs schichtplan && \ useradd -m -u 1001 -s /bin/bash -g nodejs schichtplan && \
chown -R schichtplan:nodejs /app && \ chown -R schichtplan:nodejs /app && \
chmod 755 /app && \ chmod 755 /app && \
chmod 775 /app/data chmod 775 /app/data
# Set PM2 to use app directory instead of home directory
ENV PM2_HOME=/app/.pm2 ENV PM2_HOME=/app/.pm2
USER schichtplan USER schichtplan
EXPOSE 3002 EXPOSE 3002
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \

View File

@@ -15,7 +15,7 @@ This software, "Schichtenplaner", is offered under a dual licensing model.
- Integration into commercial software or distributions - Integration into commercial software or distributions
To obtain a commercial license, please contact: To obtain a commercial license, please contact:
📧 patrick@mahnke-hartmann.dev 📧 dev.patrick@mahnke-hartmann.de
or open an inquiry via GitHub: https://github.com/donpat1to/Schichtenplaner or open an inquiry via GitHub: https://github.com/donpat1to/Schichtenplaner
Without a valid commercial license, all commercial rights are reserved. Without a valid commercial license, all commercial rights are reserved.

3893
backend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -16,7 +16,6 @@
"@types/bcrypt": "^6.0.0", "@types/bcrypt": "^6.0.0",
"bcrypt": "^6.0.0", "bcrypt": "^6.0.0",
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",
"cors": "^2.8.5",
"express": "^4.18.2", "express": "^4.18.2",
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"sqlite3": "^5.1.6", "sqlite3": "^5.1.6",
@@ -24,7 +23,6 @@
}, },
"devDependencies": { "devDependencies": {
"@types/bcryptjs": "^2.4.2", "@types/bcryptjs": "^2.4.2",
"@types/cors": "^2.8.13",
"@types/express": "^4.17.17", "@types/express": "^4.17.17",
"@types/jsonwebtoken": "^9.0.2", "@types/jsonwebtoken": "^9.0.2",
"@types/uuid": "^9.0.2", "@types/uuid": "^9.0.2",

View File

@@ -1,5 +1,5 @@
// backend/src/controllers/employeeController.ts // backend/src/controllers/employeeController.ts
import { Request, Response } from 'express'; import { Response } from 'express';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import bcrypt from 'bcryptjs'; import bcrypt from 'bcryptjs';
import { db } from '../services/databaseService.js'; import { db } from '../services/databaseService.js';

View File

@@ -1,7 +1,6 @@
// backend/src/controllers/setupController.ts // backend/src/controllers/setupController.ts
import { Request, Response } from 'express'; import { Request, Response } from 'express';
import bcrypt from 'bcrypt'; import bcrypt from 'bcrypt';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto'; import { randomUUID } from 'crypto';
import { db } from '../services/databaseService.js'; import { db } from '../services/databaseService.js';

View File

@@ -5,10 +5,9 @@ import { db } from '../services/databaseService.js';
import { import {
CreateShiftPlanRequest, CreateShiftPlanRequest,
UpdateShiftPlanRequest, UpdateShiftPlanRequest,
ShiftPlan
} from '../models/ShiftPlan.js'; } from '../models/ShiftPlan.js';
import { AuthRequest } from '../middleware/auth.js'; import { AuthRequest } from '../middleware/auth.js';
import { createPlanFromPreset, TEMPLATE_PRESETS } from '../models/defaults/shiftPlanDefaults.js'; import { TEMPLATE_PRESETS } from '../models/defaults/shiftPlanDefaults.js';
async function getPlanWithDetails(planId: string) { async function getPlanWithDetails(planId: string) {
const plan = await db.get<any>(` const plan = await db.get<any>(`

View File

@@ -149,3 +149,9 @@ CREATE INDEX IF NOT EXISTS idx_scheduled_shifts_required_employees ON scheduled_
CREATE INDEX IF NOT EXISTS idx_shift_assignments_employee ON shift_assignments(employee_id); CREATE INDEX IF NOT EXISTS idx_shift_assignments_employee ON shift_assignments(employee_id);
CREATE INDEX IF NOT EXISTS idx_shift_assignments_shift ON shift_assignments(scheduled_shift_id); CREATE INDEX IF NOT EXISTS idx_shift_assignments_shift ON shift_assignments(scheduled_shift_id);
CREATE INDEX IF NOT EXISTS idx_employee_availability_employee_plan ON employee_availability(employee_id, plan_id); CREATE INDEX IF NOT EXISTS idx_employee_availability_employee_plan ON employee_availability(employee_id, plan_id);
PRAGMA journal_mode = WAL;
PRAGMA synchronous = NORMAL;
PRAGMA foreign_keys = ON;
PRAGMA secure_delete = ON;
PRAGMA auto_vacuum = INCREMENTAL;

View File

@@ -1,6 +1,5 @@
// backend/src/routes/setup.ts // backend/src/routes/setup.ts
import express from 'express'; import express from 'express';
import bcrypt from 'bcryptjs';
import { checkSetupStatus, setupAdmin } from '../controllers/setupController.js'; import { checkSetupStatus, setupAdmin } from '../controllers/setupController.js';
const router = express.Router(); const router = express.Router();

View File

@@ -1,5 +1,4 @@
import { spawn } from 'child_process'; import { spawn } from 'child_process';
import path from 'path';
export function runPythonScript(scriptPath, args = []) { export function runPythonScript(scriptPath, args = []) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View File

@@ -13,9 +13,6 @@ import setupRoutes from './routes/setup.js';
import scheduledShifts from './routes/scheduledShifts.js'; import scheduledShifts from './routes/scheduledShifts.js';
import schedulingRoutes from './routes/scheduling.js'; import schedulingRoutes from './routes/scheduling.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const app = express(); const app = express();
const PORT = 3002; const PORT = 3002;
@@ -39,25 +36,34 @@ app.get('/api/health', (req: any, res: any) => {
}); });
}); });
// 🆕 STATIC FILE SERVING FÜR FRONTEND // 🆕 STATIC FILE SERVING
const frontendBuildPath = path.join(__dirname, '../frontend-build'); // Use absolute path that matches Docker container structure
const frontendBuildPath = path.resolve('/app/frontend-build');
console.log('📁 Frontend build path:', frontendBuildPath); console.log('📁 Frontend build path:', frontendBuildPath);
// Überprüfe ob das Verzeichnis existiert if (frontendBuildPath) {
if (fs.existsSync(frontendBuildPath)) {
console.log('✅ Frontend build directory exists');
const files = fs.readdirSync(frontendBuildPath);
console.log('📄 Files in frontend-build:', files);
// Serviere statische Dateien // Serviere statische Dateien
app.use(express.static(frontendBuildPath)); app.use(express.static(frontendBuildPath));
// List files for debugging
try {
const files = fs.readdirSync(frontendBuildPath);
console.log('📄 Files in frontend-build:', files);
} catch (err) {
console.log('❌ Could not read frontend-build directory:', err);
}
console.log('✅ Static file serving configured'); console.log('✅ Static file serving configured');
} else { } else {
console.log('❌ Frontend build directory NOT FOUND:', frontendBuildPath); console.log('❌ Frontend build directory NOT FOUND in any location');
} }
// Root route
app.get('/', (req, res) => { app.get('/', (req, res) => {
if (!frontendBuildPath) {
return res.status(500).send('Frontend build not found');
}
const indexPath = path.join(frontendBuildPath, 'index.html'); const indexPath = path.join(frontendBuildPath, 'index.html');
console.log('📄 Serving index.html from:', indexPath); console.log('📄 Serving index.html from:', indexPath);
@@ -69,19 +75,30 @@ app.get('/', (req, res) => {
} }
}); });
// Client-side routing fallback
app.get('*', (req, res) => { app.get('*', (req, res) => {
// Ignoriere API Routes // Ignoriere API Routes
if (req.path.startsWith('/api/')) { if (req.path.startsWith('/api/')) {
return res.status(404).json({ error: 'API endpoint not found' }); return res.status(404).json({ error: 'API endpoint not found' });
} }
if (!frontendBuildPath) {
return res.status(500).json({ error: 'Frontend application not available' });
}
const indexPath = path.join(frontendBuildPath, 'index.html'); const indexPath = path.join(frontendBuildPath, 'index.html');
console.log('🔄 Client-side routing for:', req.path, '-> index.html'); console.log('🔄 Client-side routing for:', req.path, '->', indexPath);
if (fs.existsSync(indexPath)) { if (fs.existsSync(indexPath)) {
res.sendFile(indexPath); // Use absolute path with res.sendFile
res.sendFile(indexPath, (err) => {
if (err) {
console.error('Error sending index.html:', err);
res.status(500).send('Error loading application');
}
});
} else { } else {
console.error('❌ index.html not found for client-side routing'); console.error('❌ index.html not found for client-side routing at:', indexPath);
res.status(404).json({ error: 'Frontend application not found' }); res.status(404).json({ error: 'Frontend application not found' });
} }
}); });

View File

@@ -2,8 +2,7 @@
import { Worker } from 'worker_threads'; import { Worker } from 'worker_threads';
import path from 'path'; import path from 'path';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'url';
import { Employee, EmployeeAvailability } from '../models/Employee.js'; import { ShiftPlan } from '../models/ShiftPlan.js';
import { ShiftPlan, ScheduledShift } from '../models/ShiftPlan.js';
import { ScheduleRequest, ScheduleResult, Availability, Constraint } from '../models/scheduling.js'; import { ScheduleRequest, ScheduleResult, Availability, Constraint } from '../models/scheduling.js';
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);

View File

@@ -2,8 +2,8 @@
import { parentPort, workerData } from 'worker_threads'; import { parentPort, workerData } from 'worker_threads';
import { CPModel, CPSolver } from './cp-sat-wrapper.js'; import { CPModel, CPSolver } from './cp-sat-wrapper.js';
import { ShiftPlan, Shift } from '../models/ShiftPlan.js'; import { ShiftPlan, Shift } from '../models/ShiftPlan.js';
import { Employee, EmployeeAvailability } from '../models/Employee.js'; import { Employee } from '../models/Employee.js';
import { Availability, Constraint, Violation, SolverOptions, Solution, Assignment } from '../models/scheduling.js'; import { Availability, Constraint } from '../models/scheduling.js';
interface WorkerData { interface WorkerData {
shiftPlan: ShiftPlan; shiftPlan: ShiftPlan;

View File

@@ -1,19 +1,22 @@
// backend/tsconfig.json
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2022", "target": "ES2022",
"module": "NodeNext", "module": "NodeNext",
"moduleResolution": "NodeNext", "moduleResolution": "NodeNext",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"allowJs": true,
"outDir": "./dist", "outDir": "./dist",
"rootDir": "./src", "rootDir": "./src",
"strict": true, "strict": true,
"esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"resolveJsonModule": true "resolveJsonModule": true,
"allowSyntheticDefaultImports": true
}, },
"include": ["src/**/*"], "include": [
"exclude": ["node_modules", "dist"] "src/**/*"
],
"exclude": [
"node_modules",
"dist"
]
} }

View File

@@ -1,26 +1,14 @@
version: '3.8' version: '3.8'
services: services:
schichtplan: schichtplaner:
build: container_name: schichtplaner
context: . image: ghcr.io/donpat1to/schichtenplaner:v1.0.0
dockerfile: backend/Dockerfile
ports: ports:
- "3001:3001" - "3002:3002"
- "3000:3000"
environment:
- NODE_ENV=production
- DATABASE_URL=file:./prod.db
- JWT_SECRET=your-production-secret-key-change-this
- PYTHON_PATH=/usr/bin/python3
volumes: volumes:
- app_data:/app/data - app_data:/app/data
restart: unless-stopped restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3
volumes: volumes:
app_data: app_data:

View File

@@ -1,18 +1,17 @@
// ecosystem.config.cjs // ecosystem.config.cjs
module.exports = { module.exports = {
apps: [ apps: [{
{ name: 'schichtplan-app',
name: 'schichtplaner', script: './dist/server.js',
script: './dist/server.js', instances: 1,
instances: 1, env: {
exec_mode: 'fork', NODE_ENV: 'production',
env: { PORT: 3002,
NODE_ENV: 'production', FRONTEND_BUILD_PATH: './frontend-build'
PORT: 3002 },
}, error_file: './logs/err.log',
error_file: './logs/app-err.log', out_file: './logs/out.log',
out_file: './logs/app-out.log', log_file: './logs/combined.log',
time: true time: true
} }]
]
}; };

View File

@@ -1,4 +0,0 @@
# frontend/.env.development
BROWSER=none
FAST_REFRESH=true
DANGEROUSLY_DISABLE_HOST_CHECK=true

13
frontend/index.html Normal file
View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shift Planning App</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

19000
frontend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,49 +2,25 @@
"name": "frontend", "name": "frontend",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"proxy": "http://localhost:3002", "type": "module",
"dependencies": { "dependencies": {
"@testing-library/dom": "^10.4.1", "react": "^19.0.0",
"@testing-library/jest-dom": "^6.9.1", "react-dom": "^19.0.0",
"@testing-library/react": "^16.3.0", "react-router-dom": "^6.28.0"
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.126",
"@types/react": "^19.2.2",
"@types/react-dom": "^19.2.1",
"@types/react-router-dom": "^5.3.3",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"react-router-dom": "^7.9.3",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}, },
"devDependencies": { "devDependencies": {
"http-proxy-middleware": "^3.0.5", "@types/node": "20.19.23",
"react-scripts": "^5.0.1" "@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@types/react-router-dom": "^5.3.3",
"@vitejs/plugin-react": "^4.3.3",
"typescript": "^5.7.3",
"vite": "^6.0.7",
"esbuild": "^0.21.0"
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"short_name": "React App", "short_name": "SP",
"name": "Create React App Sample", "name": "schichtenplaner",
"icons": [ "icons": [
{ {
"src": "favicon.ico", "src": "favicon.ico",

View File

@@ -1,9 +0,0 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

View File

@@ -1,4 +1,4 @@
// frontend/src/App.tsx - KORRIGIERT MIT LAYOUT // src/App.tsx
import React from 'react'; import React from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import { AuthProvider, useAuth } from './contexts/AuthContext'; import { AuthProvider, useAuth } from './contexts/AuthContext';
@@ -16,6 +16,38 @@ import Settings from './pages/Settings/Settings';
import Help from './pages/Help/Help'; import Help from './pages/Help/Help';
import Setup from './pages/Setup/Setup'; import Setup from './pages/Setup/Setup';
// Free Footer Link Pages (always available)
import FAQ from './components/Layout/FooterLinks/FAQ/FAQ';
import About from './components/Layout/FooterLinks/About/About';
import Features from './components/Layout/FooterLinks/Features/Features';
import { CommunityContact, CommunityLegalPage } from './components/Layout/FooterLinks/CommunityLinks/communityLinks';
// Vite environment variables (use import.meta.env instead of process.env)
const ENABLE_PRO = import.meta.env.ENABLE_PRO === 'true';
// Conditional Premium Components
let PremiumContact: React.FC = CommunityContact;
let PremiumPrivacy: React.FC = () => <CommunityLegalPage title="Datenschutz" />;
let PremiumImprint: React.FC = () => <CommunityLegalPage title="Impressum" />;
let PremiumTerms: React.FC = () => <CommunityLegalPage title="AGB" />;
// Load premium components only when ENABLE_PRO is true
if (ENABLE_PRO) {
try {
// Use require with type assertions to avoid dynamic import issues
const premiumModule = require('@premium-frontend/components/FooterLinks');
if (premiumModule.Contact) PremiumContact = premiumModule.Contact;
if (premiumModule.Privacy) PremiumPrivacy = premiumModule.Privacy;
if (premiumModule.Imprint) PremiumImprint = premiumModule.Imprint;
if (premiumModule.Terms) PremiumTerms = premiumModule.Terms;
console.log('✅ Premium components loaded successfully');
} catch (error) {
console.warn('⚠️ Premium components not available, using community fallbacks:', error);
}
}
// Protected Route Component // Protected Route Component
const ProtectedRoute: React.FC<{ children: React.ReactNode; roles?: string[] }> = ({ const ProtectedRoute: React.FC<{ children: React.ReactNode; roles?: string[] }> = ({
children, children,
@@ -49,11 +81,27 @@ const ProtectedRoute: React.FC<{ children: React.ReactNode; roles?: string[] }>
return <Layout>{children}</Layout>; return <Layout>{children}</Layout>;
}; };
// Public Route Component (without Layout for footer pages)
const PublicRoute: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const { user, loading } = useAuth();
if (loading) {
return (
<div style={{ textAlign: 'center', padding: '40px' }}>
<div> Lade Anwendung...</div>
</div>
);
}
return user ? <Layout>{children}</Layout> : <>{children}</>;
};
// Main App Content // Main App Content
const AppContent: React.FC = () => { const AppContent: React.FC = () => {
const { loading, needsSetup, user } = useAuth(); const { loading, needsSetup, user } = useAuth();
console.log('🏠 AppContent rendering - loading:', loading, 'needsSetup:', needsSetup, 'user:', user); console.log('🏠 AppContent rendering - loading:', loading, 'needsSetup:', needsSetup, 'user:', user);
console.log('🎯 Premium features enabled:', ENABLE_PRO);
// Während des Ladens // Während des Ladens
if (loading) { if (loading) {
@@ -80,52 +128,32 @@ const AppContent: React.FC = () => {
console.log('✅ Showing protected routes for user:', user.email); console.log('✅ Showing protected routes for user:', user.email);
return ( return (
<Routes> <Routes>
<Route path="/" element={ {/* Protected Routes (require login) */}
<ProtectedRoute> <Route path="/" element={<ProtectedRoute><Dashboard /></ProtectedRoute>} />
<Dashboard /> <Route path="/shift-plans" element={<ProtectedRoute><ShiftPlanList /></ProtectedRoute>} />
</ProtectedRoute> <Route path="/shift-plans/new" element={<ProtectedRoute roles={['admin', 'maintenance']}><ShiftPlanCreate /></ProtectedRoute>} />
} /> <Route path="/shift-plans/:id/edit" element={<ProtectedRoute roles={['admin', 'maintenance']}><ShiftPlanEdit /></ProtectedRoute>} />
<Route path="/shift-plans" element={ <Route path="/shift-plans/:id" element={<ProtectedRoute><ShiftPlanView /></ProtectedRoute>} />
<ProtectedRoute> <Route path="/employees" element={<ProtectedRoute roles={['admin', 'maintenance']}><EmployeeManagement /></ProtectedRoute>} />
<ShiftPlanList /> <Route path="/settings" element={<ProtectedRoute><Settings /></ProtectedRoute>} />
</ProtectedRoute> <Route path="/help" element={<ProtectedRoute><Help /></ProtectedRoute>} />
} />
<Route path="/shift-plans/new" element={ {/* Public Footer Link Pages (always available) */}
<ProtectedRoute roles={['admin', 'maintenance']}> <Route path="/faq" element={<PublicRoute><FAQ /></PublicRoute>} />
<ShiftPlanCreate /> <Route path="/about" element={<PublicRoute><About /></PublicRoute>} />
</ProtectedRoute> <Route path="/features" element={<PublicRoute><Features /></PublicRoute>} />
} />
<Route path="/shift-plans/:id/edit" element={ {/* PREMIUM Footer Link Pages (conditionally available) */}
<ProtectedRoute roles={['admin', 'maintenance']}> <Route path="/contact" element={<PublicRoute><PremiumContact /></PublicRoute>} />
<ShiftPlanEdit /> <Route path="/privacy" element={<PublicRoute><PremiumPrivacy /></PublicRoute>} />
</ProtectedRoute> <Route path="/imprint" element={<PublicRoute><PremiumImprint /></PublicRoute>} />
} /> <Route path="/terms" element={<PublicRoute><PremiumTerms /></PublicRoute>} />
<Route path="/shift-plans/:id" element={
<ProtectedRoute> {/* Auth Routes */}
<ShiftPlanView />
</ProtectedRoute>
} />
<Route path="/employees" element={
<ProtectedRoute roles={['admin', 'maintenance']}>
<EmployeeManagement />
</ProtectedRoute>
} />
<Route path="/settings" element={
<ProtectedRoute>
<Settings />
</ProtectedRoute>
} />
<Route path="/help" element={
<ProtectedRoute>
<Help />
</ProtectedRoute>
} />
<Route path="/login" element={<Login />} /> <Route path="/login" element={<Login />} />
<Route path="*" element={
<ProtectedRoute> {/* Catch-all Route */}
<Dashboard /> <Route path="*" element={<ProtectedRoute><Dashboard /></ProtectedRoute>} />
</ProtectedRoute>
} />
</Routes> </Routes>
); );
}; };

View File

@@ -1,4 +1,4 @@
// frontend/src/components/Layout/Footer.tsx - ELEGANT WHITE DESIGN // frontend/src/components/Layout/Footer.tsx
import React from 'react'; import React from 'react';
const Footer: React.FC = () => { const Footer: React.FC = () => {
@@ -10,12 +10,12 @@ const Footer: React.FC = () => {
borderTop: '1px solid rgba(251, 250, 246, 0.1)', borderTop: '1px solid rgba(251, 250, 246, 0.1)',
}, },
footerContent: { footerContent: {
maxWidth: '1200px', maxWidth: '1500px',
margin: '0 auto', margin: '0 auto',
padding: '3rem 2rem 2rem', padding: '3rem 2rem 2rem',
display: 'grid', display: 'grid',
gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))', gridTemplateColumns: 'repeat(auto-fit, minmax(100px, 1fr))',
gap: '3rem', gap: '1rem',
}, },
footerSection: { footerSection: {
display: 'flex', display: 'flex',
@@ -182,20 +182,6 @@ const Footer: React.FC = () => {
> >
Funktionen Funktionen
</a> </a>
<a
href="/pricing"
style={styles.footerLink}
onMouseEnter={(e) => {
e.currentTarget.style.color = '#FBFAF6';
e.currentTarget.style.transform = 'translateX(4px)';
}}
onMouseLeave={(e) => {
e.currentTarget.style.color = 'rgba(251, 250, 246, 0.7)';
e.currentTarget.style.transform = 'translateX(0)';
}}
>
Preise
</a>
</div> </div>
</div> </div>

View File

@@ -0,0 +1,76 @@
// frontend/src/components/Layout/FooterLinks/About/About.tsx
import React from 'react';
const About: React.FC = () => {
return (
<div style={{ padding: '40px 20px', maxWidth: '800px', margin: '0 auto' }}>
<h1>👨💻 Über uns</h1>
<div style={{
backgroundColor: 'white',
borderRadius: '12px',
padding: '30px',
marginTop: '20px',
boxShadow: '0 4px 6px rgba(0,0,0,0.1)',
border: '1px solid #e0e0e0',
lineHeight: 1.6
}}>
<h2 style={{ color: '#2c3e50' }}>Unser Team</h2>
<div style={{ display: 'flex', alignItems: 'center', marginTop: '20px', padding: '20px', backgroundColor: '#f8f9fa', borderRadius: '8px' }}>
<div style={{ marginRight: '20px' }}>
<div style={{
width: '80px',
height: '80px',
backgroundColor: '#3498db',
borderRadius: '50%',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: 'white',
fontSize: '2rem',
fontWeight: 'bold'
}}>
P
</div>
</div>
<div>
<h3 style={{ color: '#2c3e50', margin: '0 0 5px 0' }}>Patrick</h3>
<p style={{ color: '#6c757d', margin: '0 0 10px 0' }}>
Full-Stack Developer & Projektleiter
</p>
<p style={{ margin: 0, fontSize: '0.9rem' }}>
GitHub: <a href="https://github.com/donpat1to" style={{ color: '#3498db' }}>donpat1to</a><br/>
E-Mail: <a href="mailto:dev.patrick@inca-vikingo.de" style={{ color: '#3498db' }}>dev.patrick@inca-vikingo.de</a>
</p>
</div>
</div>
<h3 style={{ color: '#3498db', marginTop: '30px' }}>🚀 Unsere Mission</h3>
<p>
Wir entwickeln intelligente Lösungen für die Personalplanung,
die Zeit sparen und faire Schichtverteilung gewährleisten.
</p>
<h3 style={{ color: '#3498db', marginTop: '25px' }}>💻 Technologie</h3>
<p>
Unser Stack umfasst moderne Technologien:
</p>
<ul>
<li>Frontend: React, TypeScript</li>
<li>Backend: Node.js, Express</li>
<li>Optimierung: Google OR-Tools CP-SAT</li>
<li>Datenbank: SQLite/PostgreSQL</li>
</ul>
<h3 style={{ color: '#3498db', marginTop: '25px' }}>📈 Entwicklung</h3>
<p>
Schichtenplaner wird kontinuierlich weiterentwickelt und
basiert auf Feedback unserer Nutzer.
</p>
</div>
</div>
);
};
export default About;

View File

@@ -0,0 +1,38 @@
// frontend/src/components/Layout/FooterLinks/CommunityLinks/communityLinks.tsx
import React from 'react';
export const CommunityContact: React.FC = () => (
<div style={{ padding: '40px 20px', maxWidth: '800px', margin: '0 auto' }}>
<h1>📞 Kontakt</h1>
<div style={{ backgroundColor: 'white', borderRadius: '12px', padding: '30px', marginTop: '20px' }}>
<h2 style={{ color: '#2c3e50' }}>Community Edition</h2>
<p>Kontaktfunktionen sind in der Premium Edition verfügbar.</p>
<p>
<a href="/features" style={{ color: '#3498db' }}>
Zu den Features
</a>
</p>
</div>
</div>
);
export const CommunityLegalPage: React.FC<{ title: string }> = ({ title }) => (
<div style={{ padding: '40px 20px', maxWidth: '800px', margin: '0 auto' }}>
<h1>📄 {title}</h1>
<div style={{ backgroundColor: 'white', borderRadius: '12px', padding: '30px', marginTop: '20px' }}>
<h2 style={{ color: '#2c3e50' }}>Community Edition</h2>
<p>Rechtliche Dokumentation ist in der Premium Edition verfügbar.</p>
<p>
<a href="/features" style={{ color: '#3498db' }}>
Erfahren Sie mehr über Premium
</a>
</p>
</div>
</div>
);
// Optional: Barrel export für einfachere Imports
export default {
CommunityContact,
CommunityLegalPage
};

View File

@@ -0,0 +1,103 @@
// frontend/src/components/Layout/FooterLinks/FAQ/FAQ.tsx
import React, { useState } from 'react';
const FAQ: React.FC = () => {
const [openItems, setOpenItems] = useState<number[]>([]);
const toggleItem = (index: number) => {
setOpenItems(prev =>
prev.includes(index)
? prev.filter(i => i !== index)
: [...prev, index]
);
};
const faqItems = [
{
question: "Wie funktioniert der Scheduling-Algorithmus?",
answer: "Unser System verwendet Google's OR-Tools CP-SAT Solver, um optimale Schichtzuweisungen basierend auf Verfügbarkeiten, Vertragstypen und Geschäftsregeln zu berechnen."
},
{
question: "Was bedeuten die Verfügbarkeits-Level 1, 2 und 3?",
answer: "Level 1: Bevorzugt (Mitarbeiter möchte diese Schicht), Level 2: Verfügbar (kann arbeiten), Level 3: Nicht verfügbar (kann nicht arbeiten)."
},
{
question: "Wie werden Vertragstypen berücksichtigt?",
answer: "Kleine Verträge: 1 Schicht pro Woche, Große Verträge: 2 Schichten pro Woche. Das System weist genau diese Anzahl zu."
},
{
question: "Kann ich manuelle Anpassungen vornehmen?",
answer: "Ja, nach dem automatischen Scheduling können Sie Zuordnungen manuell anpassen und optimieren."
},
{
question: "Was passiert bei unterbesetzten Schichten?",
answer: "Das System zeigt eine Warnung an und versucht, alternative Lösungen zu finden. In kritischen Fällen müssen manuelle Anpassungen vorgenommen werden."
},
{
question: "Wie lange dauert die Planungserstellung?",
answer: "Typischerweise maximal 105 Sekunden, abhängig von der Anzahl der Mitarbeiter und Schichten."
}
];
return (
<div style={{ padding: '40px 20px', maxWidth: '800px', margin: '0 auto' }}>
<h1> Häufige Fragen (FAQ)</h1>
<div style={{
backgroundColor: 'white',
borderRadius: '12px',
marginTop: '20px',
boxShadow: '0 4px 6px rgba(0,0,0,0.1)',
border: '1px solid #e0e0e0'
}}>
{faqItems.map((item, index) => (
<div key={index} style={{
borderBottom: index < faqItems.length - 1 ? '1px solid #e0e0e0' : 'none',
padding: '20px 30px'
}}>
<div
onClick={() => toggleItem(index)}
style={{
cursor: 'pointer',
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center'
}}
>
<h3 style={{
color: '#2c3e50',
margin: 0,
fontSize: '1.1rem'
}}>
{item.question}
</h3>
<span style={{
fontSize: '1.5rem',
color: '#3498db',
transform: openItems.includes(index) ? 'rotate(45deg)' : 'rotate(0)',
transition: 'transform 0.2s ease'
}}>
+
</span>
</div>
{openItems.includes(index) && (
<div style={{
marginTop: '15px',
padding: '15px',
backgroundColor: '#f8f9fa',
borderRadius: '8px',
color: '#6c757d',
lineHeight: 1.6
}}>
{item.answer}
</div>
)}
</div>
))}
</div>
</div>
);
};
export default FAQ;

View File

@@ -0,0 +1,111 @@
// frontend/src/pages/Features/Features.tsx
import React from 'react';
const Features: React.FC = () => {
const features = [
{
icon: "🤖",
title: "Automatisches Scheduling",
description: "Intelligenter Algorithmus erstellt optimale Schichtpläne basierend auf Verfügbarkeiten und Regeln"
},
{
icon: "⚡",
title: "Schnelle Berechnung",
description: "Google OR-Tools CP-SAT Solver findet Lösungen in maximal 105 Sekunden"
},
{
icon: "👥",
title: "Flexible Regelkonfiguration",
description: "Anpassbare Geschäftsregeln für Trainee-Betreuung, Alleinarbeit, Vertragstypen"
},
{
icon: "📊",
title: "Echtzeit-Validierung",
description: "Automatische Erkennung von Regelverletzungen und Konflikten"
},
{
icon: "🔒",
title: "Lokale Datenspeicherung",
description: "Alle Daten bleiben in Ihrer Infrastruktur - volle Kontrolle und Datenschutz"
},
{
icon: "🎯",
title: "Präferenz-basiert",
description: "Berücksichtigt Mitarbeiterwünsche für höhere Zufriedenheit"
}
];
return (
<div style={{ padding: '40px 20px', maxWidth: '1000px', margin: '0 auto' }}>
<h1> Funktionen</h1>
<div style={{
backgroundColor: 'white',
borderRadius: '12px',
padding: '30px',
marginTop: '20px',
boxShadow: '0 4px 6px rgba(0,0,0,0.1)',
border: '1px solid #e0e0e0'
}}>
<h2 style={{ color: '#2c3e50', textAlign: 'center', marginBottom: '40px' }}>
Alles, was Sie für die perfekte Schichtplanung benötigen
</h2>
<div style={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))',
gap: '30px'
}}>
{features.map((feature, index) => (
<div key={index} style={{
padding: '25px',
backgroundColor: '#f8f9fa',
borderRadius: '12px',
border: '2px solid #e9ecef',
textAlign: 'center',
transition: 'transform 0.2s ease, box-shadow 0.2s ease'
}}>
<div style={{
fontSize: '3rem',
marginBottom: '15px'
}}>
{feature.icon}
</div>
<h3 style={{
color: '#2c3e50',
margin: '0 0 15px 0'
}}>
{feature.title}
</h3>
<p style={{
color: '#6c757d',
margin: 0,
lineHeight: 1.5
}}>
{feature.description}
</p>
</div>
))}
</div>
<div style={{
marginTop: '40px',
padding: '25px',
backgroundColor: '#e8f4fd',
borderRadius: '12px',
border: '2px solid #b8d4f0',
textAlign: 'center'
}}>
<h3 style={{ color: '#2980b9', margin: '0 0 15px 0' }}>
🚀 Starter Sie durch
</h3>
<p style={{ color: '#2c3e50', margin: 0 }}>
Erstellen Sie Ihren ersten optimierten Schichtplan in wenigen Minuten.
</p>
</div>
</div>
</div>
);
};
export default Features;

View File

@@ -1,220 +0,0 @@
/* Layout.css - Professionelles Design */
.layout {
min-height: 100vh;
display: flex;
flex-direction: column;
}
/* Header */
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
position: sticky;
top: 0;
z-index: 1000;
}
.header-content {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
display: flex;
align-items: center;
justify-content: space-between;
height: 70px;
}
.logo h1 {
margin: 0;
font-size: 1.5rem;
font-weight: 700;
}
/* Desktop Navigation */
.desktop-nav {
display: flex;
gap: 2rem;
align-items: center;
}
.nav-link {
color: white;
text-decoration: none;
padding: 0.5rem 1rem;
border-radius: 6px;
transition: all 0.3s ease;
font-weight: 500;
}
.nav-link:hover {
background: rgba(255, 255, 255, 0.1);
transform: translateY(-1px);
}
/* User Menu */
.user-menu {
display: flex;
align-items: center;
gap: 1rem;
}
.user-info {
font-weight: 500;
}
.logout-btn {
background: rgba(255, 255, 255, 0.1);
color: white;
border: 1px solid rgba(255, 255, 255, 0.3);
padding: 0.5rem 1rem;
border-radius: 6px;
cursor: pointer;
transition: all 0.3s ease;
}
.logout-btn:hover {
background: rgba(255, 255, 255, 0.2);
}
/* Mobile Menu Button */
.mobile-menu-btn {
display: none;
background: none;
border: none;
color: white;
font-size: 1.5rem;
cursor: pointer;
padding: 0.5rem;
}
/* Mobile Navigation */
.mobile-nav {
display: none;
flex-direction: column;
background: white;
padding: 1rem;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.mobile-nav-link {
color: #333;
text-decoration: none;
padding: 1rem;
border-bottom: 1px solid #eee;
transition: background-color 0.3s ease;
}
.mobile-nav-link:hover {
background-color: #f5f5f5;
}
.mobile-user-info {
padding: 1rem;
border-top: 1px solid #eee;
margin-top: 1rem;
}
.mobile-logout-btn {
background: #667eea;
color: white;
border: none;
padding: 0.5rem 1rem;
border-radius: 6px;
cursor: pointer;
margin-top: 0.5rem;
width: 100%;
}
/* Main Content */
.main-content {
flex: 1;
background-color: #f8f9fa;
min-height: calc(100vh - 140px);
}
.content-container {
max-width: 1200px;
margin: 0 auto;
padding: 2rem 20px;
}
/* Footer */
.footer {
background: #2c3e50;
color: white;
margin-top: auto;
}
.footer-content {
max-width: 1200px;
margin: 0 auto;
padding: 2rem 20px;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 2rem;
}
.footer-section h3,
.footer-section h4 {
margin-bottom: 1rem;
color: #ecf0f1;
}
.footer-section a {
color: #bdc3c7;
text-decoration: none;
display: block;
margin-bottom: 0.5rem;
transition: color 0.3s ease;
}
.footer-section a:hover {
color: #3498db;
}
.footer-bottom {
border-top: 1px solid #34495e;
padding: 1rem 20px;
text-align: center;
color: #95a5a6;
}
/* Responsive Design */
@media (max-width: 768px) {
.desktop-nav,
.user-menu {
display: none;
}
.mobile-menu-btn {
display: block;
}
.mobile-nav {
display: flex;
}
.header-content {
padding: 0 15px;
}
.content-container {
padding: 1rem 15px;
}
.footer-content {
grid-template-columns: 1fr;
text-align: center;
}
}
@media (max-width: 480px) {
.logo h1 {
font-size: 1.2rem;
}
.content-container {
padding: 1rem 10px;
}
}

View File

@@ -1,4 +1,4 @@
// frontend/src/components/Layout/Layout.tsx - ELEGANT WHITE DESIGN // frontend/src/components/Layout/Layout.tsx
import React from 'react'; import React from 'react';
import Navigation from './Navigation'; import Navigation from './Navigation';
import Footer from './Footer'; import Footer from './Footer';

View File

@@ -1,4 +1,4 @@
// frontend/src/components/Layout/Navigation.tsx - ELEGANT WHITE DESIGN // frontend/src/components/Layout/Navigation.tsx
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { useAuth } from '../../contexts/AuthContext'; import { useAuth } from '../../contexts/AuthContext';
import PillNav from '../PillNav/PillNav'; import PillNav from '../PillNav/PillNav';

View File

@@ -1,88 +0,0 @@
/* frontend/src/components/PillNav/PillNav.module.css */
.pillNavContainer {
display: flex;
gap: 8px;
overflow-x: auto;
padding: 4px;
scrollbar-width: none;
-ms-overflow-style: none;
}
.pillNavContainer::-webkit-scrollbar {
display: none;
}
.pill {
padding: 8px 16px;
border-radius: 9999px;
border: 1px solid;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease-in-out;
white-space: nowrap;
outline: none;
}
.pill:focus-visible {
outline: 2px solid #3b82f6;
outline-offset: 2px;
}
/* Solid Variant */
.pillSolid {
background-color: transparent;
color: #6b7280;
border-color: #d1d5db;
}
.pillSolidActive {
background-color: #2563eb;
color: white;
border-color: #2563eb;
}
.pillSolid:hover:not(.pillSolidActive) {
background-color: #f3f4f6;
color: #374151;
border-color: #9ca3af;
transform: translateY(-1px);
}
/* Outline Variant */
.pillOutline {
background-color: transparent;
color: #6b7280;
border-color: #d1d5db;
}
.pillOutlineActive {
color: #2563eb;
border-color: #2563eb;
font-weight: 600;
}
.pillOutline:hover:not(.pillOutlineActive) {
background-color: #f3f4f6;
color: #374151;
border-color: #9ca3af;
transform: translateY(-1px);
}
/* Ghost Variant */
.pillGhost {
background-color: transparent;
color: #6b7280;
border-color: transparent;
}
.pillGhostActive {
background-color: #f3f4f6;
color: #111827;
}
.pillGhost:hover:not(.pillGhostActive) {
background-color: #f9fafb;
color: #374151;
transform: translateY(-1px);
}

View File

@@ -1,4 +1,4 @@
// frontend/src/components/PillNav/PillNav.tsx - ELEGANT WHITE DESIGN // frontend/src/components/PillNav/PillNav.tsx
import React, { useEffect, useRef } from 'react'; import React, { useEffect, useRef } from 'react';
export interface PillNavItem { export interface PillNavItem {

View File

@@ -1,3 +0,0 @@
// frontend/src/components/PillNav/index.ts
export { default } from './PillNav';
export type { PillNavProps, PillNavItem } from './PillNav';

View File

@@ -1,4 +1,4 @@
// frontend/src/design/DesignSystem.tsx // frontend/src/design/DesignSystem.txt
export const designTokens = { export const designTokens = {
colors: { colors: {
// Primary Colors // Primary Colors

View File

@@ -1,3 +1,14 @@
/* Reset and base styles */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
#root {
min-height: 100vh;
}
body { body {
margin: 0; margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',

View File

@@ -1,19 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

10
frontend/src/main.tsx Normal file
View File

@@ -0,0 +1,10 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.tsx'
import './index.css'
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)

View File

@@ -129,7 +129,7 @@ const Login: React.FC = () => {
onChange={(e) => setEmail(e.target.value)} onChange={(e) => setEmail(e.target.value)}
required required
style={{ style={{
width: '94.5%', width: '100%',
padding: '10px', padding: '10px',
border: '1px solid #ddd', border: '1px solid #ddd',
borderRadius: '4px', borderRadius: '4px',
@@ -151,7 +151,7 @@ const Login: React.FC = () => {
onChange={(e) => setPassword(e.target.value)} onChange={(e) => setPassword(e.target.value)}
required required
style={{ style={{
width: '94.5%', width: '100%',
padding: '10px', padding: '10px',
paddingRight: '10px', paddingRight: '10px',
border: '1px solid #ddd', border: '1px solid #ddd',

View File

@@ -333,7 +333,7 @@ const Setup: React.FC = () => {
disabled={loading} disabled={loading}
style={{ style={{
padding: '0.75rem 2rem', padding: '0.75rem 2rem',
backgroundColor: loading ? '#6c757d' : '#007bff', backgroundColor: loading ? '#6c757d' : '#51258f',
color: 'white', color: 'white',
border: 'none', border: 'none',
borderRadius: '6px', borderRadius: '6px',

View File

@@ -1 +0,0 @@
/// <reference types="react-scripts" />

View File

@@ -1,15 +0,0 @@
import { ReportHandler } from 'web-vitals';
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

View File

@@ -1,6 +1,6 @@
// frontend/src/services/shiftPlanService.ts // frontend/src/services/shiftPlanService.ts
import { authService } from './authService'; import { authService } from './authService';
import { ShiftPlan, CreateShiftPlanRequest, ScheduledShift, CreateShiftFromTemplateRequest } from '../models/ShiftPlan'; import { ShiftPlan, CreateShiftPlanRequest } from '../models/ShiftPlan';
import { TEMPLATE_PRESETS } from '../models/defaults/shiftPlanDefaults'; import { TEMPLATE_PRESETS } from '../models/defaults/shiftPlanDefaults';
const API_BASE_URL = '/api/shift-plans'; const API_BASE_URL = '/api/shift-plans';

View File

@@ -1,5 +0,0 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

12
frontend/src/vite-env.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
/// <reference types="vite/client" />
// Define types for environment variables
interface ImportMetaEnv {
readonly VITE_APP_TITLE: string
readonly ENABLE_PRO: string
// more env variables...
}
interface ImportMeta {
readonly env: ImportMetaEnv
}

View File

@@ -1,27 +1,38 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "ES2020",
"lib": [ "useDefineForClassFields": true,
"dom", "lib": ["ES2020", "DOM", "DOM.Iterable"],
"dom.iterable", "module": "ESNext",
"esnext" "skipLibCheck": true,
], //"ignoreDeprecations": "6.0",
"allowJs": true,
"esModuleInterop": true, /* Bundler mode */
"allowSyntheticDefaultImports": true, "moduleResolution": "bundler",
"strict": true, "allowImportingTsExtensions": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"noEmit": true, "noEmit": true,
"ignoreDeprecations": "6.0",
"jsx": "react-jsx", "jsx": "react-jsx",
"downlevelIteration": true
/* Linting */
"strict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noFallthroughCasesInSwitch": true,
/* Path mapping (modern approach) */
"paths": {
"@/*": ["./src/*"],
"@/components/*": ["./src/components/*"],
"@/pages/*": ["./src/pages/*"],
"@/contexts/*": ["./src/contexts/*"],
"@/utils/*": ["./src/utils/*"],
"@/services/*": ["./src/services/*"],
"@/models/*": ["./src/models/*"],
"@/design/*": ["./src/design/*"]
}
}, },
"include": [ "include": ["src"],
"src" "references": [{ "path": "./tsconfig.node.json" }]
]
} }

View File

@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}

45
frontend/vite.config.ts Normal file
View File

@@ -0,0 +1,45 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { resolve } from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
server: {
port: 3003,
host: true,
open: true,
proxy: {
'/api': {
target: 'http://localhost:3002',
changeOrigin: true,
secure: false,
}
}
},
build: {
outDir: 'dist',
sourcemap: true,
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html')
}
}
},
resolve: {
alias: {
'@': resolve(__dirname, './src'),
'@/components': resolve(__dirname, './src/components'),
'@/pages': resolve(__dirname, './src/pages'),
'@/contexts': resolve(__dirname, './src/contexts'),
'@/models': resolve(__dirname, './src/models'),
'@/utils': resolve(__dirname, './src/utils'),
'@/services': resolve(__dirname, './src/services'),
'@/design': resolve(__dirname, './src/design')
}
},
// Define environment variables
define: {
'process.env': process.env
}
})

17
package.json Normal file
View File

@@ -0,0 +1,17 @@
{
"name": "schichtenplaner-monorepo",
"private": true,
"workspaces": [
"frontend",
"backend",
"premium"
],
"scripts": {
"docker:build": "docker build -t schichtplan-app .",
"docker:run": "docker run -p 3002:3002 schichtplan-app",
"build:all": "npm run build --workspace=backend && npm run build --workspace=frontend"
},
"devDependencies": {
"typescript": "^5.3.3"
}
}

Submodule premium updated: 21a4671c16...c65016aaab

52
tsconfig.base.json Normal file
View File

@@ -0,0 +1,52 @@
{
"compilerOptions": {
/* LANGUAGE AND ENVIRONMENT */
"target": "ES2022",
"lib": ["ES2022"],
/* MODULES */
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"resolveJsonModule": true,
/* TYPE CHECKING */
"strict": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"exactOptionalPropertyTypes": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
/* EMIT */
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"removeComments": false,
/* INTEROP CONSTRAINTS */
"allowJs": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
/* COMPATIBILITY */
"isolatedModules": true,
"types": ["vite/client", "node"]
},
"include": [
"/premium/**/*"
],
"exclude": [
"node_modules",
"dist",
"build",
"coverage",
"*.test.*",
"*.spec.*"
]
}