feat: APP-886 Add buy credits button to Terrasos project pages, if sell orders exist.#2813
feat: APP-886 Add buy credits button to Terrasos project pages, if sell orders exist.#2813alexander-astrand wants to merge 3 commits intodevfrom
Conversation
✅ Deploy Preview for terrasos ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR adds a "Buy Credits" button to Terrasos project pages when sell orders exist, replacing the "Book Call" button in that scenario. For Terrasos projects without sell orders, the existing "Book Call" button continues to be shown.
Changes:
- Added
hasSellOrdersprop toSellOrdersActionsBar(and its legacy variant) to conditionally show/hide the "Book Call" and "Buy Credits" buttons for Terrasos projects based on whether sell orders exist. - Modified the
onBuyButtonClickhandler inProjectDetailsto open the buy page in a new tab (window.open) for Terrasos projects, bypassing the standard wallet-connection flow used byuseOnBuyButtonClick.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.tsx |
Extracts sellOrders from the project hook, computes hasSellOrders, passes it as a prop, and adds Terrasos-specific buy button click handler using window.open. |
web-marketplace/src/components/organisms/SellOrdersActionsBar/SellOrdersActionsBar.tsx |
Adds hasSellOrders prop; conditionally shows "Book Call" only when Terrasos has no sell orders; conditionally shows "Buy Credits" when Terrasos has sell orders. |
web-marketplace/src/components/organisms/SellOrdersActionsBar/SellOrdersActionsBar.legacy.tsx |
Same logic changes as the non-legacy SellOrdersActionsBar for consistency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 264f53ee13
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.tsx
Outdated
Show resolved
Hide resolved
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the user experience on Terrasos project pages by dynamically displaying a 'Buy Credits' button when sell orders are available. This change streamlines the credit purchasing process for Terrasos projects, allowing users to directly access a dedicated buying interface, while also adjusting the visibility of the 'Book a Call' button based on credit availability. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request successfully adds the 'Buy Credits' button to Terrasos project pages when sell orders are available. The implementation is mostly correct and follows the existing structure. I've added a few comments: one to improve security when opening a new tab, and a couple of suggestions to refactor complex conditional logic for better readability in the SellOrdersActionsBar components.
web-marketplace/src/components/organisms/SellOrdersActionsBar/SellOrdersActionsBar.legacy.tsx
Show resolved
Hide resolved
web-marketplace/src/components/organisms/SellOrdersActionsBar/SellOrdersActionsBar.tsx
Show resolved
Hide resolved
web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.tsx
Outdated
Show resolved
Hide resolved
|
@erikalogie @S4mmyb See testing instrcutions. |
|
How can I test this? Which project has credits for sale? @alexander-astrand |
|
@erikalogie you will be able to test this on /project/el-globo using the terrasos deploy preview @erikalogie @S4mmyb one thing that hasn't been considered here: if the project doesn't have any fiat sell orders and the user is not logged in with a wallet addr then the buy page shouldn't be accessible. From the regen app, we show a popup to connect in this case before navigating to the buy page. But we can't really detect the user status from the terrasos app, so what should we do? |
@S4mmyb and I discussed this during our 1-1: he suggests to use the modal that we show on the project page in that case, but on the project buy page.
|

Description
https://regennetwork.atlassian.net/browse/APP-886
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
How to test
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...