Skip to content

Commit 29123d6

Browse files
committed
address dialog and location review feedback
1 parent 4281c7a commit 29123d6

5 files changed

Lines changed: 11 additions & 5 deletions

File tree

e2e/listings.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ test("listing edit saves and restores seeded business fields", async ({
111111
await expect(listingWriteForm.locator("#description").first()).toHaveValue(
112112
updatedDescription
113113
);
114-
await expect(listingWriteForm.locator("#visibility")).toHaveValue(
114+
await expect(listingWriteForm.locator("#visibility").first()).toHaveValue(
115115
updatedVisibility
116116
);
117117

@@ -132,7 +132,7 @@ test("listing edit saves and restores seeded business fields", async ({
132132
await expect(listingWriteForm.locator("#description").first()).toHaveValue(
133133
originalDescription
134134
);
135-
await expect(listingWriteForm.locator("#visibility")).toHaveValue(
135+
await expect(listingWriteForm.locator("#visibility").first()).toHaveValue(
136136
originalVisibility
137137
);
138138
});

src/components/ButtonToDialog/ButtonToDialog.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ const DialogOverlay = styled(Dialog.Overlay)`
6767
z-index: 3;
6868
`;
6969

70+
type DialogVariant = Extract<ButtonVariant, "primary" | "secondary" | "danger">;
71+
7072
type ButtonToDialogProps = {
71-
variant?: ButtonVariant;
73+
variant?: DialogVariant;
7274
triggerVariant?: ButtonVariant;
7375
size?: "massive" | "large" | "normal" | "small";
7476
initialButtonText: ReactNode;

src/components/ListingWrite/ListingWrite.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ export default function ListingWrite({
577577
setCountryCode={setCountryCode}
578578
areaName={areaName}
579579
setAreaName={setAreaName}
580+
autoDetectCountry={!initialListing}
580581
error={errors.location}
581582
/>
582583

src/components/ListingWrite/listingWriteController.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export type LocationSelectProps = {
5252
areaName: string;
5353
setAreaName: Dispatch<SetStateAction<string>>;
5454
initialPlaceholderText?: string;
55+
autoDetectCountry?: boolean;
5556
error?: string;
5657
};
5758

src/components/LocationSelect/LocationSelect.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ type LocationSelectProps = {
5757
areaName: string;
5858
setAreaName: Dispatch<SetStateAction<string>>;
5959
initialPlaceholderText?: string;
60+
autoDetectCountry?: boolean;
6061
error?: string;
6162
};
6263

@@ -148,6 +149,7 @@ export default function LocationSelect({
148149
areaName,
149150
setAreaName,
150151
initialPlaceholderText,
152+
autoDetectCountry = true,
151153
error,
152154
}: LocationSelectProps) {
153155
const t = useTranslations();
@@ -160,7 +162,7 @@ export default function LocationSelect({
160162
);
161163

162164
useEffect(() => {
163-
if (!countryCode) {
165+
if (autoDetectCountry && !countryCode) {
164166
let isMounted = true; // Track if component is mounted
165167

166168
const initializeLocation = async () => {
@@ -185,7 +187,7 @@ export default function LocationSelect({
185187
isMounted = false;
186188
};
187189
}
188-
}, [countryCode, setCountryCode]);
190+
}, [autoDetectCountry, countryCode, setCountryCode]);
189191

190192
const handleCountryChange = useCallback(
191193
(e: ChangeEvent<HTMLSelectElement>) => {

0 commit comments

Comments
 (0)