Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

show US first in CountryCombobox

Steven Tey3b87896a3c27
diff --git a/apps/web/ui/modals/link-builder/targeting-modal.tsx b/apps/web/ui/modals/link-builder/targeting-modal.tsx
index fa41c74d9b..ebbdd54f25 100644
--- a/apps/web/ui/modals/link-builder/targeting-modal.tsx
+++ b/apps/web/ui/modals/link-builder/targeting-modal.tsx
@@ -174,6 +174,10 @@ function TargetingModal({
setValue("geo", newGeo, { shouldDirty: true });
}}
options={Object.entries(COUNTRIES)
+ // show United States first
+ .sort((a, b) =>
+ a[0] === "US" ? -1 : b[0] === "US" ? 1 : 0,
+ )
.filter(
([ck]) =>
ck === key || !Object.keys(geo).includes(ck),
diff --git a/apps/web/ui/partners/country-combobox.tsx b/apps/web/ui/partners/country-combobox.tsx
index e1081bdab2..add2664daa 100644
--- a/apps/web/ui/partners/country-combobox.tsx
+++ b/apps/web/ui/partners/country-combobox.tsx
@@ -15,17 +15,20 @@ export function CountryCombobox({
}) {
const options = useMemo(
() =>
- Object.entries(COUNTRIES).map(([key, value]) => ({
- icon: (
- <img
- alt={value}
- src={`https://hatscripts.github.io/circle-flags/flags/${key.toLowerCase()}.svg`}
- className="mr-1.5 size-4"
- />
- ),
- value: key,
- label: value,
- })),
+ Object.entries(COUNTRIES)
+ // show United States first
+ .sort((a, b) => (a[0] === "US" ? -1 : b[0] === "US" ? 1 : 0))
+ .map(([key, value]) => ({
+ icon: (
+ <img
+ alt={value}
+ src={`https://hatscripts.github.io/circle-flags/flags/${key.toLowerCase()}.svg`}
+ className="mr-1.5 size-4"
+ />
+ ),
+ value: key,
+ label: value,
+ })),
[],
);