Skip to content

update modern theme#14

Merged
mambax7 merged 5 commits intoXOOPS:masterfrom
ggoffy:master
Apr 14, 2026
Merged

update modern theme#14
mambax7 merged 5 commits intoXOOPS:masterfrom
ggoffy:master

Conversation

@ggoffy
Copy link
Copy Markdown
Contributor

@ggoffy ggoffy commented Apr 12, 2026

Summary by CodeRabbit

  • New Features

    • Dashboard KPI cards now show active module counts split for users and admins, giving a clearer role-based view.
  • Updates

    • Label text capitalization improved for consistency on dashboard KPI cards.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 12, 2026

Warning

Rate limit exceeded

@mambax7 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 38 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 5 minutes and 38 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d0748f65-d1e5-4a53-bc32-bf77ba1ab888

📥 Commits

Reviewing files that changed from the base of the PR and between 931eb3d and 57cbd59.

📒 Files selected for processing (2)
  • htdocs/modules/system/themes/modern/language/english/main.php
  • htdocs/modules/system/themes/modern/modern.php

Walkthrough

Refactors module statistics to report active module counts segmented by audience (users vs admins) instead of inactive/total, and updates the KPI language string capitalization for "New this month".

Changes

Cohort / File(s) Summary
Language Strings
htdocs/modules/system/themes/modern/language/english/main.php
Capitalized _MODERN_NEW_THIS_MONTH value; removed _MODERN_INACTIVE; added _MODERN_ACTIVE_MODULES_USERS and _MODERN_ACTIVE_MODULES_ADMINS.
Module Statistics Logic
htdocs/modules/system/themes/modern/modern.php
getModuleStats() now computes active_modules_user (active with hasmain=1) and active_modules_admin (remaining active modules), removing previous total_modules/inactive_modules assignments. Minor whitespace formatting change.
Dashboard Template
htdocs/modules/system/themes/modern/xotpl/xo_dashboard.tpl
Top-level render condition changed to $xoops_page == 'admin'; KPI card replaced inactive count with two-line display: $active_modules_user and $active_modules_admin using new language keys.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title 'update modern theme' is overly vague and generic. While technically related to the changeset, it fails to convey the specific, meaningful changes: refactoring KPI metrics for active modules by audience segment. Consider a more descriptive title like 'Refactor dashboard KPI: separate active modules by user vs admin audience' to clearly communicate the primary objective.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 12, 2026

Codecov Report

❌ Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.05%. Comparing base (9c78ad2) to head (ef19868).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
htdocs/modules/system/themes/modern/modern.php 0.00% 4 Missing ⚠️
...les/system/themes/modern/language/english/main.php 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #14      +/-   ##
============================================
- Coverage     19.23%   18.05%   -1.19%     
- Complexity     7584     7760     +176     
============================================
  Files           621      665      +44     
  Lines         40085    42709    +2624     
============================================
  Hits           7709     7709              
