Skip to content

OpenStock is an open-source alternative to expensive market platforms. Track real-time prices, set personalized alerts, and explore detailed company insights — built openly, for everyone, forever free.

fix: show "Taiwan" in the country picker

ravixalgorithm4c37eae7027d
diff --git a/components/forms/CountrySelectField.tsx b/components/forms/CountrySelectField.tsx
index 84d5767..61c98b5 100644
--- a/components/forms/CountrySelectField.tsx
+++ b/components/forms/CountrySelectField.tsx
@@ -22,6 +22,15 @@ import { Check, ChevronsUpDown } from 'lucide-react';
import { cn } from '@/lib/utils';
import countryList from 'react-select-country-list';
+const COUNTRY_LABEL_OVERRIDES: Record<string, string> = {
+ TW: 'Taiwan',
+};
+
+const COUNTRY_OPTIONS = countryList().getData().map((country) => ({
+ ...country,
+ label: COUNTRY_LABEL_OVERRIDES[country.value] ?? country.label,
+}));
+
type CountrySelectProps = {
name: string;
label: string;
@@ -39,9 +48,6 @@ const CountrySelect = ({
}) => {
const [open, setOpen] = useState(false);
- // Get country options with flags
- const countries = countryList().getData();
-
// Helper function to get flag emoji
const getFlagEmoji = (countryCode: string) => {
const codePoints = countryCode
@@ -63,7 +69,7 @@ const CountrySelect = ({
{value ? (
<span className='flex items-center gap-2'>
<span>{getFlagEmoji(value)}</span>
- <span>{countries.find((c) => c.value === value)?.label}</span>
+ <span>{COUNTRY_OPTIONS.find((c) => c.value === value)?.label}</span>
</span>
) : (
'Select your country...'
@@ -85,7 +91,7 @@ const CountrySelect = ({
</CommandEmpty>
<CommandList className='max-h-60 bg-gray-800 scrollbar-hide-default'>
<CommandGroup className='bg-gray-800'>
- {countries.map((country) => (
+ {COUNTRY_OPTIONS.map((country) => (
<CommandItem
key={country.value}
value={`${country.label} ${country.value}`}