Skip to content

Commit

Permalink
fix: exclude JP from targetable country list
Browse files Browse the repository at this point in the history
Resolves brave/ads-serve#4555

While I'm there, sort the list by name rather than code (because code just looks odd).

And fix one of the react warnings.
  • Loading branch information
tackley committed Dec 20, 2024
1 parent 1a6365e commit 1553dc1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/components/Location/LocationPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,23 @@ import { useLingui } from "@lingui/react";
import { msg, Trans } from "@lingui/macro";
import { useQuery } from "@apollo/client";
import { useIsEdit } from "@/form/FormikHelpers";
import { useMemo } from "react";

const icon = <CheckBoxOutlineBlankIcon fontSize="small" />;
const checkedIcon = <CheckBoxIcon fontSize="small" />;

export const LocationPicker = () => {
const { isDraft } = useIsEdit();
const { data } = useQuery(ActiveGeocodesDocument, { skip: !isDraft });
const sorted = _.sortBy(
(data?.geocodes ?? []).filter((c) => c.code !== "OTHER"),
"code",
const sorted = useMemo(
() =>
_.sortBy(
(data?.geocodes ?? []).filter(
(c) => c.code !== "OTHER" && c.code !== "JP",
),
"name",
),
[data],
);
const [formProps, meta, helper] = useField<GeocodeInput[]>("geoTargets");
const errorMessage = meta.error;
Expand Down
1 change: 1 addition & 0 deletions src/components/Navigation/AccountMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export function AccountMenu() {
)}
{nonCurrentAdvertisers.map((a, idx) => (
<MenuItem
key={a.id}
onClick={() => {
setActiveAdvertiser(a.id);
setSessionUser({ ...user, id: user.userId, advertisers } as any);
Expand Down

0 comments on commit 1553dc1

Please sign in to comment.