Files
calendar/frontend/print.css
Connor Johnstone 4cbc495c48 Add print preview modal with hour range selection
Implements comprehensive print functionality for calendar views:
- Print preview modal with live preview and zoom controls
- Hour range selection for week view (start/end hours)
- Print-specific CSS to hide UI elements and optimize layout
- Event repositioning to align with visible time labels
- Support for both 30-minute and 15-minute time increments
- Mouse wheel zoom functionality in preview

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-08 14:55:18 -04:00

302 lines
12 KiB
CSS

/* Print-specific styles for calendar printing */
@media print {
/* Hide UI elements that shouldn't be printed */
.app-sidebar,
.current-time-indicator-container,
.current-time-indicator,
.print-button,
.nav-button,
.today-button,
.time-increment-button,
.modal-backdrop,
.create-event-modal,
.event-modal,
.calendar-management-modal,
.context-menu {
display: none !important;
}
/* Remove today highlighting from calendar elements */
.calendar-day.today,
.week-day-header.today,
.week-day-column.today {
background-color: transparent !important;
border-color: var(--border-color) !important;
color: var(--text-color) !important;
}
/* Remove today-specific styling from day numbers */
.calendar-day.today .day-number {
background-color: transparent !important;
color: var(--text-color) !important;
font-weight: normal !important;
}
/* Remove today indicator from week day headers */
.week-day-header.today .weekday-name {
color: var(--text-color) !important;
font-weight: normal !important;
}
/* Page setup */
@page {
size: letter landscape;
margin: 0.5in;
}
/* Make app and main container fill full page width */
.app,
.app-main,
.calendar-view {
width: 100% !important;
max-width: none !important;
margin: 0 !important;
padding: 0 !important;
display: block !important;
}
/* Remove any flexbox constraints that might limit width */
.app {
display: block !important;
}
.app-main {
margin-left: 0 !important; /* Remove sidebar margin */
width: 100% !important;
max-width: none !important;
}
/* Ensure calendar uses full available width */
.calendar-container,
.calendar {
width: 100% !important;
max-width: none !important;
margin: 0 !important;
padding: 0 !important;
}
/* Adjust calendar header for printing */
.calendar-header {
margin-bottom: 0.5rem !important;
padding-bottom: 0.5rem !important;
border-bottom: 1px solid var(--border-color) !important;
}
/* Ensure text is readable in print */
body, html {
color: black !important;
background: white !important;
}
/* Make sure event text is readable */
.week-event,
.calendar-event,
.month-event {
border: 1px solid #333 !important;
color: black !important;
font-size: 0.8rem !important;
line-height: 1.2 !important;
}
/* Ensure month view events are visible */
.calendar-day .event-list .event-item {
background-color: #f5f5f5 !important;
border: 1px solid #333 !important;
color: black !important;
}
/* Week view specific adjustments - force full day view */
.week-view-container {
width: 100% !important;
height: auto !important;
overflow: visible !important;
}
.week-day-column {
border-right: 1px solid #333 !important;
height: auto !important;
overflow: visible !important;
}
.time-column {
border-right: 2px solid #333 !important;
width: 60px !important;
min-width: 60px !important;
height: auto !important;
overflow: visible !important;
}
/* Default time slot sizes - will be adjusted by hour range */
.time-slot {
height: 20px !important;
min-height: 20px !important;
max-height: 20px !important;
border-bottom: 1px solid #ddd !important;
overflow: visible !important;
}
/* Time slot quarters for 15-minute mode */
.time-slot.quarter-mode .time-slot-quarter {
height: 5px !important;
min-height: 5px !important;
max-height: 5px !important;
border-bottom: 1px solid #eee !important;
}
/* Time slot halves for 30-minute mode */
.time-slot .time-slot-half {
height: 10px !important;
min-height: 10px !important;
max-height: 10px !important;
border-bottom: 1px solid #eee !important;
}
/* Make hour boundaries more visible */
.time-slot:nth-child(4n) {
border-bottom: 1px solid #333 !important;
height: 20px !important;
}
/* Dynamic hour range hiding for print mode */
body[data-print-mode="true"][data-print-start-hour="1"] .week-view .time-slot:nth-child(1) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="2"] .week-view .time-slot:nth-child(-n+2) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="3"] .week-view .time-slot:nth-child(-n+3) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="4"] .week-view .time-slot:nth-child(-n+4) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="5"] .week-view .time-slot:nth-child(-n+5) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="6"] .week-view .time-slot:nth-child(-n+6) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="7"] .week-view .time-slot:nth-child(-n+7) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="8"] .week-view .time-slot:nth-child(-n+8) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="9"] .week-view .time-slot:nth-child(-n+9) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="10"] .week-view .time-slot:nth-child(-n+10) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="11"] .week-view .time-slot:nth-child(-n+11) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="12"] .week-view .time-slot:nth-child(-n+12) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="13"] .week-view .time-slot:nth-child(-n+13) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="14"] .week-view .time-slot:nth-child(-n+14) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="15"] .week-view .time-slot:nth-child(-n+15) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="16"] .week-view .time-slot:nth-child(-n+16) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="17"] .week-view .time-slot:nth-child(-n+17) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="18"] .week-view .time-slot:nth-child(-n+18) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="19"] .week-view .time-slot:nth-child(-n+19) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="20"] .week-view .time-slot:nth-child(-n+20) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="21"] .week-view .time-slot:nth-child(-n+21) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="22"] .week-view .time-slot:nth-child(-n+22) { display: none !important; }
body[data-print-mode="true"][data-print-start-hour="23"] .week-view .time-slot:nth-child(-n+23) { display: none !important; }
/* Hide hours after end-hour */
body[data-print-mode="true"][data-print-end-hour="1"] .week-view .time-slot:nth-child(n+2) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="2"] .week-view .time-slot:nth-child(n+3) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="3"] .week-view .time-slot:nth-child(n+4) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="4"] .week-view .time-slot:nth-child(n+5) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="5"] .week-view .time-slot:nth-child(n+6) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="6"] .week-view .time-slot:nth-child(n+7) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="7"] .week-view .time-slot:nth-child(n+8) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="8"] .week-view .time-slot:nth-child(n+9) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="9"] .week-view .time-slot:nth-child(n+10) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="10"] .week-view .time-slot:nth-child(n+11) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="11"] .week-view .time-slot:nth-child(n+12) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="12"] .week-view .time-slot:nth-child(n+13) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="13"] .week-view .time-slot:nth-child(n+14) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="14"] .week-view .time-slot:nth-child(n+15) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="15"] .week-view .time-slot:nth-child(n+16) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="16"] .week-view .time-slot:nth-child(n+17) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="17"] .week-view .time-slot:nth-child(n+18) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="18"] .week-view .time-slot:nth-child(n+19) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="19"] .week-view .time-slot:nth-child(n+20) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="20"] .week-view .time-slot:nth-child(n+21) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="21"] .week-view .time-slot:nth-child(n+22) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="22"] .week-view .time-slot:nth-child(n+23) { display: none !important; }
body[data-print-mode="true"][data-print-end-hour="23"] .week-view .time-slot:nth-child(n+24) { display: none !important; }
/* Force the week grid to show full height */
.week-grid,
.week-content,
.time-grid {
height: auto !important;
max-height: none !important;
overflow: visible !important;
}
/* Ensure all hours are visible by removing any height constraints */
.week-view-container,
.week-view-container > div {
height: auto !important;
max-height: none !important;
overflow: visible !important;
}
/* Month view specific adjustments */
.calendar-grid {
border: 1px solid #333 !important;
}
.calendar-day {
border: 1px solid #333 !important;
min-height: 80px !important;
}
/* Ensure grid lines are visible - handled above in main time-slot rules */
/* Make sure header text is visible */
.calendar-header h2,
.calendar-header .month-year {
color: black !important;
font-size: 1.5rem !important;
}
.week-day-header .weekday-name,
.week-day-header .date-number {
color: black !important;
}
/* Time labels in week view */
.time-label {
color: #666 !important;
font-size: 0.75rem !important;
}
/* Remove any shadows or fancy effects */
* {
box-shadow: none !important;
text-shadow: none !important;
}
/* Ensure proper spacing */
.calendar-day .day-number {
margin-bottom: 0.25rem !important;
}
/* Make sure events don't overlap text in month view */
.calendar-day .event-list {
margin-top: 0.25rem !important;
}
/* Force page break before calendar if needed */
.calendar {
page-break-inside: avoid !important;
}
}
/* Additional print button styling for screen display */
.print-button {
background: rgba(255,255,255,0.2);
border: none;
color: white;
font-size: 1.2rem;
width: 40px;
height: 40px;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: background-color 0.2s;
margin-left: 0.5rem;
}
.print-button:hover {
background: rgba(255,255,255,0.3);
}
.print-button:active {
transform: scale(0.95);
}