Skip to content

Add "NEW" to payment field#2075

Merged
Crabcyborg merged 2 commits into
masterfrom
add_new_to_payment_field
Oct 28, 2024
Merged

Add "NEW" to payment field#2075
Crabcyborg merged 2 commits into
masterfrom
add_new_to_payment_field

Conversation

@Crabcyborg
Copy link
Copy Markdown
Contributor

We have this "NEW" text in our payments submenu.

Screen Shot 2024-10-25 at 1 58 25 PM

But I was think we might draw more attention to payments as well if we put a "NEW" flag directly beside the Payment field as well.
Screen Shot 2024-10-25 at 1 59 19 PM

I put this behind a check so it doesn't appear if you have a payments table already installed. This would apply to anyone using the PayPal add-on, Authorize.Net, or anyone who has used Stripe already.

@Crabcyborg
Copy link
Copy Markdown
Contributor Author

@srwells What do you think about this update? We were talking the other day about ways to help convert more people to Stripe. We have the "NEW" item in the sub-menu, but what do you think about showing it here in the field as well?

Thank you!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 25, 2024

Walkthrough

The pull request introduces changes to two files: add_field_links.php and frm_admin.css. In add_field_links.php, a conditional check is added to modify the rendering logic for the credit card field based on the existence of a payments table. In frm_admin.css, extensive modifications include the addition of new CSS variables, styling adjustments, and enhancements for responsiveness and usability across various components.

Changes

File Change Summary
classes/views/frm-forms/add_field_links.php Added a conditional block in the loop to check if $field_key is 'credit_card' and if FrmTransLiteAppHelper::payments_table_exists() returns false, triggering FrmAppHelper::show_pill_text().
css/frm_admin.css Extensive modifications including new CSS variable definitions, styling adjustments for buttons, dropdowns, and modals, improvements for form elements, and added media queries for better responsiveness across devices.

Possibly related PRs

  • Show new pill beside payments menu item #1853: This PR modifies the FrmTransLitePaymentsController to include a call to FrmAppHelper::show_pill_text(), which is directly related to the new conditional logic added in the main PR for displaying a message when the payments table does not exist.
  • Make tooltip icon color used in shortcode inputs consistent #2041: This PR includes updates to css/frm_admin.css, which is also modified in the main PR. While the changes are primarily focused on CSS variables and styles, they may impact the overall styling of the elements affected by the logic in the main PR.

Suggested labels

action: needs qa


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3a0cf15 and 4954b82.

📒 Files selected for processing (1)
  • classes/views/frm-forms/add_field_links.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • classes/views/frm-forms/add_field_links.php

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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 resolve resolve all the CodeRabbit review comments.
  • @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.

Copy link
Copy Markdown
Contributor

@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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 47c2dca and 3a0cf15.

📒 Files selected for processing (2)
  • classes/views/frm-forms/add_field_links.php (1 hunks)
  • css/frm_admin.css (1 hunks)
🔇 Additional comments (1)
classes/views/frm-forms/add_field_links.php (1)

45-49: LGTM! Verify helper methods availability.

The implementation aligns well with the PR objectives, adding the "NEW" label conditionally for the credit card field. The code is clean and follows the existing patterns.

Let's verify the availability of the required helper methods:

✅ Verification successful

Both helper methods exist and are properly used

The verification confirms:

  • FrmTransLiteAppHelper::payments_table_exists() is defined in stripe/helpers/FrmTransLiteAppHelper.php and used across multiple files
  • FrmAppHelper::show_pill_text() is defined in classes/helpers/FrmAppHelper.php and used in several places including other pill text displays

The implementation follows existing patterns in the codebase for displaying pill text labels and checking payment table existence.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of required helper methods

# Test 1: Check for FrmTransLiteAppHelper::payments_table_exists()
ast-grep --pattern 'class FrmTransLiteAppHelper {
  $$$
  payments_table_exists($$$) {
    $$$
  }
  $$$
}'

# Test 2: Check for FrmAppHelper::show_pill_text()
ast-grep --pattern 'class FrmAppHelper {
  $$$
  show_pill_text($$$) {
    $$$
  }
  $$$
}'

Length of output: 203


Script:

#!/bin/bash
# Let's try a different approach using ripgrep to find these methods

# Search for FrmTransLiteAppHelper class and payments_table_exists method
echo "=== Searching for FrmTransLiteAppHelper::payments_table_exists ==="
rg -A 5 "class FrmTransLiteAppHelper"
rg "payments_table_exists"

echo -e "\n=== Searching for FrmAppHelper::show_pill_text ==="
rg -A 5 "class FrmAppHelper"
rg "show_pill_text"

Length of output: 2115

Comment thread css/frm_admin.css
@Crabcyborg Crabcyborg added this to the 6.16.1 milestone Oct 25, 2024
@srwells
Copy link
Copy Markdown
Contributor

srwells commented Oct 25, 2024

I like it! Yeah, the more we can draw attention to the payment tools, the better.

@Crabcyborg
Copy link
Copy Markdown
Contributor Author

Thanks Steve!

I'll go ahead and merge this then.

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants