Open
Conversation
extracted country logic
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors Premium purchase flows by extracting country detection/persistence into a shared hook and rewriting the tier selection UI into a config-driven implementation, reducing duplicated country logic across components.
Changes:
- Added
useCountryDetectionhook to centralize country detection (localStorage +api.country.is+ language fallback) and persistence. - Rewrote
TierSelectionStepto use aTierCardcomponent and tier config maps, simplifying tier rendering logic. - Updated Premium wizard, subscription purchase, CoflCoins purchase, and
CountrySelectto use the new country detection approach.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| hooks/useCountryDetection.ts | New hook encapsulating country detection + persistence. |
| components/Premium/PremiumPurchaseWizard/Steps/TierSelectionStep.tsx | Refactored tier selection step; uses configs + TierCard; delegates country selection to CountrySelect. |
| components/Premium/PremiumPurchaseWizard/Steps/TierCard.tsx | New reusable tier card component for the tier grid. |
| components/Premium/PremiumPurchaseWizard/Steps/PurchaseCompletionStep.tsx | Removed obsolete commented countryCode prop notes. |
| components/Premium/PremiumPurchaseWizard/PremiumPurchaseWizard.tsx | Uses useCountryDetection and threads detected country into later steps. |
| components/Premium/BuySubscription/BuySubscription.tsx | Uses detected country for pricing/VAT and API calls. |
| components/Premium/BuyPremium/BuyPremium.tsx | Removes unused duration display helper. |
| components/CountrySelect/CountrySelect.tsx | Now uses useCountryDetection internally and shows loading state until detected. |
| components/CoflCoins/CoflCoinsPurchase.tsx | Replaced inline country detection with useCountryDetection. |
💡 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
extracted country logic