Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decentralized Verification: Moving from verified to vouches #4729

Merged
merged 4 commits into from
Sep 17, 2024

Conversation

mateodaza
Copy link
Member

@mateodaza mateodaza commented Sep 12, 2024

Summary by CodeRabbit

  • New Features

    • Introduced new labels for project verification and GIVback eligibility across multiple languages, enhancing clarity.
    • Added descriptions to improve user understanding of project statuses and GIVback eligibility.
    • Updated titles and notifications to reinforce messaging around GIVpower and project visibility.
  • Bug Fixes

    • Improved clarity in existing labels related to project verification and GIVback eligibility.
  • Style

    • Enhanced user interface with updated text for better communication of project statuses.

Copy link

vercel bot commented Sep 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
giveth-dapps-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 17, 2024 5:28pm

Copy link
Contributor

coderabbitai bot commented Sep 12, 2024

Walkthrough

The pull request introduces enhancements to the localization of a software application, focusing on project verification and GIVbacks eligibility. It adds new labels and modifies existing ones across multiple language files, aiming to clarify project statuses and improve user experience related to donations and project visibility.

Changes

File Change Summary
lang/ca.json, lang/en.json, lang/es.json Added new labels for "vouched" and "GIVbacks Eligible," and updated descriptions for project eligibility.

Possibly related PRs

  • Main #4340: The changes in lang/en.json and lang/es.json involve updates to labels and descriptions related to project verification and GIVbacks, which aligns with the modifications made in the main PR for the same files.

Poem

🐰 In the meadow of GIV we play,
New labels bloom, brightening the day!
Vouched and eligible, clear as can be,
With each donation, joy flows free.
Hop along, dear friends, and cheer,
For GIVbacks are here, spreading good cheer! 🌼


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 050ca02 and 395de5d.

Files selected for processing (3)
  • lang/ca.json (4 hunks)
  • lang/en.json (3 hunks)
  • lang/es.json (3 hunks)
Files skipped from review due to trivial changes (1)
  • lang/ca.json
Files skipped from review as they are similar to previous changes (2)
  • lang/en.json
  • lang/es.json

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 generate interesting stats about this repository and render them as a table.
    -- @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
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: 2

Outside diff range and nitpick comments (3)
src/components/badges/GivBackBadge.tsx (1)

1-36: Excellent work on the GivBackBadge component!

The component is well-structured, uses styled-components for styling, and follows internationalization best practices. Great job!

Just a couple of suggestions to further improve the component:

  1. Accessibility: Consider using a more semantically meaningful HTML element for the wrapper (e.g., <span> or <div role="status">), or add appropriate ARIA attributes to improve accessibility for screen readers.

  2. Prop Types: Consider adding prop types to the component to catch potential bugs and improve code maintainability. You can use the PropTypes package from the prop-types library to define the expected types of the component's props.

Other than that, the component looks great! Let me know if you have any questions or need further assistance.

src/components/project-card/ProjectCard.tsx (1)

65-65: Nitpick: Remove the empty line.

The empty line is unnecessary and can be removed to keep the code clean.

Apply this diff to remove the empty line:

-
lang/en.json (1)

1114-1114: Consider using snake case for consistency.

The addition of the "label.isGivbackEligible" label looks good and matches the summary of changes. However, the label name uses camel case, which is inconsistent with the snake case convention used for other labels in this file.

I recommend updating the label name to use snake case:

"label.is_givback_eligible"
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9020bb9 and c263d97.

Files selected for processing (16)
  • lang/ca.json (4 hunks)
  • lang/en.json (3 hunks)
  • lang/es.json (3 hunks)
  • src/apollo/gql/gqlProjects.ts (4 hunks)
  • src/apollo/types/types.ts (1 hunks)
  • src/components/DonateSocialBox.tsx (1 hunks)
  • src/components/badges/GivBackBadge.tsx (1 hunks)
  • src/components/badges/VerifiedBadge.tsx (1 hunks)
  • src/components/menu/FilterMenu.tsx (1 hunks)
  • src/components/project-card/ProjectCard.tsx (5 hunks)
  • src/components/views/donate/DonateIndex.tsx (1 hunks)
  • src/components/views/donate/DonatePageProjectDescription.tsx (2 hunks)
  • src/components/views/donate/OnTime/OneTimeDonationCard.tsx (2 hunks)
  • src/components/views/donate/Recurring/RecurringDonationCard.tsx (1 hunks)
  • src/components/views/project/ProjectBadges.tsx (3 hunks)
  • src/components/views/project/ProjectGIVbackToast.tsx (5 hunks)
Files skipped from review due to trivial changes (1)
  • src/components/DonateSocialBox.tsx
Additional comments not posted (31)
src/components/badges/VerifiedBadge.tsx (1)

15-15: Verify the impact of the terminology change.

The change from "verified" to "vouched" is straightforward and does not affect the functionality of the component. However, it's important to consider the following:

  1. Ensure that this change in terminology aligns with the overall design and messaging of the application.
  2. Verify that the new term "vouched" accurately reflects the intended meaning and functionality of the badge.
  3. Review this change with the product team to confirm that it supports the desired user experience and perception.
src/components/views/project/ProjectBadges.tsx (4)

8-8: LGTM!

The import statement for IconGIVBack16 is correct and necessary for the new badge.


19-20: LGTM!

The destructuring assignment for isGivbackEligible is correct and matches the alteration mentioned in the summary.


39-48: LGTM! Verify the localization key exists.

The new badge for projects that are eligible for Givback is correctly implemented:

  • The conditional rendering logic based on the isGivbackEligible property is correct.
  • The badge text and icon are correctly set.
  • The badge styling is correct.

Run the following script to verify if the localization key exists:

Verification successful

Localization Key Verified

The localization key label.isGivbackEligible exists in the localization files:

  • Found in ./lang/ca.json
  • Found in ./lang/es.json
  • Found in ./lang/en.json
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if the localization key `label.isGivbackEligible` exists in the localization files.

# Test: Search for the localization key in the localization files. Expect: At least one occurrence.
fd --extension json --exec rg --iglob '!node_modules' --json $'"label.isGivbackEligible"'

Length of output: 332678


33-33: Verify the localization key exists.

The change in the localization key from label.verified to label.vouched is correct and reflects a semantic shift in the badge's meaning as mentioned in the summary.

Run the following script to verify if the localization key exists:

Verification successful

Localization key label.vouched exists and is correctly implemented.

The localization key label.vouched is present in the localization files, confirming that it is correctly defined and available for use. This aligns with the change in the code snippet. No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if the localization key `label.vouched` exists in the localization files.

# Test: Search for the localization key in the localization files. Expect: At least one occurrence.
fd --extension json --exec rg --iglob '!node_modules' --json $'"label.vouched"'

Length of output: 332574

src/components/views/donate/DonatePageProjectDescription.tsx (1)

52-56: LGTM!

The conditional rendering of the GivBackBadge component based on the isGivbackEligible property is implemented correctly. Wrapping the badge inside a Flex container ensures proper layout and alignment. This change aligns with the PR objective of moving from verified to vouches by adding a visual indicator for GivBack eligibility, thereby improving the user experience by providing relevant information to donors.

src/components/views/project/ProjectGIVbackToast.tsx (5)

44-51: LGTM!

The new variables are clear, descriptive, and correctly derived from the projectData object and the isAdmin flag. They are used to determine the display logic for the toast notification.


Line range hint 90-231: LGTM!

The code segment is correctly using the new variables introduced earlier to determine the display logic for the toast notification. It is using the formatMessage function from the react-intl library to localize the text, and the OutlineButton and ExternalLink components from the @giveth/ui-design-system library to render the button and external links. The code segment is correctly handling the different project statuses and verification statuses.


217-231: LGTM!

