fix: make country code a dropdown

This commit is contained in:
Jan-Henrik 2026-03-08 10:49:32 +01:00
parent c8b72e004e
commit 54c38fa685

View file

@ -509,12 +509,13 @@ function ConfirmStep({
[], [],
); );
const KNOWN_COUNTRIES = ["DE", "NL", "DK"];
const handleResultSelect = useCallback( const handleResultSelect = useCallback(
(result: { name: string; countryCode: string } | null) => { (result: { name: string; countryCode: string } | null) => {
if (!result) return; if (!result) return;
setName(result.name); setName(result.name);
setSlug(toSlug(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> </div>
<div className="w-24"> <div className="w-40">
<label className="block text-sm font-medium text-gray-700 mb-1"> <label className="block text-sm font-medium text-gray-700 mb-1">
Country Code <span className="text-gray-400">(2-letter)</span> Country
</label> </label>
<input <select
value={countryCode} value={countryCode}
maxLength={2} onChange={(e) => setCountryCode(e.target.value)}
onChange={(e) => setCountryCode(e.target.value.toUpperCase())}
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" 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 && ( {!countryCode && (
<p className="mt-1 text-xs text-amber-600"> <p className="mt-1 text-xs text-amber-600">
No transit scoring without a country code. No transit scoring without a country.
</p> </p>
)} )}
</div> </div>