Skip to content

Conversation

@mrabbani
Copy link
Member

@mrabbani mrabbani commented Aug 2, 2025

Enhanced Plugin Composer Settings UI and Build System

  • Modern React-based settings interface with tabbed navigation
  • Card-based layout with organized content
  • Confirmation modal for reset functionality
  • Fixed input clearing issues
  • Enhanced CSS styling with responsive design
  • Modern webpack build system
  • Comprehensive .gitignore for build artifacts

Ready for review!

mrabbani added 27 commits July 3, 2024 09:28
- Added modern React-based settings interface with tabbed navigation
- Implemented card headers with titles and reset button positioning
- Added confirmation modal for reset functionality to prevent accidental resets
- Fixed input clearing issues by using nullish coalescing operator
- Enhanced CSS styling with full-width layout and improved button styling
- Removed button-like styling from active tabs and badges
- Added comprehensive .gitignore for build artifacts
- Updated webpack configuration to include CSS in build process
- Added proper asset management and dependency injection
- Improved user experience with loading states and error handling
- Added languages directory with POT file generation
- Updated build script to generate localization files using WP-CLI
- Created plugin-composer.pot with 488 lines of translatable strings
- Added sample Spanish PO file (plugin-composer-es_ES.po)
- Build process now includes languages directory in final package
- All user-facing strings are now translatable
- Added load_textdomain() method to load plugin translations
- Added PLUGIN_COMPOSER_LANG_DIR constant for languages directory
- Hooked translation loading to 'init' action with priority 0
- Ensures translations are loaded early in WordPress lifecycle
- Uses 'welabs-plugin-composer' text domain
- Translations will be loaded from /languages directory
- Fix text domain consistency across all files (plugin-composer → welabs-plugin-composer)
- Fix translation loading timing by hooking to init action
- Add new translatable strings (welcome message, login message)
- Update Spanish translations with comprehensive coverage
- Regenerate MO file for proper translation loading
- Ensure translations work in both admin and frontend contexts

Files modified:
- plugin-composer.php: Fixed text domain declaration
- includes/PluginComposer.php: Fixed translation loading mechanism
- includes/Admin/Settings.php: Added welcome message translation
- includes/ShortCode.php: Fixed text domain consistency
- languages/plugin-composer.pot: Added new translatable strings
- languages/plugin-composer-es_ES.po: Added Spanish translations
- languages/plugin-composer-es_ES.mo: Regenerated binary translation file

Testing confirmed: Translations work properly in admin settings and frontend shortcode.
- Fix Rate Limit Attempts number input not displaying after save
- Fix selected tab not being preserved after page reload
- Add comprehensive REST API schema and validation
- Improve number input handling with proper parsing
- Add localStorage persistence for active tab
- Add debug logging for troubleshooting
- Reload settings after successful save to ensure UI consistency
- Add proper validation and sanitization callbacks
- Enhance error handling and user feedback

Files modified:
- src/admin/settings.js: Fixed UI issues and added tab persistence
- includes/Api/Admin/SettingsController.php: Added complete schema and validation
- assets/admin/settings.js: Built version with fixes
- assets/admin/settings.asset.php: Updated asset manifest
- Fix RangeControl max value mismatch (50 -> 100) to match backend validation
- Add comprehensive debug logging to track data flow
- Temporarily disable REST API args validation to isolate the issue
- Add frontend debugging to log rate_limit_attempts value and type
- Ensure proper integer parsing and validation

The issue was caused by a mismatch between frontend RangeControl max (50)
and backend validation max (100), causing validation failures.
- Re-enable REST API args validation now that range mismatch is fixed
- RangeControl max value now matches backend validation (100)
- Added comprehensive debug logging for troubleshooting
- Frontend and backend validation ranges are now aligned
- Add permission check debugging to track authentication issues
- Add detailed logging for GET settings to see what's being returned
- Add comprehensive logging for all settings processing in update
- Track missing settings in request parameters
- Enhanced frontend debugging to log settings keys and values

This will help identify whether the issue is:
1. Authentication/permission problems
2. Settings not being saved properly
3. Settings not being loaded properly
4. Frontend-backend data format mismatches
- Remove parseInt() from onChange handlers to allow proper value updates
- Fix value display to use raw settings values instead of forced parsing
- Allow users to type freely in numeric inputs without forced reversion
- Fix all numeric inputs: rate_limit_attempts, rate_limit_duration,
  max_plugin_name_length, max_description_length, max_license_length,
  max_author_name_length, file_permissions, file_cleanup_delay

The issue was that parseInt() in onChange was reverting invalid values
to defaults, preventing users from entering new values properly.
- Add width: 100% wrapper div to all form controls
- Ensure SelectControl, ToggleControl, and TextControl have consistent width
- Apply consistent styling to Required Capability, Default Plugin Type,
  Allow Guest Access, Allowed File Extensions, and all ToggleControl fields
- All input fields now have the same width as the Required Capability field
- Replace 100% width with max-width: 400px for better visual balance
- Apply consistent max-width to all text inputs, select controls, and range controls
- Use CSS classes instead of inline styles for better maintainability
- Form fields now have a reasonable width that looks professional
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.

2 participants