Skip to content

Show list on mobile - #754

Open
Akhill2020 wants to merge 2 commits into
mainfrom
issue-show-list-onmobile
Open

Show list on mobile#754
Akhill2020 wants to merge 2 commits into
mainfrom
issue-show-list-onmobile

Conversation

@Akhill2020

@Akhill2020 Akhill2020 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

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

    • Added an option to show calendar grid views on desktop and list views on mobile.
    • Added responsive styling and automatic switching between calendar layouts.
    • Added administrative controls for enabling list view on mobile.
  • Bug Fixes

    • Improved calendar initialization and resizing when switching between responsive views.
    • Prevented unnecessary processing of hidden calendar views.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9246a726-d7b3-461c-81ee-48d5e6377db6

📥 Commits

Reviewing files that changed from the base of the PR and between 6c3f648 and 02e66fe.

📒 Files selected for processing (1)
  • includes/calendars/default-calendar.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • includes/calendars/default-calendar.php

📝 Walkthrough

Walkthrough

The 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.

Changes

Responsive calendar views

Layer / File(s) Summary
Responsive calendar configuration
includes/calendars/admin/default-calendar-admin.php, includes/calendars/default-calendar.php, assets/js/admin.js
The admin settings save the mobile list-view option. Default_Calendar loads the option and applies list properties during responsive rendering. Admin JavaScript controls setting visibility by calendar view and mobile-list selection.
View shell rendering
includes/abstracts/calendar.php, includes/calendars/default-calendar.php
Calendar shell and powered-by rendering use protected helpers. Responsive rendering outputs grid and list view shells together.
Responsive client behavior
assets/js/default-calendar.js, assets/css/default-calendar-grid.css
JavaScript defers hidden view initialization, debounces responsive updates, and refreshes visible grids. CSS switches from grid to list view at 768px.

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
Loading

Possibly related PRs

Suggested reviewers: rosinghal

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: displaying the list view on mobile devices.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-show-list-onmobile

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
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
PHP Fatal error: Uncaught Error: Failed opening required '/vendor/composer/../guzzlehttp/promises/src/functions_include.php' (include_path='.:/usr/share/pear:/usr/share/php') in /vendor/composer/autoload_real.php:39
Stack trace:
#0 /vendor/composer/autoload_real.php(43): {closure}()
#1 /vendor/autoload.php(22): ComposerAutoloaderInit6fb189edc07723b99b3967f72a534f8e::getLoader()
#2 phar:///usr/bin/phpstan/bin/phpstan(49): require_once('...')
#3 phar:///usr/bin/phpstan/bin/phpstan(110): _PHPStan_88a9c7bcc{closure}()
#4 /usr/bin/phpstan(7): require('...')
#5 {main}
thrown in /vendor/composer/autoload_real.php on line 39
Fatal error: Uncaught Error: Failed opening required '/vendor/composer/../guzzlehttp/promises/src/functions_include.php' (include_path='.:/usr/share/pear:/usr/share/php') in /vendor/composer/autoload_real.php:39
Stack trace:
#0 /vendor/composer/autoload_real.php(43): {closure}()
#1 /vendor/autoload.php(22): ComposerAutoloaderInit6fb189edc07723b99b3967f72a534f8e::getLoader()
#2 phar:///usr/bin/phpstan/bin/phpstan(49): require_once('...')
#3 phar:///usr/bin/phpstan/bin/phpstan(110): _PHPStan_88a9c7bcc{closure}()
#4 /usr/bin/phpstan(7): require('...')
#5 {main}
thrown 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 37134fd and 6c3f648.

📒 Files selected for processing (6)
  • assets/css/default-calendar-grid.css
  • assets/js/admin.js
  • assets/js/default-calendar.js
  • includes/abstracts/calendar.php
  • includes/calendars/admin/default-calendar-admin.php
  • includes/calendars/default-calendar.php

Comment on lines +194 to +201
$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();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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}'"))
PY

Repository: 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 '

...Your Content Here...
'; } Technical Context - These hooks are triggered during the calendar rendering process [1][2]. - They are particularly useful because Simple Calendar loads its content dynamically via shortcodes, which can sometimes interfere with standard WordPress functionality like page protection or theme-specific content wrappers [1][2]. - By hooking into these specific actions, you ensure your injected content is placed consistently in relation to the calendar display [1][2].

Citations:


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.

@Akhill2020
Akhill2020 requested a review from rosinghal August 12, 2026 11:31
@rosinghal rosinghal linked an issue Aug 12, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a way to show grid on desktop and list on mobile

1 participant