wedocs-plugin icon indicating copy to clipboard operation
wedocs-plugin copied to clipboard

Add Promotional Banner to weDocs Dashboard

Open haideralibd opened this issue 7 months ago • 2 comments
trafficstars

Summary by CodeRabbit

  • New Features

    • Introduced a unified promotional notice experience across the application, displaying dynamic offers in admin and public pages.
    • Added mechanisms for retrieving and dismissing promotional notices, including interactive, dismissible UI elements.
    • Enhanced overall functionality with new endpoints and components to improve the visibility and management of promotional content.
    • New API routes for managing promotional notices.
    • Added a new component for displaying promotional notices in various sections of the application.
    • Introduced a new function for converting UTC time to Eastern Standard Time (EST).
  • Bug Fixes

    • Improved error handling for promotional notice retrieval and dismissal.
  • Chores

    • Added constants for promotional notice management.

haideralibd avatar Apr 10 '25 09:04 haideralibd

Walkthrough

This pull request extends the promotional notice functionality across the system. It adds new REST API routes and methods in the API class for retrieving and hiding promotional notices. In the admin area, a new Promotion class is introduced—with conditional instantiation—to display and dismiss notices via AJAX. Additionally, admin scripts are localized and a helper function for converting UTC to EST is added. On the frontend, a new React component (WedocsPromoNotice) is integrated into multiple pages. Finally, corresponding actions, controls, reducers, resolvers, selectors, and constants are added to support and manage promotional notices.

Changes

File(s) Change Summary
includes/API/API.php Added new REST API routes (/promotion-notice, /hide-promotion-notice) and methods (get_promotional_notice, get_promotional_notice_check, handle_hide_promotion_notice) to manage promotional notices.
includes/Admin/Admin.php, includes/Admin/Promotion.php Introduced a conditional check to instantiate a new Promotion class. The new class in the Admin namespace handles promotional offer display, dismissal via AJAX, and renders the notice with HTML, CSS, and JS.
includes/Assets.php, includes/functions.php Localized the wedocs-admin-script with AJAX URL and nonce; added wedocs_convert_utc_to_est() to convert UTC time to EST.
src/components/DocListing/index.js, src/components/Documentations/index.js, src/components/Migrations/index.js, src/components/Settings/index.js, src/components/WedocsPromoNotice.js Integrated a new WedocsPromoNotice React component to render promotional notices across various pages.
src/data/docs/actions.js, src/data/settings/actions.js, src/data/settings/controls.js, src/data/settings/reducer.js, src/data/settings/resolvers.js, src/data/settings/selectors.js Added new actions, controls, reducer cases, resolvers, and selectors for fetching and dismissing promotional notices via API.
wedocs.php Defined new constants: WEDOCS_PROMO_KEY, WEDOCS_PROMO_URL, and WEDOCS_LOGO_URL for promotional notice configuration.

Poem

I'm a hopping rabbit in a code-filled glen,
New routes and promos cheer me again.
Admin and API join my joyful jam,
With React and actions—oh, what a slam!
Constants and converts guide my lyrical trot,
Each dismissal and notice in a playful plot.
I celebrate with a twitch and a hop—let's give it a shot!

[!TIP]

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d921e1cbf4784750e5f5833aa788e393eef09a6f and f1fbc6964347754a1f26945e6533672cfe671cd4.

📒 Files selected for processing (1)
  • wedocs.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • wedocs.php

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Apr 10 '25 09:04 coderabbitai[bot]

Could not get any promotional banner on wedocs dashboard

Rubaiyat-E-Mohammad avatar Apr 15 '25 04:04 Rubaiyat-E-Mohammad