Browse Source

fix(birthplace): update question birthplace

master
mortezaei 3 days ago
parent
commit
bc8fceaf47
  1. 19
      src/components/Componentes/question-birthplace.tsx

19
src/components/Componentes/question-birthplace.tsx

@ -147,8 +147,6 @@ export function QuestionBirthplace({
if (typeof window !== "undefined") {
const stored = localStorage.getItem(`residence_mode_${question.id}`);
if (stored === "manual" || stored === "auto") return stored;
const legacyChecked = localStorage.getItem("hasCheckedGeoIPResidence");
if (legacyChecked === "true") return "manual";
}
return "auto";
});
@ -280,15 +278,12 @@ export function QuestionBirthplace({
const storedMode =
typeof window !== "undefined"
? localStorage.getItem(`residence_mode_${question.id}`) ||
(localStorage.getItem("hasCheckedGeoIPResidence") === "true"
? "manual"
: null)
? localStorage.getItem(`residence_mode_${question.id}`)
: null;
if (storedMode === "manual") {
setMode("manual");
} else if (storedMode === "auto") {
} else {
setMode("auto");
}
return;
@ -342,10 +337,7 @@ export function QuestionBirthplace({
hasAutoDetectedRef.current = true;
const storedMode =
typeof window !== "undefined"
? localStorage.getItem(`residence_mode_${question.id}`) ||
(localStorage.getItem("hasCheckedGeoIPResidence") === "true"
? "manual"
: null)
? localStorage.getItem(`residence_mode_${question.id}`)
: null;
if (storedMode === "manual") {
@ -355,7 +347,7 @@ export function QuestionBirthplace({
const parsed = parseValue(rawValue);
if (!parsed.country && !parsed.city) {
void detectLocation();
void detectLocation(false);
} else {
void detectLocation(false);
}
@ -373,7 +365,6 @@ export function QuestionBirthplace({
const handleManualClick = () => {
if (typeof window !== "undefined") {
localStorage.setItem(`residence_mode_${question.id}`, "manual");
localStorage.setItem("hasCheckedGeoIPResidence", "true");
}
setMode("manual");
const parsed = parseValue(rawValue);
@ -438,7 +429,6 @@ export function QuestionBirthplace({
const handleSelectCountry = (country: string) => {
if (typeof window !== "undefined") {
localStorage.setItem(`residence_mode_${question.id}`, "manual");
localStorage.setItem("hasCheckedGeoIPResidence", "true");
}
setSelectedCountry(country);
selectedCountryStateRef.current = country;
@ -453,7 +443,6 @@ export function QuestionBirthplace({
const handleCityChange = (e: React.ChangeEvent<HTMLInputElement>) => {
if (typeof window !== "undefined") {
localStorage.setItem(`residence_mode_${question.id}`, "manual");
localStorage.setItem("hasCheckedGeoIPResidence", "true");
}
const newCity = e.target.value;
cityInputStateRef.current = newCity;

Loading…
Cancel
Save