- Misses        32376    35000    +2624     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@htdocs/modules/system/themes/modern/modern.php`:
- Around line 247-257: The code computes active_modules_admin by subtracting
active_modules_user from active_modules, which is incorrect because hasmain and
hasadmin are independent; instead build a new CriteriaCompo (like the existing
$criteria) or clone/reset it, add Criteria('isactive', 1) and
Criteria('hasadmin', 1) and call $module_handler->getCount(...) to get the
correct active_modules_admin value, then assign that result to
$tpl->assign('active_modules_admin', ...); ensure you reference the same
module_handler, CriteriaCompo and Criteria symbols when locating the fix.
🪄 Autofix (Beta)

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f8292ff1-be42-4aab-9a0e-bd3ba95815f6

📥 Commits

Reviewing files that changed from the base of the PR and between 27c1f77 and b8fe355.

📒 Files selected for processing (3)
  • htdocs/modules/system/themes/modern/language/english/main.php
  • htdocs/modules/system/themes/modern/modern.php
  • htdocs/modules/system/themes/modern/xotpl/xo_dashboard.tpl

@ggoffy ggoffy changed the title updated KPI for active modules updated modern theme Apr 12, 2026
@ggoffy ggoffy changed the title updated modern theme update modern theme Apr 12, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Modern admin theme dashboard KPIs to provide a clearer breakdown of active modules by role, along with minor label text consistency improvements.

Changes:

  • Restricts dashboard rendering to the admin homepage using $xoops_page.
  • Splits “Active Modules” KPI details into user-side vs admin-side counts.
  • Updates/enhances English language strings for the dashboard KPI labels.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
htdocs/modules/system/themes/modern/xotpl/xo_dashboard.tpl Updates dashboard visibility condition and displays split active-module KPI details.
htdocs/modules/system/themes/modern/modern.php Adjusts module statistics assigned to the dashboard template (user/admin split).
htdocs/modules/system/themes/modern/language/english/main.php Updates capitalization and adds new language constants for the split KPI labels.

Comment on lines 247 to +257
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('hasmain', 1));
// active modules
$criteria->add(new Criteria('isactive', 1));

$active_modules = $module_handler->getCount($criteria);

$criteria_all = new Criteria('dirname', '', '!=');
$total_modules = $module_handler->getCount($criteria_all);
// active modules for user side
$criteria->add(new Criteria('hasmain', 1));
$active_modules_user = $module_handler->getCount($criteria);

$tpl->assign('active_modules', $active_modules);
$tpl->assign('total_modules', $total_modules);
$tpl->assign('inactive_modules', $total_modules - $active_modules);
$tpl->assign('active_modules_user', $active_modules_user);
$tpl->assign('active_modules_admin', $active_modules - $active_modules_user);
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

active_modules_admin is currently derived as active_modules - active_modules_user (i.e., active modules without hasmain). That doesn't actually represent “modules for admins”: modules that have both user side (hasmain=1) and an admin side (hasadmin=1) are excluded from the admin count, and modules with neither hasmain nor hasadmin would be included. Consider either (a) counting admin modules with an explicit hasadmin=1 criteria (separate CriteriaCompo) or (b) renaming the label/variable to reflect that it's counting “admin-only / no-user-side” modules and also filtering hasadmin=1 to avoid counting modules with no admin UI.

Copilot uses AI. Check for mistakes.
@mambax7
Copy link
Copy Markdown
Contributor

mambax7 commented Apr 13, 2026

The counting logic is correct — the subtraction works because every active module has at least hasmain=1 or hasadmin=1 (both zero is impossible), so active - active_with_hasmain gives admin-only modules without an extra query. No logic change needed.

The only suggestion is on label clarity. "Active Modules For Admins" reads like "all modules with an admin panel" (which is almost every module), not "modules that only appear in admin" (which is the actual metric).

Suggested label update in language/english/main.php:

define('_MODERN_ACTIVE_MODULES_USERS', 'User-Facing Modules');
define('_MODERN_ACTIVE_MODULES_ADMINS', 'Admin-Only Modules');

And a short comment in modern.php above the subtraction so this doesn't get re-flagged by bots in future PRs:

// Modules without a frontend entry (hasmain=0) are admin-only by XOOPS design.
// Every active module has at least hasmain=1 or hasadmin=1, so this subtraction
// equals querying isactive=1 AND hasmain=0 without an extra DB round-trip.
$tpl->assign('active_modules_admin', $active_modules - $active_modules_user);

That way the dashboard reads:

  • Active Modules: 12
    • User-Facing Modules: 9
    • Admin-Only Modules: 3

@mambax7 mambax7 self-requested a review April 14, 2026 01:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment on lines +257 to +260
// Modules without a frontend entry (hasmain=0) are admin-only by XOOPS design.
// Every active module has at least hasmain=1 or hasadmin=1, so this subtraction
// equals querying isactive=1 AND hasmain=0 without an extra DB round-trip.
$tpl->assign('active_modules_admin', $active_modules - $active_modules_user);
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

The KPI label says "Admin-Only Modules", but the value is computed as active_modules - active_modules_user, which is effectively “active modules without hasmain=1” (i.e., not user-facing) and does not check hasadmin=1. To avoid misleading counts, either (a) change the label to reflect “modules without frontend entry”, or (b) compute admin-only as isactive=1 AND hasadmin=1 AND hasmain=0 (using a separate criteria/count).

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mambax7 mambax7 merged commit 69422cc into XOOPS:master Apr 14, 2026
7 of 8 checks passed
@mambax7
Copy link
Copy Markdown
Contributor

mambax7 commented Apr 14, 2026

Thank you @ggoffy !

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.

3 participants