The code segment is correctly using the new isPublicVerifiedNotEligible variable to determine the display logic for the case where a project is verified but not eligible for Givback. It is using the formatMessage function from the react-intl library to localize the text, and the OutlineButton component from the @giveth/ui-design-system library to render the button.


Line range hint 280-290: LGTM!

The code segment is correctly using the isOwnerGivbackEligible variable to determine whether to render the note for the case where the project owner is eligible for Givback. It is using the formatMessage function from the react-intl library to localize the text.


Line range hint 293-302: LGTM!

The code segment is correctly using the link variable to determine the URL of the external link to learn more about the Givback program. It is using the ExternalLink component to render the link, and the formatMessage function from the react-intl library to localize the text.

src/components/views/donate/DonateIndex.tsx (1)

125-125: LGTM!

The change from project.verified to project.isGivbackEligible for determining Givback eligibility is more precise and aligns with the intended logic. This change potentially affects which projects are considered eligible for Givback based on their specific Givback status rather than just their verification status.

src/apollo/types/types.ts (1)

51-51: LGTM!

The addition of the isGivbackEligible optional property to the IProject interface is a valid change that aligns with the PR objective. The property name follows the naming convention, the type is appropriate, and marking it as optional is suitable since not all projects may have this property.

src/apollo/gql/gqlProjects.ts (4)

11-11: LGTM!

The addition of the isGivbackEligible field to the PROJECT_CORE_FIELDS fragment is consistent with the alterations mentioned in the summary. The Boolean type is appropriate for representing eligibility.


146-146: LGTM!

The addition of the isGivbackEligible field to the FETCH_PROJECT_BY_SLUG_DONATION query is consistent with the alterations mentioned in the summary. Its inclusion in the donation-related query suggests that the Givback eligibility status is relevant for donation functionalities.


216-216: LGTM!

The addition of the isGivbackEligible field to the FETCH_PROJECT_BY_SLUG_SINGLE_PROJECT query is consistent with the alterations mentioned in the summary. Its inclusion in the single project query suggests that the Givback eligibility status is relevant for displaying individual project details.


601-601: LGTM!

The addition of the isGivbackEligible field to the ADD_RECIPIENT_ADDRESS_TO_PROJECT mutation response is consistent with the alterations mentioned in the summary. Its inclusion in the mutation response suggests that the Givback eligibility status is relevant when adding a recipient address to a project.

src/components/project-card/ProjectCard.tsx (3)

17-17: LGTM!

The import for IconGIVBack16 is correctly added.


77-78: LGTM!

The isGivbackEligible property is correctly added to the ProjectCard component's props and is used to conditionally render a visual indicator for projects that are eligible for GIVbacks.


344-361: LGTM!

The code changes to conditionally render the GIVbacks eligibility indicator and update the verified status label are correctly implemented. The changes enhance the functionality of the ProjectCard component by providing users with clearer information regarding GIVbacks eligibility and the verified status.

Also applies to: 440-443

src/components/views/donate/OnTime/OneTimeDonationCard.tsx (1)

142-142: LGTM!

The change in the assignment of projectIsGivBackEligible is consistent with the renaming of verified to isGivbackEligible. Looks good!

src/components/views/donate/Recurring/RecurringDonationCard.tsx (1)

170-170: LGTM!

The change to use the isGivbackEligible property instead of the verified property for determining the project's eligibility for the "Giv Back" program looks good. It makes sense to use a more specific property that is directly related to the "Giv Back" program eligibility.

lang/en.json (2)

1113-1113: LGTM!

The addition of the "label.vouched" label looks good and matches the summary of changes.


1638-1638: LGTM!

The addition of the "project.givback_toast.description.verified_public_not_eligible" label looks good and matches the summary of changes.

lang/es.json (4)

1110-1110: LGTM!

The new label "label.vouched": "Avalado" looks good.


1111-1111: Looks good!

The new label "label.isGivbackEligible": "Elegible para GIVbacks" and its Spanish translation are appropriate.


1633-1633: Looks good to me!

The new label "project.givback_toast.description.verified_public_not_eligible" and its Spanish description translation are appropriate.


1642-1642: LGTM!

The new label "project.givback_toast.title.verified_public_not_eligible": "Boostea este proyecto con GIVpower!" looks good.

lang/ca.json (3)

1111-1112: Labels for verification status look good.

The new labels "label.vouched" and "label.isGivbackEligible" have been added with appropriate translations. They align with the mentioned updates in the summary.


Line range hint 1632-1646: New toast messages for GIVbacks look great!

The added toast messages provide valuable information to project owners and the public regarding the project's verification status, GIVbacks eligibility, and boosting. The messages are clear, informative, and align with the updates mentioned in the summary.


1307-1307: Validation for project owner donations is a good addition.

The new label "label.project_owner_cant_donate_to_own_project" provides a clear message to project owners that they cannot donate to their own projects. This validation helps prevent potential abuse of the system.

@@ -23,7 +23,7 @@ interface IFilterMenuProps {

const projectsFeatures = [
{
label: { id: 'label.verified' },
label: { id: 'label.vouched' },
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Inconsistent terminology change from "verified" to "vouched".

The terminology change from "verified" to "vouched" has not been consistently applied across the codebase. There are still numerous instances of "verified" in both TypeScript/JavaScript files and localization files. Please review the codebase to ensure that the terminology change is consistently applied to maintain a cohesive user experience.

  • TypeScript/JavaScript files: Multiple occurrences of "verified" remain.
  • Localization files: Numerous instances of "verified" are still present.
Analysis chain

Verify the consistency of the terminology change.

The change from "verified" to "vouched" aligns with the PR objective. However, please ensure that this terminology change is consistently applied across the codebase and user interface to maintain a cohesive user experience.

Run the following script to verify the consistency of the terminology change:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the terminology change from "verified" to "vouched".

# Test 1: Search for the "verified" term usage in TypeScript/JavaScript files.
# Expect: Only occurrences related to the `EProjectsFilter.VERIFIED` enum value.
rg --type-add 'ts:*.ts,*.tsx' --type ts verified

# Test 2: Search for the "vouched" term usage in TypeScript/JavaScript files.
# Expect: Only occurrences related to the UI labels.
rg --type-add 'ts:*.ts,*.tsx' --type ts vouched

# Test 3: Search for the "verified" term usage in the localization files.
# Expect: No occurrences.
rg --type-add 'i18n:*.json' --type i18n verified

# Test 4: Search for the "vouched" term usage in the localization files.
# Expect: Only occurrences related to the UI labels.
rg --type-add 'i18n:*.json' --type i18n vouched

Length of output: 47611

@@ -80,7 +80,7 @@ const CryptoDonation: FC<{
const dispatch = useAppDispatch();

const {
verified,
isGivbackEligible,
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Inconsistent renaming of verified to isGivbackEligible.

The renaming of verified to isGivbackEligible has not been consistently applied throughout the codebase. The term verified is still present in many files, which could lead to confusion or errors. Please review and update all relevant instances to ensure consistency.

  • Files with remaining occurrences of verified:
    • src/content/metatags.ts
    • src/content/FAQ.tsx
    • src/lib/constants/shareContent.ts
    • src/apollo/gql/gqlPowerBoosting.ts
    • src/components/project-card/ProjectCard.tsx
    • src/components/views/userProfile/projectsTab/ProjectActions.tsx
    • src/components/views/userProfile/projectsTab/ProjectItem.tsx
    • src/components/views/verification/SocialProfile.tsx
    • src/components/views/verification/VerificationStatusReport.tsx
    • src/components/views/verification/menu/MobileMenu.tsx
    • src/components/views/verification/EmailVerificationIndex.tsx
    • src/components/views/verification/menu/DesktopMenu.tsx
    • src/components/views/verification/Done.tsx
    • src/components/views/userProfile/ProfileOverviewTab.tsx
    • src/components/views/userProfile/boostedTab/BoostsTable.tsx
    • src/components/views/claim/cards/Donate.tsx
    • src/components/views/claim/cards/Connect.tsx
    • src/components/views/project/ProjectTabs.tsx
    • src/components/views/project/ProjectBadges.tsx
    • src/components/views/project/ProjectGIVbackToast.tsx
    • src/components/views/project/projectActionCard/AdminActions.tsx
    • src/components/views/project/projectActionCard/ProjectStats.tsx
    • src/components/modals/StakeLock/LockInfo.tsx
    • src/components/modals/StakeLock/Lock.tsx
    • src/components/views/landings/web3CryptoDonation/numberedItems.tsx
    • src/components/views/landings/publicGoods/PublicGoodsFunding.tsx
    • src/components/views/homepage/introBlock/index.tsx
    • src/components/views/homepage/aboutGiveconomy/index.tsx
    • src/components/views/create/proGuide/ProjectTips/DefaultTip.tsx
    • src/components/views/donate/DonatePageProjectDescription.tsx
    • src/components/views/landings/GIVBacks/HowGIVbacksWork.tsx
    • src/components/views/landings/GIVBacks/YouKnowHow.tsx
    • src/components/views/landings/GIVBacks/WhatMakesGIVbacks.tsx
    • src/components/views/landings/onboarding/project-owner/projectOwnerSteps.tsx
    • src/components/views/landings/GIVBacks/WhatCanYouDo.tsx
    • src/components/views/landings/onboarding/main/WhatIsGiveth.tsx
    • src/components/views/landings/onboarding/main/WhatIsGIV.tsx
    • src/components/views/landings/GIVBacks/WhatAreGIVbacks.tsx
    • src/components/views/landings/onboarding/GIVeconomy/GIVeconomySteps.tsx
    • src/components/modals/FirstWelcomeModal.tsx
    • src/components/project-card/ProjectCardBadgeButtons.tsx
    • src/components/project-card/ProjectCardAlt.tsx
    • src/components/cards/GivEconomyProjectCards.tsx
    • src/components/cards/StakingCards/BaseStakingCard/StakingCardHeader.tsx
    • src/components/GIVeconomyPages/GIVpower.tsx
    • src/components/GIVeconomyPages/GIVbacks.tsx
    • src/apollo/gql/gqlProjects.ts
    • src/apollo/types/types.ts
    • src/apollo/types/gqlEnums.ts
Analysis chain

Verify the consistency and impact of the variable renaming.

The renaming of verified to isGivbackEligible improves code readability. However, please ensure this change is consistently applied throughout the codebase and doesn't break any existing logic that relies on the previous name.

Run the following script to verify the consistency and impact:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency and impact of renaming `verified` to `isGivbackEligible`.

# Test 1: Search for any remaining occurrences of `verified`. Expect: No results.
rg --type tsx --type ts --type js $'verified' -g '!yarn.lock'

# Test 2: Search for occurrences of `isGivbackEligible`. Expect: Only occurrences related to the Givback feature.
rg --type tsx --type ts --type js $'isGivbackEligible' -g '!yarn.lock' -A 5

Length of output: 191


Script:

#!/bin/bash
# Description: Verify the consistency and impact of renaming `verified` to `isGivbackEligible`.

# Test 1: Search for any remaining occurrences of `verified`. Expect: No results.
rg 'verified' --glob '*.tsx' --glob '*.ts' --glob '*.js' -g '!yarn.lock'

# Test 2: Search for occurrences of `isGivbackEligible`. Expect: Only occurrences related to the Givback feature.
rg 'isGivbackEligible' --glob '*.tsx' --glob '*.ts' --glob '*.js' -g '!yarn.lock' -A 5

Length of output: 23634

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: QA
Development

Successfully merging this pull request may close these issues.

1 participant