-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat: domain gift page #801
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis update introduces new components and refactors existing ones to support discount campaigns for domain registration and renewal. Key additions include Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant FreeRegistrationPage
participant FreeRegisterPresentation
participant FreeRegisterCheckout
participant CampaignService
participant RegistrationCalls
User ->> FreeRegistrationPage: Accesses free registration page
FreeRegistrationPage ->> FreeRegisterPresentation: Displays registration form
User ->> FreeRegisterPresentation: Enters domain and coupon code
FreeRegisterPresentation ->> FreeRegisterCheckout: Proceeds to checkout
FreeRegisterCheckout ->> CampaignService: Validates coupon
CampaignService ->> FreeRegisterCheckout: Returns validation result
FreeRegisterCheckout ->> RegistrationCalls: Generates registration call data
RegistrationCalls ->> FreeRegisterCheckout: Returns call data
FreeRegisterCheckout ->> User: Confirms registration completion
Assessment against linked issues
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- components/discount/discountCheckoutScreen.tsx (3 hunks)
- components/discount/discountOfferScreenVariant.tsx (1 hunks)
- components/discount/registerDiscount.tsx (9 hunks)
- components/domains/registerSummary.tsx (3 hunks)
- pages/domain-gift.tsx (1 hunks)
- styles/discount.module.css (4 hunks)
- types/frontTypes.d.ts (1 hunks)
- utils/discounts/domainGift.ts (1 hunks)
Files skipped from review due to trivial changes (4)
- components/discount/discountCheckoutScreen.tsx
- components/discount/discountOfferScreenVariant.tsx
- styles/discount.module.css
- utils/discounts/domainGift.ts
Additional comments not posted (9)
pages/domain-gift.tsx (3)
26-58
: Review the conditional rendering logic for different screens.The conditional rendering based on the
screen
state is implemented correctly. Each condition correctly renders a specific component for different states of the domain gift campaign.
11-62
: Ensure proper handling of undefined or null values in state and props.While the code generally looks good, it's crucial to ensure that all props, especially those from
domainGift
, handle potential undefined or null values gracefully to prevent runtime errors.
19-19
: Verify the logic for setting the screen based on the campaign expiry.The logic to set the screen to 0 when the current timestamp is greater than or equal to
domainGift.expiry
seems correct. However, ensure that thedomainGift.expiry
is always a valid date and consider what should happen right at the moment of expiry.Verification successful
The
domainGift.expiry
is initialized inutils/discounts/domainGift.ts
with a hardcoded timestamp value. This ensures thatdomainGift.expiry
is always a valid date. The logic to set the screen to 0 when the current timestamp is greater than or equal todomainGift.expiry
is correct and should work as intended.
utils/discounts/domainGift.ts:
export const domainGift: DomainGift = { name: "Domain Gift", image: "/register/gift.webp", expiry: 1726382280 * 1000, // timestamp in ms discountMailGroupId: "X", offer: { // offer details } };
pages/domain-gift.tsx:
useEffect(() => { const currentDate = new Date(); const timestamp = currentDate.getTime(); if (timestamp >= domainGift.expiry) setScreen(0); }, []);The initialization ensures that
domainGift.expiry
is always a valid timestamp, and the logic in theuseEffect
hook correctly handles the expiry check.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the handling of campaign expiry in DomainGift component. # Test: Search for usage of `domainGift.expiry`. Expect: Proper date handling and edge cases considered. rg --type typescript $'domainGift\\.expiry'Length of output: 78
Script:
#!/bin/bash # Description: Verify the handling of campaign expiry in DomainGift component. # Test: Search for usage of `domainGift.expiry`. Expect: Proper date handling and edge cases considered. rg --type ts 'domainGift\.expiry'Length of output: 170
Script:
#!/bin/bash # Extract lines around the first occurrence of `domainGift.expiry` in `pages/domain-gift.tsx` rg --type ts --context 5 'domainGift\.expiry' pages/domain-gift.tsxLength of output: 674
Script:
#!/bin/bash # Search for the initialization and validation of `domainGift.expiry` rg --type ts 'domainGift\s*=\s*{[^}]*expiry' --context 5Length of output: 188
Script:
#!/bin/bash # Search for the initialization and validation of `domainGift.expiry` rg --type ts 'domainGift\s*=\s*{[^}]*expiry' --context 5Length of output: 188
Script:
#!/bin/bash # Search for the initialization of `domainGift` and manually inspect for `expiry` rg --type ts 'domainGift\s*=' --context 5Length of output: 43
Script:
#!/bin/bash # Search for any initialization or assignment to `domainGift` across all TypeScript files rg --type ts 'domainGift' --context 5Length of output: 3847
types/frontTypes.d.ts (1)
59-62
: Ensure consistency in the use of optional properties in theDiscount
type.The addition of
couponCode
andcouponHelper
as optional properties in theDiscount
type is consistent with the updates in the component props. This ensures type safety and better integration with the updated components.components/domains/registerSummary.tsx (2)
155-165
: Review the conditional rendering logic for displaying price information.The conditional rendering based on the
isFree
prop is implemented correctly. It either displays "Free" or the calculated token price, ensuring a clear and accurate presentation of cost information to the user.
32-32
: Validate the default value and usage of theisFree
prop.The
isFree
prop is used to conditionally render the registration cost as "Free". Ensure that this prop is always passed correctly from parent components and consider providing a default value in the prop destructuring to handle cases where it might not be provided.Also applies to: 50-50
Verification successful
The
isFree
prop inregisterSummary.tsx
is correctly provided with a default value offalse
and is used consistently in conditional rendering.
components/domains/registerSummary.tsx
:
- Line 32:
isFree?: boolean;
- Line 50:
isFree = false,
- Line 54:
{isFree ? (
- Line 58:
{isFree ? null : areArCurrenciesEnabled ? (
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the handling and default value of `isFree` prop in RegisterSummary component. # Test: Search for usage of `isFree` prop. Expect: Default value provided and used consistently. rg --type typescript $'isFree'Length of output: 64
Script:
#!/bin/bash # Description: Verify the handling and default value of `isFree` prop in RegisterSummary component. # Test: Search for usage of `isFree` prop. Expect: Default value provided and used consistently. rg --type ts 'isFree' rg --type tsx 'isFree'Length of output: 485
components/discount/registerDiscount.tsx (3)
333-336
: Review the implementation of thechangeCoupon
function.The
changeCoupon
function correctly updates thecoupon
state and setscouponError
based on whether the coupon value is empty. This ensures proper validation and user feedback.
388-398
: Validate the conditional rendering and error handling for the coupon code input.The conditional rendering based on the
couponCode
prop and the error handling for the coupon input are implemented correctly. This ensures that the coupon code feature is optional and that errors are handled appropriately.
52-54
: Ensure proper handling and default values for new props inRegisterDiscount
.The new props
couponCode
,couponHelper
, andbanner
are used to enhance the component's functionality. Verify that these props are always provided when the component is used, or consider setting sensible default values.Also applies to: 65-67
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- components/discount/discountCheckoutScreen.tsx (4 hunks)
- components/discount/registerDiscount.tsx (12 hunks)
- pages/domain-gift.tsx (1 hunks)
- utils/campaignService.ts (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- components/discount/discountCheckoutScreen.tsx
- pages/domain-gift.tsx
Additional comments not posted (1)
components/discount/registerDiscount.tsx (1)
61-64
: Ensure correct prop types forcouponCode
,couponHelper
, andbanner
.Check if
couponCode
should be a boolean (as defined) or if it should be a string or other type based on its usage in the component.Verification successful
Ensure correct prop types for
couponCode
,couponHelper
, andbanner
.The prop types for
couponCode
,couponHelper
, andbanner
in theRegisterDiscountProps
interface are correctly defined asboolean
,string
, andstring
respectively. Their usage within the component aligns with these types:
couponCode
is used in a conditional rendering, which is appropriate for a boolean.
couponHelper
is assigned tohelperText
, which is appropriate for a string.
banner
is used as thesrc
attribute of animg
tag, which is appropriate for a string.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the prop types for `couponCode`, `couponHelper`, and `banner` are correctly used throughout the component. # Test: Search for prop usage in the component. ast-grep --lang javascript --pattern $'const RegisterDiscount: FunctionComponent<RegisterDiscountProps> = ($_) { $$$ $_($_) }'Length of output: 644
Script:
#!/bin/bash # Description: Verify that the prop types for `couponCode`, `couponHelper`, and `banner` are correctly used throughout the component. # Test: Search for prop usage in the component. ast-grep --lang typescript --pattern 'const RegisterDiscount: FunctionComponent<$_> = ($$) => { $$$ }'Length of output: 104
Script:
#!/bin/bash # Description: Verify the prop types for `couponCode`, `couponHelper`, and `banner` in the `RegisterDiscountProps` interface and their usage in the component. # Step 1: Search for the `RegisterDiscountProps` interface definition. ast-grep --lang typescript --pattern 'interface RegisterDiscountProps { $$$ }' # Step 2: Verify the usage of `couponCode`, `couponHelper`, and `banner` within the component. rg 'couponCode|couponHelper|banner' components/discount/registerDiscount.tsxLength of output: 416
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- components/discount/discountOfferScreenVariant.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- components/discount/discountOfferScreenVariant.tsx
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code only
For now I've looked only at the code, we have a lot of small recommendations here and there.
pages/domain-gift.tsx
Outdated
@@ -0,0 +1,86 @@ | |||
import React, { useEffect, useState } from "react"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
freeregistration.tsx
pages/domain-gift.tsx
Outdated
import DiscountCheckoutScreen from "../components/discount/discountCheckoutScreen"; | ||
|
||
// Create a new discount in utils to create a new discount campaign | ||
import { domainGift } from "../utils/discounts/domainGift"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace domain gift by freeRegistration everywhere.
It's a better naming cause for the code it gives more information about you're doing.
pages/domain-gift.tsx
Outdated
setScreen(screen - 1); | ||
} | ||
|
||
const getCustomCalls: GetCustomCalls = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add to registrationCall.ts
adding a relevant naming :)
pages/domain-gift.tsx
Outdated
/> | ||
) : null} | ||
{screen === 1 ? ( | ||
<DiscountOfferScreenVariant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.
import SearchBar from "../UI/searchBar"; | ||
import Timer from "../UI/timer"; | ||
|
||
type DiscountOfferScreenVariantProps = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change name to what FreeRegisterDiscount
@@ -40,6 +40,15 @@ import { | |||
getDomainPriceAltcoin, | |||
getTokenQuote, | |||
} from "../../utils/altcoinService"; | |||
import { getFreeDomain } from "@/utils/campaignService"; | |||
|
|||
export type GetCustomCalls = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for a type.
Use the Call
type and follow what we do in registrationCalls.ts
couponCode, | ||
couponHelper, | ||
banner = "/visuals/register.webp", | ||
getCustomCalls, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of creating a freeRegister.tsx
component based on this one instead of reusing it ?
you wouldn't need to pass the calls in props ...
I think it would be clearer tbh
@@ -1,6 +1,6 @@ | |||
import React, { FunctionComponent } from "react"; | |||
import styles from "../../styles/discount.module.css"; | |||
import RegisterDiscount from "./registerDiscount"; | |||
import RegisterDiscount, { GetCustomCalls } from "./registerDiscount"; | |||
|
|||
type DiscountCheckoutScreenProps = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this component really useful ? It seems like a wrapper for RegisterDiscount
It would delete a lot of useless code to directly use RegisterDiscount
where needed and add <div className={styles.container}>
in it
You have more context than me as I don't remember so well this part of the code. Wdyt ?
There was a problem hiding this 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 (1)
pages/quantumleap.tsx (1)
89-102
: Consider using a context or Redux for managing the state across multiple components and screens.
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- components/discount/discountCheckoutScreen.tsx (3 hunks)
- components/discount/freeRegisterDiscount.tsx (1 hunks)
- components/discount/registerDiscount.tsx (12 hunks)
- pages/freeregistration.tsx (1 hunks)
- pages/quantumleap.tsx (2 hunks)
- utils/callData/registrationCalls.ts (2 hunks)
- utils/campaignService.ts (1 hunks)
- utils/discounts/freeRegistration.ts (1 hunks)
Files not reviewed due to errors (2)
- utils/callData/registrationCalls.ts (no review received)
- components/discount/registerDiscount.tsx (no review received)
Files skipped from review due to trivial changes (1)
- utils/discounts/freeRegistration.ts
Files skipped from review as they are similar to previous changes (2)
- components/discount/discountCheckoutScreen.tsx
- utils/campaignService.ts
Additional comments not posted (6)
components/discount/freeRegisterDiscount.tsx (2)
28-49
: The component structure and JSX are well-organized and readable.
6-12
: EnsureSearchResult
type is properly defined and imported.pages/freeregistration.tsx (2)
28-66
: The page component handles different screens effectively using conditional rendering.
17-22
: Ensure that the campaign expiry logic is correctly implemented and tested.Verification successful
The search results indicate that
freeRegistration.expiry
is used in two places withinpages/freeregistration.tsx
:
- Line 17: In the
useEffect
hook to check if the current timestamp is greater than or equal to the expiry.- Line 22: As a prop in a JSX element.
Both usages appear to be consistent with the intended functionality of checking and displaying the campaign expiry. The logic seems correctly implemented.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the campaign expiry logic. # Test: Search for the usage of `freeRegistration.expiry` in the codebase. rg --type typescript $'freeRegistration.expiry'Length of output: 81
Script:
#!/bin/bash # Description: Verify the campaign expiry logic. # Test: Search for the usage of `freeRegistration.expiry` in the codebase. rg --type ts $'freeRegistration.expiry'Length of output: 195
pages/quantumleap.tsx (2)
89-102
: The component structure and JSX are well-organized and readable.
89-102
: Ensure that theRegisterDiscount
component is correctly integrated and receiving all required props.Verification successful
The
RegisterDiscount
component is correctly integrated and receiving all required props inpages/quantumleap.tsx
. The props passed toRegisterDiscount
inQuantumLeap
match the expectedRegisterDiscountProps
type defined incomponents/discount/registerDiscount.tsx
.
domain
:searchResult?.name ?? ""
duration
:getDuration()
discountId
:getDiscountId()
customMessage
:getCustomMessage()
priceInEth
:getPrice()
mailGroups
:[process.env.NEXT_PUBLIC_MAILING_LIST_GROUP ?? "", quantumLeapDiscount.discountMailGroupId]
goBack
:goBack
No issues were found with the integration.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the integration of `RegisterDiscount` component. # Test: Search for the usage of `RegisterDiscount` in the codebase. rg --type typescript $'RegisterDiscount'Length of output: 74
Script:
#!/bin/bash # Description: Verify the integration of `RegisterDiscount` component. # Test: Search for the usage of `RegisterDiscount` in the codebase. rg --type ts,tsx 'RegisterDiscount'Length of output: 66
Script:
#!/bin/bash # Description: Verify the integration of `RegisterDiscount` component. # Test: Search for the usage of `RegisterDiscount` in the codebase. rg --type ts 'RegisterDiscount' rg --type tsx 'RegisterDiscount'Length of output: 1262
Script:
#!/bin/bash # Description: Extract relevant portions of files for `RegisterDiscount` integration review. # Extract the relevant portion from `pages/quantumleap.tsx`. rg --type ts 'RegisterDiscount' pages/quantumleap.tsx -A 10 -B 10 # Extract the relevant portion from `components/discount/registerDiscount.tsx`. rg --type ts 'RegisterDiscount' components/discount/registerDiscount.tsx -A 10 -B 10Length of output: 3028
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- utils/callData/registrationCalls.ts (2 hunks)
Additional context used
Biome
utils/callData/registrationCalls.ts
[error] 1-1: All these imports are only used as types.
Additional comments not posted (1)
utils/callData/registrationCalls.ts (1)
224-224
: Consider removing the unnecessaryflat()
method.- calldata: [newTokenId, encodedDomain, signature, txMetadataHash].flat(), + calldata: [newTokenId, encodedDomain, ...signature, txMetadataHash],The array
[newTokenId, encodedDomain, signature, txMetadataHash]
is already flat, andsignature
is spread into the array to ensure all elements are at the same level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
Outside diff range and nitpick comments (7)
components/discount/freeRenewalPresentation.tsx (3)
7-7
: Ensure thetitle
prop structure is documented in the prop types.It's good practice to document the expected structure of object props, especially when they are complex. This helps other developers understand what properties are expected without needing to dig through the code.
Line range hint
22-22
: Add analt
attribute to the image for accessibility.- <img src={image} className={styles.illustration} /> + <img src={image} className={styles.illustration} alt="Renewal illustration" />Images should have an
alt
attribute to provide a text alternative for screen readers. This improves accessibility for users with visual impairments.
Line range hint
1-1
: Consider usingimport type
for type-only imports.- import React, { FunctionComponent } from "react"; + import React from "react"; + import type { FunctionComponent } from "react";This change clarifies that
FunctionComponent
is used for type checking only, which can help during the TypeScript compilation process to skip the JavaScript output for these imports.components/discount/FreeRegisterPresentation.tsx (1)
6-13
: Ensure thetitle
prop structure is documented in the prop types.It's good practice to document the expected structure of object props, especially when they are complex. This helps other developers understand what properties are expected without needing to dig through the code.
components/discount/freeRenewalDiscount.tsx (3)
Line range hint
435-435
: Add analt
attribute to the image for accessibility.- <img className={styles.image} src="/visuals/register.webp" /> + <img className={styles.image} src="/visuals/register.webp" alt="Visual representation of the registration process" />Images should have an
alt
attribute to provide a text alternative for screen readers. This improves accessibility for users with visual impairments.
Line range hint
1-2
: Consider usingimport type
for type-only imports.- import { FunctionComponent, useEffect, useState } from "react"; - import { Call } from "starknet"; + import type { FunctionComponent, useEffect, useState } from "react"; + import type { Call } from "starknet";This change clarifies that these imports are used for type checking only, which can help during the TypeScript compilation process to skip the JavaScript output for these imports.
Also applies to: 14-15
Line range hint
108-108
: Specify all necessary dependencies in theuseEffect
hook.- }, [renewData]); + }, [renewData, addTransaction, groups, needMetadata, salt, metadataHash, email, isSwissResident]);It's important to include all variables used inside a
useEffect
hook in its dependency array to avoid issues with stale closures and ensure the hook reacts to changes in these variables.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (7)
- components/discount/FreeRegisterPresentation.tsx (1 hunks)
- components/discount/freeRenewalDiscount.tsx (3 hunks)
- components/discount/freeRenewalPresentation.tsx (2 hunks)
- components/discount/registerFree.tsx (1 hunks)
- pages/freeregistration.tsx (1 hunks)
- pages/freerenewal.tsx (3 hunks)
- tests/utils/campaignService.test.js (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- pages/freeregistration.tsx
- tests/utils/campaignService.test.js
Additional context used
Biome
components/discount/freeRenewalPresentation.tsx
[error] 22-22: Provide a text alternative through the alt, aria-label or aria-labelledby attribute
[error] 1-1: Some named imports are only used as types.
components/discount/FreeRegisterPresentation.tsx
[error] 30-30: Template literals are preferred over string concatenation.
[error] 39-39: Provide a text alternative through the alt, aria-label or aria-labelledby attribute
[error] 1-1: Some named imports are only used as types.
components/discount/registerFree.tsx
[error] 219-219: Avoid the words "image", "picture", or "photo" in img element alt text.
[error] 102-102: This hook does not specify all of its dependencies: addTransaction
components/discount/freeRenewalDiscount.tsx
[error] 242-242: Unnecessary use of boolean literals in conditional expression.
[error] 284-284: Change to an optional chain.
[error] 435-435: Provide a text alternative through the alt, aria-label or aria-labelledby attribute
[error] 1-2: Some named imports are only used as types.
[error] 14-15: All these imports are only used as types.
[error] 104-104: This hook specifies more dependencies than necessary: setPotentialPrice
[error] 108-108: This hook does not specify all of its dependencies: addTransaction
[error] 108-108: This hook does not specify all of its dependencies: groups
[error] 108-108: This hook does not specify all of its dependencies: needMetadata
[error] 108-108: This hook does not specify all of its dependencies: salt
[error] 108-108: This hook does not specify all of its dependencies: metadataHash
[error] 108-108: This hook does not specify all of its dependencies: email
[error] 108-108: This hook does not specify all of its dependencies: isSwissResident
[error] 154-154: This hook does not specify all of its dependencies: quoteData
[error] 154-154: This hook does not specify all of its dependencies: quoteData.max_quote_validity
[error] 154-154: This hook specifies more dependencies than necessary: price
[error] 173-173: Use Number.parseInt instead of the equivalent global.
[error] 199-199: This hook specifies more dependencies than necessary: address
[error] 210-210: Use Number.parseInt instead of the equivalent global.
[error] 256-256: This hook specifies more dependencies than necessary: price, salesTaxAmount, duration, discountId, needMetadata
Additional comments not posted (2)
pages/freerenewal.tsx (2)
36-36
: Verify the correct handling of thesetScreen
function.Ensure that the
setScreen
function correctly handles the screen state transitions, especially in edge cases where the state might not update as expected.
46-46
: Review the use of environment variables and group IDs.Ensure that the environment variable
NEXT_PUBLIC_MAILING_LIST_GROUP_AUTO_RENEWAL
is used consistently and securely throughout the codebase.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick changes and we're good !
components/discount/registerFree.tsx
Outdated
banner: string; | ||
}; | ||
|
||
const FreeRegisterCheckout: FunctionComponent<FreeRegisterCheckoutProps> = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name of the file is different that the name of the component
components/discount/registerFree.tsx
Outdated
<TxConfirmationModal | ||
txHash={registerData?.transaction_hash} | ||
isTxModalOpen={isTxModalOpen} | ||
closeModal={() => setIsTxModalOpen(false)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of having this modal, you can reuse the model we have on the registration part by sending it to a different page (confirmation.tsx
with the URL /confirmation?tokenId=ID
).
There was a problem hiding this 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
Outside diff range and nitpick comments (1)
components/discount/freeRegisterCheckout.tsx (1)
163-229
: The JSX structure is comprehensive, handling various states and user interactions effectively. Consider adding aria-labels for accessibility improvements.// Add aria-labels for better accessibility <Button aria-label="Register my domain" onClick={handleRegister}>Register my domain</Button>
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- components/discount/freeRegisterCheckout.tsx (1 hunks)
- components/discount/freeRegisterPresentation.tsx (1 hunks)
- pages/freeregistration.tsx (1 hunks)
- styles/components/registerV2.module.css (1 hunks)
- utils/discounts/freeRegistration.ts (1 hunks)
Files skipped from review due to trivial changes (1)
- styles/components/registerV2.module.css
Files skipped from review as they are similar to previous changes (2)
- pages/freeregistration.tsx
- utils/discounts/freeRegistration.ts
Additional comments not posted (4)
components/discount/freeRegisterPresentation.tsx (3)
7-14
: The addition of theexpiry
prop is well-integrated and aligns with the PR objectives to include an expiry timer in the UI.
16-49
: The main function logic for handling search results and screen transitions is clear and effective.
24-49
: The JSX structure is well-organized, effectively using conditional rendering and integrating theTimer
component. Styling with CSS modules enhances maintainability.components/discount/freeRegisterCheckout.tsx (1)
25-33
: The addition ofcouponCode
andcouponHelper
props supports the new functionality of handling coupon codes, aligning with the PR objectives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
close: #791
NEEDED IN ENV VARS: NEXT_PUBLIC_DOMAIN_GIFT_CONTRACT=0x064b630cd6824e1c49b9eab5ca07014889b3e4e3d88a348393172c6f48155b56 (SEPOLIA)
Summary by CodeRabbit
New Features
FreeRegistration
page to manage free registration discount campaigns.DomainGift
component for managing domain gift campaigns.Enhancements
RegisterDiscount
component.RegisterSummary
to display "Free" for free registrations.RegisterCheckboxes
to use a newTermCheckbox
component for better code organization.Renaming
FreeRenewalDiscount
toFreeRenewalCheckout
.DiscountRenewalScreen
toFreeRenewalPresentation
.Bug Fixes
New Utilities
getFreeRegistrationCalls
function for generating call data for free domain registration.getFreeDomain
function to fetch free domain details.DomainGift
andFreeRegistration
types for better type management in discount campaigns.