Show list on mobile - #754
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe default calendar now supports a saved grid-on-desktop and list-on-mobile option. Server rendering emits both view shells. CSS controls visibility at 768px. JavaScript lazily initializes visible views and handles responsive changes. ChangesResponsive calendar views
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Admin
participant DefaultCalendar
participant Browser
participant DefaultCalendarJS
Admin->>DefaultCalendar: save mobile list-view setting
DefaultCalendar->>Browser: render grid and list shells
Browser->>DefaultCalendarJS: report viewport visibility change
DefaultCalendarJS->>Browser: initialize visible calendar view
DefaultCalendarJS->>Browser: refresh visible grid after debounce
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 PHPStan (2.2.7)PHP Warning: require(/vendor/composer/../guzzlehttp/promises/src/functions_include.php): Failed to open stream: No such file or directory in /vendor/composer/autoload_real.php on line 39 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@includes/calendars/default-calendar.php`:
- Around line 194-201: Update the responsive rendering block around
render_view_shell() so simcal_calendar_html_before and
simcal_calendar_html_after each execute once per calendar, wrapping both the
desktop $view and mobile $list_view shells rather than being triggered
separately for each view. Preserve the existing view rendering order and
powered-by output.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e6e1dfe1-1f6a-42ee-bfc3-def81bdf8b9a
📒 Files selected for processing (6)
assets/css/default-calendar-grid.cssassets/js/admin.jsassets/js/default-calendar.jsincludes/abstracts/calendar.phpincludes/calendars/admin/default-calendar-admin.phpincludes/calendars/default-calendar.php
| $this->render_view_shell($view, false); | ||
|
|
||
| // List (mobile) — apply list properties once, then render. | ||
| $this->set_properties('list'); | ||
| $list_view = $this->get_view('list'); | ||
| $this->render_view_shell($list_view, false); | ||
|
|
||
| $this->render_powered_by(); |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Find callbacks that depend on calendar HTML actions firing once per calendar.
rg -n -C 4 \
"simcal_calendar_html_before|simcal_calendar_html_after" \
--glob '*.php' .Repository: Xtendify/Simple-Calendar
Length of output: 884
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- render_view_shell and calendar html() ---'
sed -n '820,920p' includes/abstracts/calendar.php
printf '%s\n' '--- responsive rendering context ---'
sed -n '150,220p' includes/calendars/default-calendar.php
printf '%s\n' '--- all action registrations and documentation ---'
rg -n -C 5 \
"add_action\s*\(\s*['\"]simcal_calendar_html_(before|after)|simcal_calendar_html_(before|after)" \
--glob '*.php' --glob '*.md' --glob '*.txt' .Repository: Xtendify/Simple-Calendar
Length of output: 5054
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- public html() and normal rendering path ---'
sed -n '760,835p' includes/abstracts/calendar.php
printf '%s\n' '--- action occurrences, including non-PHP files ---'
rg -n -C 3 \
"simcal_calendar_html_(before|after)" \
.
printf '%s\n' '--- static count of action calls in relevant rendering methods ---'
python3 - <<'PY'
from pathlib import Path
for name in ("includes/abstracts/calendar.php", "includes/calendars/default-calendar.php"):
text = Path(name).read_text()
for action in ("simcal_calendar_html_before", "simcal_calendar_html_after"):
print(name, action, text.count(f"do_action('{action}'"))
PYRepository: Xtendify/Simple-Calendar
Length of output: 3506
🌐 Web query:
Simple Calendar WordPress "simcal_calendar_html_before" "simcal_calendar_html_after"
💡 Result:
The hooks simcal_calendar_html_before and simcal_calendar_html_after are WordPress action hooks provided by the Simple Calendar plugin [1][2]. They allow developers to inject custom HTML or content immediately before or after the calendar's output on a page, respectively [1][2]. These hooks are commonly used to add programmatic content—such as conditional messages, password protection forms, or custom wrappers—that needs to appear alongside the calendar instance [1][2]. Example Usage To use these hooks, you add a function to your theme's functions.php file or a custom plugin using the add_action function [1][2]. For example, the following code snippet demonstrates how to use simcal_calendar_html_before to display a password protection form [1][2]: add_action('simcal_calendar_html_before', 'render_custom_content', 10); function render_custom_content { echo '
Citations:
- 1: https://passwordprotectwp.com/docs/password-protect-simple-calendar-pages/
- 2: http://passwordprotectwp.com/docs/password-protect-simple-calendar-pages/
Fire calendar HTML actions once per responsive calendar.
In the responsive branch, render_view_shell() fires simcal_calendar_html_before and simcal_calendar_html_after once per view. Invoke each action once around both view shells to prevent duplicate callback markup and side effects.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@includes/calendars/default-calendar.php` around lines 194 - 201, Update the
responsive rendering block around render_view_shell() so
simcal_calendar_html_before and simcal_calendar_html_after each execute once per
calendar, wrapping both the desktop $view and mobile $list_view shells rather
than being triggered separately for each view. Preserve the existing view
rendering order and powered-by output.
Description: Add a option in admin so user can check it show the list view on mobile while grid is selected as view type.
Clickup: https://app.clickup.com/t/1867958/86cwmepym
After: https://drive.google.com/file/d/1otOKtJ5w8-sbdViAUAtwPyZ1qUN8StdD/view?usp=drivesdk
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes