fix: make country code a dropdown
This commit is contained in:
parent
c8b72e004e
commit
54c38fa685
1 changed files with 13 additions and 9 deletions
|
|
@ -509,12 +509,13 @@ function ConfirmStep({
|
|||
[],
|
||||
);
|
||||
|
||||
const KNOWN_COUNTRIES = ["DE", "NL", "DK"];
|
||||
const handleResultSelect = useCallback(
|
||||
(result: { name: string; countryCode: string } | null) => {
|
||||
if (!result) return;
|
||||
setName(result.name);
|
||||
setSlug(toSlug(result.name));
|
||||
setCountryCode(result.countryCode);
|
||||
setCountryCode(KNOWN_COUNTRIES.includes(result.countryCode) ? result.countryCode : "");
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
|
@ -562,20 +563,23 @@ function ConfirmStep({
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div className="w-24">
|
||||
<div className="w-40">
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Country Code <span className="text-gray-400">(2-letter)</span>
|
||||
Country
|
||||
</label>
|
||||
<input
|
||||
<select
|
||||
value={countryCode}
|
||||
maxLength={2}
|
||||
onChange={(e) => setCountryCode(e.target.value.toUpperCase())}
|
||||
onChange={(e) => setCountryCode(e.target.value)}
|
||||
className="block w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-brand-500 focus:outline-none focus:ring-1 focus:ring-brand-500"
|
||||
placeholder="DE"
|
||||
/>
|
||||
>
|
||||
<option value="">— no transit —</option>
|
||||
<option value="DE">🇩🇪 Germany</option>
|
||||
<option value="NL">🇳🇱 Netherlands</option>
|
||||
<option value="DK">🇩🇰 Denmark</option>
|
||||
</select>
|
||||
{!countryCode && (
|
||||
<p className="mt-1 text-xs text-amber-600">
|
||||
No transit scoring without a country code.
|
||||
No transit scoring without a country.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue