wedocs-plugin
wedocs-plugin copied to clipboard
Feat/helpful feedback block
Fixes 199
Summary by CodeRabbit
-
New Features
- Introduced Helpful Feedback block: A voting widget allowing users to rate documentation helpfulness. Includes Yes/No buttons, multiple layout options, customizable styling, vote tracking, thank-you messages, and anonymous voting support.
-
Style
- Updated responsive styling for artboard layouts.
Walkthrough
This PR introduces a comprehensive "Helpful Feedback" block feature to WeDocs, enabling post-level voting with yes/no buttons. The implementation includes Gutenberg block definitions, server-side rendering with vote tracking, AJAX vote submission handler, frontend JavaScript module, comprehensive styling, and plugin integration with multiple layout variants and customization options.
Changes
| Cohort / File(s) | Change Summary |
|---|---|
Helpful Feedback Block Source Code src/blocks/HelpfulFeedback/block.json, src/blocks/HelpfulFeedback/edit.js, src/blocks/HelpfulFeedback/index.js, src/blocks/HelpfulFeedback/render.php, src/blocks/HelpfulFeedback/save.js, src/blocks/HelpfulFeedback/style.scss |
New Gutenberg block implementation with block metadata, React editor component with comprehensive InspectorControls, block registration, server-side rendering function, null save component, and complete SCSS styling with layout variants and responsive behavior. |
Helpful Feedback Block Built Assets assets/build/blocks/HelpfulFeedback/block.json, assets/build/blocks/HelpfulFeedback/render.php, assets/build/style-block.css |
Compiled/built versions of the Helpful Feedback block assets matching source definitions. |
Asset Version Updates assets/build/block.asset.php, assets/build/block.js |
Block asset version bump (5c13835 β b0c9947) and internal JSX runtime refactoring with variable renaming and module restructuring. |
Stylesheet Enhancements assets/build/index.css |
Minor CSS selector formatting fix and addition of six new responsive artboard size rules for phone device variants (phone-1 through phone-6 horizontal orientations). |
Frontend Vote Submission Logic assets/js/helpful-feedback.js, src/blocks/HelpfulFeedback/view.js |
New JavaScript modules implementing AJAX-driven voting UI with duplicate prevention, error handling, vote count updates, thank-you message display, and custom event emission. |
Backend Vote Handler includes/Ajax.php |
New AJAX action handler for vote submission with nonce verification, vote validation, duplicate prevention via cookies/user meta/IP tracking, and vote recording. |
Plugin Integration wedocs.php, src/blocks/index.js |
Block registration in main plugin file and HelpfulFeedback import in block index. |
Estimated code review effort
π― 4 (Complex) | β±οΈ ~45 minutes
- includes/Ajax.php β Requires security review of nonce verification, vote tracking logic across cookies/user meta/IP, and prevention of duplicate votes
- src/blocks/HelpfulFeedback/render.php β Server-side state management, vote retrieval, conditional rendering paths, and data attribute handling need careful verification
- assets/js/helpful-feedback.js & src/blocks/HelpfulFeedback/view.js β Frontend AJAX integration, error handling, DOM manipulation, and custom event logic require validation
- src/blocks/HelpfulFeedback/edit.js β Complex React component with numerous Inspector controls and dependent style objects
Suggested labels
Needs Review
Poem
π° β¨ Helpful votes now hoppy-hop along, Yes and no in CSS so strong, Tracking hearts that find the block sublime, With nonces safe and votes in time! π
Pre-merge checks and finishing touches
β Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | β οΈ Warning | Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
β Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title Check | β Passed | The pull request title "Feat/helpful feedback block" accurately describes the primary objective of the changeset. The PR introduces a comprehensive new Gutenberg block called the Helpful Feedback block, which includes block metadata, React editor components, server-side rendering, frontend JavaScript with AJAX voting functionality, styling, and backend AJAX handlers. All the major file changes are directly related to implementing this single feature. The title is concise, clear, and specific enough that a teammate scanning the commit history would immediately understand the PR adds a new helpful feedback block feature to the plugin. |
β¨ Finishing touches
- [ ] π Generate docstrings
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
feat/helpful-feedback-block
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 @coderabbitai help to get the list of available commands and usage tips.