Skip to content

Commit

Permalink
Merge pull request #4488 from brave-intl/fix/gemini-msg
Browse files Browse the repository at this point in the history
make wrong region message provider specific
  • Loading branch information
jlbyrne authored Jul 25, 2024
2 parents dc47862 + 2950cfb commit 6ea675e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default function CustodianServiceWidget({ walletData }) {
const [upholdConnection, setUpholdConnection] = useState(walletData.uphold_connection);
const [geminiConnection, setGeminiConnection] = useState(walletData.gemini_connection);
const [bitflyerConnection, setBitflyerConnection] = useState(walletData.bitflyer_connection);
const [unsupportedCountryMsg, setUnsupportedCountryMsg] = useState('');

const supportUrl = locale !== 'ja' ? 'https://support.brave.com/hc/en-us/articles/9884338155149' : 'https://support.brave.com/hc/en-us/articles/23311539795597';

Expand All @@ -37,15 +38,23 @@ export default function CustodianServiceWidget({ walletData }) {
bitflyer: 'https://bitflyer.com/',
}

// Since japanese accounts are limited to bitflyer, translation isn't a concern here. If we add other languages, we might need to revisit this.
useEffect(() => {
if (
supportedRegions.uphold.allow.includes(countryList[selectedCountry]) ||
supportedRegions.gemini.allow.includes(countryList[selectedCountry]) ||
supportedRegions.bitflyer.allow.includes(countryList[selectedCountry])
const unsupportedProvider = [];
if (supportedRegions.uphold.allow.includes(countryList[selectedCountry]) &&
supportedRegions.gemini.allow.includes(countryList[selectedCountry])
) {
setUnsupportedCountry(false);
} else {
setUnsupportedCountry(true);
!supportedRegions.uphold.allow.includes(countryList[selectedCountry]) && unsupportedProvider.push('Uphold');
!supportedRegions.gemini.allow.includes(countryList[selectedCountry]) && unsupportedProvider.push('Gemini');

setUnsupportedCountryMsg(
t('Home.account.wrong_region',
{ provider: unsupportedProvider.join(' and '), region: selectedCountry }
)
);
}
}, [selectedCountry]);

Expand Down Expand Up @@ -177,7 +186,7 @@ export default function CustodianServiceWidget({ walletData }) {
</Button>
{unsupportedCountry && (
<div className='info-text mt-3'>
{t('Home.account.wrong_region', { region: selectedCountry })}
{unsupportedCountryMsg}
</div>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion nextjs/src/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"gemini_connect": "Connect Gemini",
"uphold_connect": "Connect Uphold",
"bitflyer_connect": "Connect bitFlyer",
"wrong_region": "Uphold accounts registered in {region} are not supported at this time. However, you can connect anyway, and you'll become eligible if your {region} is supported in the future."
"wrong_region": "{provider} accounts registered in {region} are not supported at this time. However, you can connect anyway, and you'll become eligible if {region} is supported in the future."
},
"channels": {
"verified": "Appears as Verified",
Expand Down
2 changes: 1 addition & 1 deletion nextjs/src/messages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
"gemini_connect": "Geminiに接続",
"uphold_connect": "Upholdに接続",
"bitflyer_connect": "bitFlyerに接続",
"wrong_region": "{region}ではUpholdアカウントは現在サポートされていません。今後{region}がサポートされた際に受取ができるようになります。"
"wrong_region": "{region}では{provider}アカウントは現在サポートされていません。今後{region}がサポートされた際に受取ができるようになります。"
},
"channels": {
"verified": "認証済みと表示",
Expand Down

0 comments on commit 6ea675e

Please sign in to comment.