Skip to content

Your favorite shift management application!

feat: Adds calendar export (#82)

panteL10f86d71f8b3
diff --git a/README.md b/README.md
index 28221c9..0200118 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
> **Note**
>
-> BetterShift is a modern shift management application built with Next.js 16 and SQLite. It helps you organize and manage work shifts across multiple calendars with customizable presets, color coding, password protection and external calendar synchronization. Perfect for anyone managing variable work schedules.
+> BetterShift is a modern shift management application designed to simplify variable work schedules. Manage unlimited calendars with one-click shift toggles, reusable presets, and real-time synchronization across devices. Features include external calendar integration (Google, Outlook, iCal), password-protected calendars, ICS/PDF export, live statistics, and multi-language support. Built with Next.js 16 and SQLite for fast, self-hosted deployment.
## πŸ”— Quick Links
@@ -29,96 +29,49 @@
## ✨ Key Features
-### πŸ“… Smart Shift Calendar Management
+### πŸ“… Calendar & Shift Management
-- **Multiple Calendars** β€” Create unlimited shift calendars with custom names and colors for different jobs, people or schedules
-- **Interactive Month View** β€” Navigate shifts effortlessly with a clean, week-based calendar layout
-- **One-Click Shift Toggle** β€” Left-click any day to instantly add or remove shifts using your active preset
-- **Daily Notes** β€” Right-click any day to attach context notes (e.g., "Early shift for doctor appointment")
-- **External Calendar Sync** β€” Subscribe to external calendars (Google, Outlook, iCal) with automatic or manual refresh
-- **Sync Notification Center** β€” Monitor external calendar sync status, errors, and updates in real-time
+- **Multiple Calendars** β€” Unlimited calendars with custom names and colors
+- **Interactive Month View** β€” Clean, week-based calendar layout with one-click shift toggles
+- **Quick Actions** β€” Left-click to add/remove shifts, right-click to add notes
+- **External Calendar Sync** β€” Subscribe to Google, Outlook or iCal calendars with auto/manual refresh
+- **Sync Monitoring** β€” Real-time sync status and error notifications
-### 🎨 Flexible Customization
+### 🎨 Customization & Organization
-- **Shift Presets** β€” Build reusable templates with custom labels, times, and color-coded categories
-- **Visual Organization** β€” Color-code calendars and shifts for instant visual recognition
-- **Quick Preset Switching** β€” Change active presets on the fly to adapt to different shift patterns
-- **Auto-Save Templates** β€” Automatically save new shift configurations as presets for future use
+- **Shift Presets** β€” Reusable templates with custom labels, times, and colors
+- **Visual Organization** β€” Color-code calendars and shifts for instant recognition
+- **Auto-Save Templates** β€” Automatically save shift configurations for future use
+- **Export Options** β€” Download as ICS or PDF with flexible time range filters
-### πŸ”’ Privacy & Security
+### πŸ”’ Security & Privacy
-- **Password Protection** β€” Lock individual calendars with SHA-256 encrypted passwords
-- **Secure Local Storage** β€” All data stays on your server; passwords are hashed and never stored in plaintext
-- **Per-Calendar Access Control** β€” Different calendars can have different security levels
+- **Password Protection** β€” SHA-256 encrypted calendar passwords
+- **Per-Calendar Access** β€” Different security levels for each calendar
-### 🌍 International by Design
+### πŸ“Š Analytics & Live Updates
-- **Multi-Language Support** β€” Full German, English, and Italian translations built-in
-- **Smart Language Detection** β€” Automatically uses your browser's language preference
-- **Persistent Settings** β€” Language choice saved in cookies across sessions
-- **Easy Switching** β€” Toggle languages anytime from the footer
+- **Real-Time Statistics** β€” Instant shift tracking and hour calculations with visual charts
+- **Server-Sent Events** β€” Changes sync instantly across all open browser tabs
-### πŸ“Š Insightful Analytics
+### 🌍 Multi-Language & Themes
-- **Flexible Time Periods** β€” View statistics for current month, last 30 days, or custom date ranges
-- **Real-Time Stats** β€” Shift totals and hour calculations update instantly when you make changes
-- **Shift Statistics** β€” Track total hours worked with precise duration calculations and more
-- **Work Pattern Analysis** β€” Understand your schedule with aggregated shift data
-
-### ⚑ Live Updates & Sync
-
-- **Server-Sent Events (SSE)** β€” Changes appear instantly across all open browser tabs
-- **Connection Monitoring** β€” Visual indicators show real-time sync status
-- **Offline Resilience** β€” Graceful handling when connection drops, auto-reconnect on restore
-- **Background Refresh** β€” Data updates silently without disrupting your workflow
-- **Skeleton Loading States** β€” Smooth loading experiences with skeleton placeholders
-
-### πŸ”” Version Management & Updates
-
-- **Automatic Update Checks** β€” Detects new releases every 15 minutes with visual notifications
-- **Integrated Changelog** β€” View release notes and version history directly in the app
-
-### 🎨 Customizable Display
-
-- **Dark/Light Theme** β€” Toggle between dark and light modes with system preference detection
-- **View Settings** β€” Customize shift display options and calendar appearance
-- **Flexible Layouts** β€” Adjust calendar views to match your preferences
+- **Built-in Translations** β€” Full German, English, and Italian support
+- **Dark/Light Theme** β€” Toggle themes with system preference detection
- **Responsive Design** β€” Optimized for desktop and mobile devices
-### πŸ› οΈ Modern Foundation
+### πŸ”” Modern Stack & Updates
-- **Next.js 16 + React 19** β€” Built on the latest App Router architecture for peak performance
-- **SQLite + Drizzle ORM** β€” Lightweight file-based database with full TypeScript type safety
-- **Tailwind CSS 4** β€” Modern, responsive design with shadcn/ui component library
-- **Docker Ready** β€” One-command deployment with Docker Compose for easy self-hosting
+- **Auto Update Checks** β€” Detects new releases with visual notifications
+- **Integrated Changelog** β€” View release notes directly in the app
+- **Next.js 16 + React 19** β€” Latest App Router architecture
+- **SQLite + Drizzle ORM** β€” Type-safe database with file-based storage
+- **Docker Ready** β€” Two-command deployment with Docker Compose
---
## πŸ› οΈ Deployment Guide
-### πŸ’» Local Development
-
-```bash
-# Clone the repository
-$ git clone https://github.com/pantelx/bettershift.git && cd bettershift
-
-# Install dependencies
-$ npm install
-
-# Copy the example environment file
-$ cp .env.example .env
-
-# Adjust .env settings as needed
-
-# Set up the database
-$ npm run db:migrate
-
-# Start the development server
-$ npm run dev
-
-# Open your browser at http://localhost:3000
-```
-
### 🐳 Docker Deployment
Deploy using Docker for easy containerized hosting:
@@ -183,12 +136,33 @@ $ npm run build
$ npm start
```
+### πŸ’» Local Development
+
+```bash
+# Clone the repository
+$ git clone https://github.com/pantelx/bettershift.git && cd bettershift
+
+# Install dependencies
+$ npm install
+
+# Copy the example environment file
+$ cp .env.example .env
+
+# Adjust .env settings as needed
+
+# Set up the database
+$ npm run db:migrate
+
+# Start the development server
+$ npm run dev
+
+# Open your browser at http://localhost:3000
+```
+
---
## πŸ“¦ Versioning & Releases
-BetterShift uses [Semantic Versioning](https://semver.org/) (semver) for version management. Releases are automatically created on GitHub when version tags are pushed.
-
### Available Docker Tags
**Stable Releases**:
@@ -202,10 +176,6 @@ BetterShift uses [Semantic Versioning](https://semver.org/) (semver) for version
- `ghcr.io/pantelx/bettershift:dev` - Latest development build from main branch (unstable)
-**Pull Request Builds**:
-
-- `ghcr.io/pantelx/bettershift:pr-123` - Build for pull request #123 (testing only)
-
---
## πŸ—„οΈ Database Management
@@ -231,14 +201,6 @@ $ npm run db:studio
## πŸ§ͺ Testing & Quality Assurance
-### Automated CI Tests
-
-All pull requests are automatically tested with GitHub Actions:
-
-- **ESLint** β€” Checks code quality and style
-- **Build Test** β€” Ensures the application builds successfully (includes TypeScript validation)
-- **Database Migrations** β€” Verifies migrations run without errors
-
### Local Testing
Run these commands before submitting a pull request:
@@ -247,12 +209,13 @@ Run these commands before submitting a pull request:
# Run all tests (lint + build with TypeScript check)
$ npm test
+# Full CI test suite (includes database migration test)
+$ npm run test:ci
+
# Run individual checks
$ npm run lint # ESLint code quality check
$ npm run build # Next.js production build (includes TypeScript validation)
-# Full CI test suite (includes database migration test)
-$ npm run test:ci
```
**Recommended Pre-Commit Workflow:**
diff --git a/app/api/calendars/[id]/export/ics/route.ts b/app/api/calendars/[id]/export/ics/route.ts
new file mode 100644
index 0000000..80f190c
--- /dev/null
+++ b/app/api/calendars/[id]/export/ics/route.ts
@@ -0,0 +1,145 @@
+import { NextResponse } from "next/server";
+import { db } from "@/lib/db";
+import { calendars, shifts } from "@/lib/db/schema";
+import { eq } from "drizzle-orm";
+import { verifyPassword } from "@/lib/password-utils";
+import ICAL from "ical.js";
+
+export async function GET(
+ request: Request,
+ { params }: { params: Promise<{ id: string }> }
+) {
+ try {
+ const { id } = await params;
+ const { searchParams } = new URL(request.url);
+ const password = searchParams.get("password");
+
+ // Get calendar
+ const calendar = await db.query.calendars.findFirst({
+ where: eq(calendars.id, id),
+ });
+
+ if (!calendar) {
+ return NextResponse.json(
+ { error: "Calendar not found" },
+ { status: 404 }
+ );
+ }
+
+ // Check password protection
+ if (calendar.passwordHash && calendar.isLocked) {
+ if (!password || !verifyPassword(password, calendar.passwordHash)) {
+ return NextResponse.json(
+ { error: "Invalid password" },
+ { status: 401 }
+ );
+ }
+ }
+
+ // Get all shifts for this calendar
+ const calendarShifts = await db.query.shifts.findMany({
+ where: eq(shifts.calendarId, id),
+ orderBy: (shifts, { asc }) => [asc(shifts.date)],
+ });
+
+ // Create iCalendar
+ const cal = new ICAL.Component(["vcalendar", [], []]);
+ cal.updatePropertyWithValue(
+ "prodid",
+ "-//BetterShift//Calendar Export//EN"
+ );
+ cal.updatePropertyWithValue("version", "2.0");
+ cal.updatePropertyWithValue("calscale", "GREGORIAN");
+ cal.updatePropertyWithValue("method", "PUBLISH");
+ cal.updatePropertyWithValue("x-wr-calname", calendar.name);
+ cal.updatePropertyWithValue("x-wr-timezone", "UTC");
+
+ // Add shifts as events
+ for (const shift of calendarShifts) {
+ const vevent = new ICAL.Component("vevent");
+ const event = new ICAL.Event(vevent);
+
+ // Set event ID
+ event.uid = shift.id;
+
+ // Set title
+ event.summary = shift.title;
+
+ // Set description (notes)
+ if (shift.notes) {
+ event.description = shift.notes;
+ }
+
+ // Set times
+ const shiftDate = new Date(shift.date);
+
+ if (shift.isAllDay) {
+ // All-day event (DTEND is exclusive per RFC 5545)
+ // Use local date methods to match how dates are stored in the database
+ const year = shiftDate.getFullYear();
+ const month = String(shiftDate.getMonth() + 1).padStart(2, "0");
+ const day = String(shiftDate.getDate()).padStart(2, "0");
+ const dateStr = `${year}-${month}-${day}`;
+
+ const startTime = ICAL.Time.fromDateString(dateStr);
+ event.startDate = startTime;
+
+ // DTEND must be the day after DTSTART for single-day all-day events
+ const endDate = new Date(shiftDate);
+ endDate.setDate(endDate.getDate() + 1);
+ const endYear = endDate.getFullYear();
+ const endMonth = String(endDate.getMonth() + 1).padStart(2, "0");
+ const endDay = String(endDate.getDate()).padStart(2, "0");
+ const endDateStr = `${endYear}-${endMonth}-${endDay}`;
+
+ event.endDate = ICAL.Time.fromDateString(endDateStr);
+ } else {
+ // Timed event
+ const [startHour, startMinute] = shift.startTime.split(":").map(Number);
+ const [endHour, endMinute] = shift.endTime.split(":").map(Number);
+
+ const startDateTime = new Date(shiftDate);
+ startDateTime.setHours(startHour, startMinute, 0, 0);
+
+ const endDateTime = new Date(shiftDate);
+ endDateTime.setHours(endHour, endMinute, 0, 0);
+
+ // Handle shifts that end after midnight
+ if (endDateTime <= startDateTime) {
+ endDateTime.setDate(endDateTime.getDate() + 1);
+ }
+
+ event.startDate = ICAL.Time.fromJSDate(startDateTime, false);
+ event.endDate = ICAL.Time.fromJSDate(endDateTime, false);
+ }
+
+ // Set color (using X-APPLE-CALENDAR-COLOR for Apple Calendar compatibility)
+ vevent.addPropertyWithValue("color", shift.color);
+ vevent.addPropertyWithValue("x-apple-calendar-color", shift.color);
+
+ // Add event to calendar
+ cal.addSubcomponent(vevent);
+ }
+
+ // Generate ICS content
+ const icsContent = cal.toString();
+
+ // Return as downloadable file
+ const filename = `${calendar.name
+ .replace(/[^a-z0-9]/gi, "_")
+ .toLowerCase()}_${new Date().toISOString().split("T")[0]}.ics`;
+
+ return new NextResponse(icsContent, {
+ headers: {
+ "Content-Type": "text/calendar; charset=utf-8",
+ "Content-Disposition": `attachment; filename="${filename}"`,
+ },
+ });
+ } catch (error) {
+ console.error("Error exporting calendar as ICS:", error);
+ return NextResponse.json(
+ { error: "Failed to export calendar" },
+ { status: 500 }
+ );
+ }
+}
diff --git a/app/api/calendars/[id]/export/pdf/route.ts b/app/api/calendars/[id]/export/pdf/route.ts
new file mode 100644
index 0000000..b8508a6
--- /dev/null
+++ b/app/api/calendars/[id]/export/pdf/route.ts
@@ -0,0 +1,222 @@
+import { NextResponse } from "next/server";
+import { db } from "@/lib/db";
+import { calendars, shifts } from "@/lib/db/schema";
+import { eq } from "drizzle-orm";
+import { verifyPassword } from "@/lib/password-utils";
+import { jsPDF } from "jspdf";
+
+export async function GET(
+ request: Request,
+ { params }: { params: Promise<{ id: string }> }
+) {
+ try {
+ const { id } = await params;
+ const { searchParams } = new URL(request.url);
+ const password = searchParams.get("password");
+ const month = searchParams.get("month"); // Format: YYYY-MM
+ const year = searchParams.get("year"); // Format: YYYY
+ const locale = searchParams.get("locale") || "en"; // Default to English
+
+ // Get calendar
+ const calendar = await db.query.calendars.findFirst({
+ where: eq(calendars.id, id),
+ });
+
+ if (!calendar) {
+ return NextResponse.json(
+ { error: "Calendar not found" },
+ { status: 404 }
+ );
+ }
+
+ // Check password protection
+ if (calendar.passwordHash && calendar.isLocked) {
+ if (!password || !verifyPassword(password, calendar.passwordHash)) {
+ return NextResponse.json(
+ { error: "Invalid password" },
+ { status: 401 }
+ );
+ }
+ }
+
+ // Get all shifts for this calendar
+ let calendarShifts = await db.query.shifts.findMany({
+ where: eq(shifts.calendarId, id),
+ orderBy: (shifts, { asc }) => [asc(shifts.date)],
+ });
+
+ // Filter by month or year if provided
+ if (month) {
+ const [filterYear, filterMonth] = month.split("-").map(Number);
+ calendarShifts = calendarShifts.filter((shift) => {
+ const shiftDate = new Date(shift.date);
+ return (
+ shiftDate.getFullYear() === filterYear &&
+ shiftDate.getMonth() + 1 === filterMonth
+ );
+ });
+ } else if (year) {
+ const filterYear = parseInt(year);
+ calendarShifts = calendarShifts.filter((shift) => {
+ const shiftDate = new Date(shift.date);
+ return shiftDate.getFullYear() === filterYear;
+ });
+ }
+
+ // Create PDF
+ const doc = new jsPDF();
+ const pageWidth = doc.internal.pageSize.getWidth();
+ const pageHeight = doc.internal.pageSize.getHeight();
+ const margin = 15;
+ let yPosition = margin;
+
+ // Helper function to add new page if needed
+ const checkPageBreak = (neededSpace: number) => {
+ if (yPosition + neededSpace > pageHeight - margin) {
+ doc.addPage();
+ yPosition = margin;
+ return true;
+ }
+ return false;
+ };
+
+ // Title
+ doc.setFontSize(20);
+ doc.setFont("helvetica", "bold");
+ doc.text(calendar.name, pageWidth / 2, yPosition, { align: "center" });
+ yPosition += 10;
+
+ // Date range
+ doc.setFontSize(10);
+ doc.setFont("helvetica", "normal");
+ if (month || year) {
+ const dateRangeText = month ? `${month}` : `${year}`;
+ doc.text(dateRangeText, pageWidth / 2, yPosition, { align: "center" });
+ yPosition += 10;
+ }
+
+ // Horizontal line
+ doc.setDrawColor(200, 200, 200);
+ doc.line(margin, yPosition, pageWidth - margin, yPosition);
+ yPosition += 8;
+
+ if (calendarShifts.length === 0) {
+ // Empty state - no text needed, the date range shows the filter
+ yPosition += 20;
+ } else {
+ // Group shifts by month
+ const shiftsByMonth = new Map<string, typeof calendarShifts>();
+ for (const shift of calendarShifts) {
+ const shiftDate = new Date(shift.date);
+ const monthKey = `${shiftDate.getFullYear()}-${String(
+ shiftDate.getMonth() + 1
+ ).padStart(2, "0")}`;
+ if (!shiftsByMonth.has(monthKey)) {
+ shiftsByMonth.set(monthKey, []);
+ }
+ shiftsByMonth.get(monthKey)!.push(shift);
+ }
+
+ // Sort months chronologically
+ const sortedMonths = Array.from(shiftsByMonth.keys()).sort();
+
+ for (const monthKey of sortedMonths) {
+ const monthShifts = shiftsByMonth.get(monthKey)!;
+ const [monthYear, monthNum] = monthKey.split("-");
+ const monthDate = new Date(parseInt(monthYear), parseInt(monthNum) - 1);
+ const monthName = monthDate.toLocaleDateString(locale, {
+ month: "long",
+ year: "numeric",
+ });
+
+ checkPageBreak(20);
+
+ // Month header
+ doc.setFontSize(14);
+ doc.setFont("helvetica", "bold");
+ doc.text(monthName, margin, yPosition);
+ yPosition += 7;
+
+ // Shifts for this month
+ doc.setFontSize(10);
+ doc.setFont("helvetica", "normal");
+
+ for (const shift of monthShifts) {
+ checkPageBreak(15);
+
+ const shiftDate = new Date(shift.date);
+ const dateStr = shiftDate.toLocaleDateString(locale, {
+ weekday: "short",
+ day: "2-digit",
+ month: "2-digit",
+ });
+
+ // Color indicator (small rectangle)
+ doc.setFillColor(shift.color);
+ doc.rect(margin, yPosition - 2, 3, 3, "F");
+
+ // Date
+ doc.setFont("helvetica", "bold");
+ doc.text(dateStr, margin + 6, yPosition);
+
+ // Time
+ doc.setFont("helvetica", "normal");
+ const timeStr = shift.isAllDay
+ ? "β€”" // Em dash for all-day shifts
+ : `${shift.startTime} - ${shift.endTime}`;
+ doc.text(timeStr, margin + 35, yPosition);
+
+ // Title
+ doc.setFont("helvetica", "bold");
+ doc.text(shift.title, margin + 70, yPosition);
+
+ yPosition += 5;
+
+ // Notes (if present)
+ if (shift.notes) {
+ doc.setFont("helvetica", "italic");
+ doc.setFontSize(9);
+ const notesLines = doc.splitTextToSize(
+ shift.notes,
+ pageWidth - margin * 2 - 10
+ );
+ for (const line of notesLines) {
+ checkPageBreak(5);
+ doc.text(line, margin + 10, yPosition);
+ yPosition += 4;
+ }
+ doc.setFontSize(10);
+ yPosition += 2;
+ } else {
+ yPosition += 3;
+ }
+ }
+
+ yPosition += 5;
+ }
+ }
+
+ // Generate PDF buffer
+ const pdfBuffer = Buffer.from(doc.output("arraybuffer"));
+
+ // Return as downloadable file
+ const filename = `${calendar.name
+ .replace(/[^a-z0-9]/gi, "_")
+ .toLowerCase()}_${month || year || "all"}_${
+ new Date().toISOString().split("T")[0]
+ }.pdf`;
+
+ return new NextResponse(pdfBuffer, {
+ headers: {
+ "Content-Type": "application/pdf",
+ "Content-Disposition": `attachment; filename="${filename}"`,
+ },
+ });
+ } catch (error) {
+ console.error("Error exporting calendar as PDF:", error);
+ return NextResponse.json(
+ { error: "Failed to export calendar" },
+ { status: 500 }
+ );
+ }
+}
diff --git a/components/calendar-settings-dialog.tsx b/components/calendar-settings-dialog.tsx
index d97fa10..d975770 100644
--- a/components/calendar-settings-dialog.tsx
+++ b/components/calendar-settings-dialog.tsx
@@ -14,9 +14,14 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Checkbox } from "@/components/ui/checkbox";
-import { removeCachedPassword, setCachedPassword } from "@/lib/password-cache";
+import {
+ removeCachedPassword,
+ setCachedPassword,
+ getCachedPassword,
+} from "@/lib/password-cache";
import { PRESET_COLORS } from "@/lib/constants";
-import { AlertTriangle, Trash2 } from "lucide-react";
+import { AlertTriangle, Trash2, Download } from "lucide-react";
+import { ExportDialog } from "@/components/export-dialog";
interface CalendarSettingsDialogProps {
open: boolean;
@@ -52,6 +57,8 @@ export function CalendarSettingsDialog({
const [error, setError] = useState("");
const [loading, setLoading] = useState(false);
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
+ const [showExportDialog, setShowExportDialog] = useState(false);
+ const [canExport, setCanExport] = useState(false);
useEffect(() => {
if (open) {
@@ -64,8 +71,17 @@ export function CalendarSettingsDialog({
setLockCalendar(isLocked);
setError("");
setShowDeleteConfirm(false);
+ setShowExportDialog(false);
+
+ // Check if export is allowed (no password or password is cached)
+ if (!hasPassword || !isLocked) {
+ setCanExport(true);
+ } else {
+ const cachedPassword = getCachedPassword(calendarId);
+ setCanExport(!!cachedPassword);
+ }
}
- }, [open, calendarName, calendarColor, isLocked]);
+ }, [open, calendarName, calendarColor, isLocked, hasPassword, calendarId]);
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
@@ -355,6 +371,21 @@ export function CalendarSettingsDialog({
</p>
)}
+ {/* Export Section */}
+ {canExport && (
+ <div className="pt-4 mt-4 border-t border-border/50">
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => setShowExportDialog(true)}
+ className="w-full h-11 border-primary/30 hover:bg-primary/10 hover:border-primary/50"
+ >
+ <Download className="h-4 w-4 mr-2" />
+ {t("export.exportCalendar")}
+ </Button>
+ </div>
+ )}
+
{/* Delete Section */}
<div className="pt-4 mt-4 border-t border-border/50">
<div className="space-y-3">
@@ -434,6 +465,13 @@ export function CalendarSettingsDialog({
</div>
</form>
</DialogContent>
+
+ <ExportDialog
+ open={showExportDialog}
+ onOpenChange={setShowExportDialog}
+ calendarId={calendarId}
+ calendarName={calendarName}
+ />
</Dialog>
);
}
diff --git a/components/export-dialog.tsx b/components/export-dialog.tsx
new file mode 100644
index 0000000..b41a677
--- /dev/null
+++ b/components/export-dialog.tsx
@@ -0,0 +1,309 @@
+"use client";
+
+import { useState, useEffect, useMemo } from "react";
+import { useTranslations, useLocale } from "next-intl";
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+ DialogDescription,
+} from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
+import { Label } from "@/components/ui/label";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
+import { Download, FileText, Calendar } from "lucide-react";
+import { toast } from "sonner";
+import { getCachedPassword } from "@/lib/password-cache";
+
+interface ExportDialogProps {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ calendarId: string;
+ calendarName: string;
+}
+
+export function ExportDialog({
+ open,
+ onOpenChange,
+ calendarId,
+ calendarName,
+}: ExportDialogProps) {
+ const t = useTranslations();
+ const locale = useLocale();
+ const [exportFormat, setExportFormat] = useState<"ics" | "pdf">("ics");
+ const [exportRange, setExportRange] = useState<"all" | "month" | "year">(
+ "all"
+ );
+ const [selectedMonth, setSelectedMonth] = useState("");
+ const [selectedYear, setSelectedYear] = useState("");
+ const [loading, setLoading] = useState(false);
+
+ // Generate month options (current month Β± 12 months)
+ const monthOptions = useMemo(() => {
+ const options = [];
+ const today = new Date();
+ for (let i = -12; i <= 12; i++) {
+ const date = new Date(today.getFullYear(), today.getMonth() + i, 1);
+ const value = `${date.getFullYear()}-${String(
+ date.getMonth() + 1
+ ).padStart(2, "0")}`;
+ const label = date.toLocaleDateString(locale, {
+ month: "long",
+ year: "numeric",
+ });
+ options.push({ value, label });
+ }
+ return options;
+ }, [locale]);
+
+ // Generate year options (current year Β± 5 years)
+ const yearOptions = useMemo(() => {
+ const options = [];
+ const today = new Date();
+ const currentYear = today.getFullYear();
+ for (let i = -5; i <= 5; i++) {
+ const year = currentYear + i;
+ options.push({ value: year.toString(), label: year.toString() });
+ }
+ return options;
+ }, []);
+
+ // Initialize or reset state when dialog opens/closes
+ useEffect(() => {
+ if (open) {
+ // Set default selections when dialog opens
+ const today = new Date();
+ const defaultMonth = `${today.getFullYear()}-${String(
+ today.getMonth() + 1
+ ).padStart(2, "0")}`;
+ const currentYear = today.getFullYear();
+
+ setSelectedMonth(defaultMonth);
+ setSelectedYear(currentYear.toString());
+ } else {
+ // Reset state when dialog closes
+ setExportFormat("ics");
+ setExportRange("all");
+ setSelectedMonth("");
+ setSelectedYear("");
+ setLoading(false);
+ }
+ }, [open]);
+
+ const handleExport = async () => {
+ setLoading(true);
+
+ try {
+ // Get cached password if calendar is protected
+ const password = getCachedPassword(calendarId);
+
+ // Build URL
+ let url = `/api/calendars/${calendarId}/export/${exportFormat}`;
+ const params = new URLSearchParams();
+
+ if (password) {
+ params.append("password", password);
+ }
+
+ if (exportFormat === "pdf") {
+ // Add locale for proper date formatting and translations
+ params.append("locale", locale);
+
+ if (exportRange === "month" && selectedMonth) {
+ params.append("month", selectedMonth);
+ } else if (exportRange === "year" && selectedYear) {
+ params.append("year", selectedYear);
+ }
+ }
+
+ if (params.toString()) {
+ url += `?${params.toString()}`;
+ }
+
+ // Fetch the file
+ const response = await fetch(url);
+
+ if (!response.ok) {
+ if (response.status === 401) {
+ toast.error(t("validation.passwordRequired"));
+ setLoading(false);
+ return;
+ }
+ throw new Error("Export failed");
+ }
+
+ // Download the file
+ const blob = await response.blob();
+ const downloadUrl = window.URL.createObjectURL(blob);
+ const link = document.createElement("a");
+ link.href = downloadUrl;
+
+ // Get filename from Content-Disposition header or create one
+ const contentDisposition = response.headers.get("Content-Disposition");
+ let filename = `${calendarName
+ .replace(/[^a-z0-9]/gi, "_")
+ .toLowerCase()}_export.${exportFormat}`;
+ if (contentDisposition) {
+ const filenameMatch = contentDisposition.match(/filename="(.+)"/);
+ if (filenameMatch) {
+ filename = filenameMatch[1];
+ }
+ }
+
+ link.download = filename;
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ window.URL.revokeObjectURL(downloadUrl);
+
+ toast.success(t("export.success"));
+ onOpenChange(false);
+ } catch (error) {
+ console.error("Export error:", error);
+ toast.error(t("export.error"));
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent className="sm:max-w-[600px] max-w-[95vw] max-h-[85vh] flex flex-col p-0 gap-0 border border-border/50 bg-gradient-to-b from-background via-background to-muted/30 backdrop-blur-xl shadow-2xl">
+ <DialogHeader className="border-b border-border/50 bg-gradient-to-r from-primary/10 via-primary/5 to-transparent p-6 pb-5 space-y-1.5">
+ <DialogTitle className="text-xl font-semibold bg-gradient-to-r from-foreground to-foreground/70 bg-clip-text">
+ {t("export.title")}
+ </DialogTitle>
+ <DialogDescription className="text-sm text-muted-foreground">
+ {t("export.description")}
+ </DialogDescription>
+ </DialogHeader>
+
+ <div className="space-y-4 overflow-y-auto flex-1 px-6 pb-6 pt-6">
+ {/* Export Format */}
+ <div className="space-y-2">
+ <Label>{t("export.formatLabel")}</Label>
+ <Select
+ value={exportFormat}
+ onValueChange={(value) => setExportFormat(value as "ics" | "pdf")}
+ >
+ <SelectTrigger>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="ics">
+ <div className="flex items-center gap-2">
+ <Calendar className="h-4 w-4" />
+ <span>{t("export.icsFormat")}</span>
+ </div>
+ </SelectItem>
+ <SelectItem value="pdf">
+ <div className="flex items-center gap-2">
+ <FileText className="h-4 w-4" />
+ <span>{t("export.pdfFormat")}</span>
+ </div>
+ </SelectItem>
+ </SelectContent>
+ </Select>
+ <p className="text-xs text-muted-foreground">
+ {exportFormat === "ics"
+ ? t("export.icsHint")
+ : t("export.pdfHint")}
+ </p>
+ </div>
+
+ {/* Export Range (only for PDF) */}
+ {exportFormat === "pdf" && (
+ <>
+ <div className="space-y-2">
+ <Label>{t("export.rangeLabel")}</Label>
+ <Select
+ value={exportRange}
+ onValueChange={(value) =>
+ setExportRange(value as "all" | "month" | "year")
+ }
+ >
+ <SelectTrigger>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="all">{t("export.rangeAll")}</SelectItem>
+ <SelectItem value="month">
+ {t("export.rangeMonth")}
+ </SelectItem>
+ <SelectItem value="year">
+ {t("export.rangeYear")}
+ </SelectItem>
+ </SelectContent>
+ </Select>
+ </div>
+
+ {/* Month Selector */}
+ {exportRange === "month" && (
+ <div className="space-y-2">
+ <Label>{t("export.monthLabel")}</Label>
+ <Select
+ value={selectedMonth}
+ onValueChange={setSelectedMonth}
+ >
+ <SelectTrigger>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {monthOptions.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ )}
+
+ {/* Year Selector */}
+ {exportRange === "year" && (
+ <div className="space-y-2">
+ <Label>{t("export.yearLabel")}</Label>
+ <Select value={selectedYear} onValueChange={setSelectedYear}>
+ <SelectTrigger>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {yearOptions.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ )}
+ </>
+ )}
+
+ {/* Export Button */}
+ <div className="flex justify-end gap-2 pt-4">
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => onOpenChange(false)}
+ disabled={loading}
+ >
+ {t("common.cancel")}
+ </Button>
+ <Button onClick={handleExport} disabled={loading}>
+ <Download className="h-4 w-4 mr-2" />
+ {loading ? t("common.loading") : t("export.download")}
+ </Button>
+ </div>
+ </div>
+ </DialogContent>
+ </Dialog>
+ );
+}
diff --git a/messages/de.json b/messages/de.json
index 0f5a801..0aae5f6 100644
--- a/messages/de.json
+++ b/messages/de.json
@@ -293,6 +293,25 @@
"noReleases": "Keine Releases verfΓΌgbar",
"viewOnGitHub": "Auf GitHub ansehen"
},
+ "export": {
+ "title": "Kalender exportieren",
+ "description": "Exportiere deinen Kalender als ICS- oder PDF-Datei",
+ "exportCalendar": "Kalender exportieren",
+ "formatLabel": "Export-Format",
+ "icsFormat": "ICS (Kalenderdatei)",
+ "pdfFormat": "PDF (Dokument)",
+ "icsHint": "Exportiere als ICS-Datei zum Importieren in andere Kalender-Apps (Apple Kalender, Google Kalender, Outlook usw.)",
+ "pdfHint": "Exportiere als PDF-Dokument zum Drucken oder Teilen",
+ "rangeLabel": "Zeitraum",
+ "rangeAll": "Alle Schichten",
+ "rangeMonth": "Einzelner Monat",
+ "rangeYear": "Einzelnes Jahr",
+ "monthLabel": "Monat auswΓ€hlen",
+ "yearLabel": "Jahr auswΓ€hlen",
+ "download": "Herunterladen",
+ "success": "Export erfolgreich",
+ "error": "Export fehlgeschlagen"
+ },
"update": {
"available": "Update verfΓΌgbar",
"newVersion": "Version {version} ist verfΓΌgbar",
diff --git a/messages/en.json b/messages/en.json
index 1b32a10..ad99a54 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -289,13 +289,32 @@
},
"changelog": {
"title": "Changelog",
- "description": "All release notes and changes for BetterShift",
+ "description": "All release notes and changes of BetterShift",
"noReleases": "No releases available",
"viewOnGitHub": "View on GitHub"
},
+ "export": {
+ "title": "Export Calendar",
+ "description": "Export your calendar as an ICS or PDF file",
+ "exportCalendar": "Export Calendar",
+ "formatLabel": "Export Format",
+ "icsFormat": "ICS (Calendar File)",
+ "pdfFormat": "PDF (Document)",
+ "icsHint": "Export as ICS file to import into other calendar apps (Apple Calendar, Google Calendar, Outlook, etc.)",
+ "pdfHint": "Export as PDF document for printing or sharing",
+ "rangeLabel": "Time Range",
+ "rangeAll": "All Shifts",
+ "rangeMonth": "Single Month",
+ "rangeYear": "Single Year",
+ "monthLabel": "Select Month",
+ "yearLabel": "Select Year",
+ "download": "Download",
+ "success": "Export successful",
+ "error": "Export failed"
+ },
"update": {
- "available": "Update available",
+ "available": "Update Available",
"newVersion": "Version {version} is available",
- "viewChangelog": "View changelog"
+ "viewChangelog": "View Changelog"
}
}
diff --git a/messages/it.json b/messages/it.json
index 8e525fd..7882cfc 100644
--- a/messages/it.json
+++ b/messages/it.json
@@ -292,6 +292,25 @@
"noReleases": "Nessun rilascio disponibile",
"viewOnGitHub": "Visualizza su GitHub"
},
+ "export": {
+ "title": "Esporta Calendario",
+ "description": "Esporta il tuo calendario come file ICS o PDF",
+ "exportCalendar": "Esporta Calendario",
+ "formatLabel": "Formato di esportazione",
+ "icsFormat": "ICS (File Calendario)",
+ "pdfFormat": "PDF (Documento)",
+ "icsHint": "Esporta come file ICS per importare in altre app di calendario (Apple Calendar, Google Calendar, Outlook, ecc.)",
+ "pdfHint": "Esporta come documento PDF per la stampa o la condivisione",
+ "rangeLabel": "Periodo di tempo",
+ "rangeAll": "Tutti i turni",
+ "rangeMonth": "Singolo mese",
+ "rangeYear": "Singolo anno",
+ "monthLabel": "Seleziona mese",
+ "yearLabel": "Seleziona anno",
+ "download": "Scarica",
+ "success": "Esportazione riuscita",
+ "error": "Esportazione fallita"
+ },
"update": {
"available": "Aggiornamento disponibile",
"newVersion": "Versione {version} Γ¨ disponibile",
diff --git a/package-lock.json b/package-lock.json
index cda45a3..ccc48c2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -25,6 +25,7 @@
"drizzle-kit": "^0.31.7",
"drizzle-orm": "^0.44.7",
"ical.js": "^2.2.1",
+ "jspdf": "^3.0.4",
"lucide-react": "^0.555.0",
"motion": "^12.23.25",
"next": "16.0.10",
@@ -256,6 +257,15 @@
"node": ">=6.0.0"
}
},
+ "node_modules/@babel/runtime": {
+ "version": "7.28.4",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.4.tgz",
+ "integrity": "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
"node_modules/@babel/template": {
"version": "7.27.2",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz",
@@ -3612,6 +3622,19 @@
"undici-types": "~7.16.0"
}
},
+ "node_modules/@types/pako": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/@types/pako/-/pako-2.0.4.tgz",
+ "integrity": "sha512-VWDCbrLeVXJM9fihYodcLiIv0ku+AlOa/TQ1SvYOaBuyrSKgEcro95LJyIsJ4vSo6BXIxOKxiJAat04CmST9Fw==",
+ "license": "MIT"
+ },
+ "node_modules/@types/raf": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/@types/raf/-/raf-3.4.3.tgz",
+ "integrity": "sha512-c4YAvMedbPZ5tEyxzQdMoOhhJ4RD3rngZIdwC2/qDN3d7JpEhB6fiBRKVY1lg5B7Wk+uPBjn5f39j1/2MY1oOw==",
+ "license": "MIT",
+ "optional": true
+ },
"node_modules/@types/react": {
"version": "19.2.7",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz",
@@ -3632,6 +3655,13 @@
"@types/react": "^19.2.0"
}
},
+ "node_modules/@types/trusted-types": {
+ "version": "2.0.7",
+ "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
+ "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
+ "license": "MIT",
+ "optional": true
+ },
"node_modules/@types/use-sync-external-store": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz",
@@ -4481,6 +4511,16 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/base64-arraybuffer": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
+ "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==",
+ "license": "MIT",
+ "optional": true,
+ "engines": {
+ "node": ">= 0.6.0"
+ }
+ },
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
@@ -4713,6 +4753,26 @@
],
"license": "CC-BY-4.0"
},
+ "node_modules/canvg": {
+ "version": "3.0.11",
+ "resolved": "https://registry.npmjs.org/canvg/-/canvg-3.0.11.tgz",
+ "integrity": "sha512-5ON+q7jCTgMp9cjpu4Jo6XbvfYwSB2Ow3kzHKfIyJfaCAOHLbdKPQqGKgfED/R5B+3TFFfe8pegYA+b423SRyA==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "@babel/runtime": "^7.12.5",
+ "@types/raf": "^3.4.0",
+ "core-js": "^3.8.3",
+ "raf": "^3.4.1",
+ "regenerator-runtime": "^0.13.7",
+ "rgbcolor": "^1.0.1",
+ "stackblur-canvas": "^2.0.0",
+ "svg-pathdata": "^6.0.3"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
"node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@@ -4797,6 +4857,18 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/core-js": {
+ "version": "3.47.0",
+ "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.47.0.tgz",
+ "integrity": "sha512-c3Q2VVkGAUyupsjRnaNX6u8Dq2vAdzm9iuPj5FW0fRxzlxgq9Q39MDq10IvmQSpLgHQNyQzQmOo6bgGHmH3NNg==",
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/core-js"
+ }
+ },
"node_modules/cross-spawn": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
@@ -4812,6 +4884,16 @@
"node": ">= 8"
}
},
+ "node_modules/css-line-break": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz",
+ "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "utrie": "^1.0.2"
+ }
+ },
"node_modules/csstype": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
@@ -5141,6 +5223,16 @@
"node": ">=0.10.0"
}
},
+ "node_modules/dompurify": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.3.1.tgz",
+ "integrity": "sha512-qkdCKzLNtrgPFP1Vo+98FRzJnBRGe4ffyCea9IwHB1fyxPOeNTHpLKYGd4Uk9xvNoH0ZoOjwZxNptyMwqrId1Q==",
+ "license": "(MPL-2.0 OR Apache-2.0)",
+ "optional": true,
+ "optionalDependencies": {
+ "@types/trusted-types": "^2.0.7"
+ }
+ },
"node_modules/dotenv": {
"version": "17.2.3",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.3.tgz",
@@ -6098,6 +6190,17 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/fast-png": {
+ "version": "6.4.0",
+ "resolved": "https://registry.npmjs.org/fast-png/-/fast-png-6.4.0.tgz",
+ "integrity": "sha512-kAqZq1TlgBjZcLr5mcN6NP5Rv4V2f22z00c3g8vRrwkcqjerx7BEhPbOnWCPqaHUl2XWQBJQvOT/FQhdMT7X/Q==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/pako": "^2.0.3",
+ "iobuffer": "^5.3.2",
+ "pako": "^2.1.0"
+ }
+ },
"node_modules/fastq": {
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz",
@@ -6108,6 +6211,12 @@
"reusify": "^1.0.4"
}
},
+ "node_modules/fflate": {
+ "version": "0.8.2",
+ "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz",
+ "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==",
+ "license": "MIT"
+ },
"node_modules/file-entry-cache": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",
@@ -6546,6 +6655,20 @@
"hermes-estree": "0.25.1"
}
},
+ "node_modules/html2canvas": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz",
+ "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "css-line-break": "^2.1.0",
+ "text-segmentation": "^1.0.3"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
"node_modules/ical.js": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/ical.js/-/ical.js-2.2.1.tgz",
@@ -6667,6 +6790,12 @@
"tslib": "^2.8.0"
}
},
+ "node_modules/iobuffer": {
+ "version": "5.4.0",
+ "resolved": "https://registry.npmjs.org/iobuffer/-/iobuffer-5.4.0.tgz",
+ "integrity": "sha512-DRebOWuqDvxunfkNJAlc3IzWIPD5xVxwUNbHr7xKB8E6aLJxIPfNX3CoMJghcFjpv6RWQsrcJbghtEwSPoJqMA==",
+ "license": "MIT"
+ },
"node_modules/is-array-buffer": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz",
@@ -7191,6 +7320,23 @@
"node": ">=6"
}
},
+ "node_modules/jspdf": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/jspdf/-/jspdf-3.0.4.tgz",
+ "integrity": "sha512-dc6oQ8y37rRcHn316s4ngz/nOjayLF/FFxBF4V9zamQKRqXxyiH1zagkCdktdWhtoQId5K20xt1lB90XzkB+hQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/runtime": "^7.28.4",
+ "fast-png": "^6.2.0",
+ "fflate": "^0.8.1"
+ },
+ "optionalDependencies": {
+ "canvg": "^3.0.11",
+ "core-js": "^3.6.0",
+ "dompurify": "^3.2.4",
+ "html2canvas": "^1.0.0-rc.5"
+ }
+ },
"node_modules/jsx-ast-utils": {
"version": "3.3.5",
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz",
@@ -7880,17 +8026,6 @@
}
}
},
- "node_modules/next-intl/node_modules/@swc/helpers": {
- "version": "0.5.17",
- "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.17.tgz",
- "integrity": "sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A==",
- "license": "Apache-2.0",
- "optional": true,
- "peer": true,
- "dependencies": {
- "tslib": "^2.8.0"
- }
- },
"node_modules/next-themes": {
"version": "0.4.6",
"resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.4.6.tgz",
@@ -8160,6 +8295,12 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/pako": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz",
+ "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==",
+ "license": "(MIT AND Zlib)"
+ },
"node_modules/parent-module": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
@@ -8200,6 +8341,13 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/performance-now": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
+ "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==",
+ "license": "MIT",
+ "optional": true
+ },
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
@@ -8353,6 +8501,16 @@
],
"license": "MIT"
},
+ "node_modules/raf": {
+ "version": "3.4.1",
+ "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz",
+ "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "performance-now": "^2.1.0"
+ }
+ },
"node_modules/rc": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
@@ -8609,6 +8767,13 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/regenerator-runtime": {
+ "version": "0.13.11",
+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
+ "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==",
+ "license": "MIT",
+ "optional": true
+ },
"node_modules/regexp.prototype.flags": {
"version": "1.5.4",
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz",
@@ -8687,6 +8852,16 @@
"node": ">=0.10.0"
}
},
+ "node_modules/rgbcolor": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/rgbcolor/-/rgbcolor-1.0.1.tgz",
+ "integrity": "sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==",
+ "license": "MIT OR SEE LICENSE IN FEEL-FREE.md",
+ "optional": true,
+ "engines": {
+ "node": ">= 0.8.15"
+ }
+ },
"node_modules/run-parallel": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
@@ -9098,6 +9273,16 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/stackblur-canvas": {
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/stackblur-canvas/-/stackblur-canvas-2.7.0.tgz",
+ "integrity": "sha512-yf7OENo23AGJhBriGx0QivY5JP6Y1HbrrDI6WLt6C5auYZXlQrheoY8hD4ibekFKz1HOfE48Ww8kMWMnJD/zcQ==",
+ "license": "MIT",
+ "optional": true,
+ "engines": {
+ "node": ">=0.1.14"
+ }
+ },
"node_modules/stop-iteration-iterator": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz",
@@ -9306,6 +9491,16 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/svg-pathdata": {
+ "version": "6.0.3",
+ "resolved": "https://registry.npmjs.org/svg-pathdata/-/svg-pathdata-6.0.3.tgz",
+ "integrity": "sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==",
+ "license": "MIT",
+ "optional": true,
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
"node_modules/tailwind-merge": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.4.0.tgz",
@@ -9365,6 +9560,16 @@
"node": ">=6"
}
},
+ "node_modules/text-segmentation": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz",
+ "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "utrie": "^1.0.2"
+ }
+ },
"node_modules/tiny-invariant": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz",
@@ -9802,6 +10007,16 @@
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"license": "MIT"
},
+ "node_modules/utrie": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz",
+ "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "base64-arraybuffer": "^1.0.2"
+ }
+ },
"node_modules/victory-vendor": {
"version": "37.3.6",
"resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz",
diff --git a/package.json b/package.json
index e22ad61..9514314 100644
--- a/package.json
+++ b/package.json
@@ -35,6 +35,7 @@
"drizzle-kit": "^0.31.7",
"drizzle-orm": "^0.44.7",
"ical.js": "^2.2.1",
+ "jspdf": "^3.0.4",
"lucide-react": "^0.555.0",
"motion": "^12.23.25",
"next": "16.0.10",