Skip to content

Commit

Permalink
Merge pull request #1760 from gustavomm19/reduce-geolocation-use
Browse files Browse the repository at this point in the history
Reduce geolocation use
  • Loading branch information
alesanchezr authored Sep 19, 2023
2 parents b675e6d + 12aba02 commit d25bf40
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 75 deletions.
7 changes: 4 additions & 3 deletions src/components/LeadForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,13 @@ const LeadForm = ({
options={selectLocation}
placeholder={locationSelector.place_holder}
valid={true}
onChange={(selected, valid) =>
onChange={(selected, valid) => {
setVal({
...formData,
utm_location: { value: selected.value, valid },
})
}
});
setLocation(selected.value);
}}
/>
</Div>
)}
Expand Down
15 changes: 9 additions & 6 deletions src/data/location/atlanta-usa.es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ custom_bar:

badges:
title: ""
paragraph: "4Geeks Academy es el lugar donde los desarrolladores crecen y prosperan.
Estamos autorizados por el Departamento de Educación de Florida.
# NOTE: If you want to break the text into many lines avoid using double quotes
# use the pipe operator ' | ' instead, like the example below
paragraph: |
4Geeks Academy es el lugar donde los desarrolladores crecen y prosperan.
Elegido como uno de los 35 mejores bootcamps de codificación del mundo y el mejor bootcamp de codificación en Atlanta según SwitchUp.
Estamos autorizados por el Departamento de Educación de Florida.
Elegido como uno de los 35 mejores bootcamps de codificación del mundo y el mejor bootcamp de codificación en Atlanta según SwitchUp.
4Geeks Academy ha sido reconocida como uno de los 10 mejores bootcamps de codificación en los Estados Unidos según Newsweek.
4Geeks Academy ha sido reconocida como uno de los 10 mejores bootcamps de codificación en los Estados Unidos según Newsweek.
Una comunidad construida para desarrolladores."
Una comunidad construida para desarrolladores.
news:
title: "4Geeks Academy Atlanta en las noticias..."
upcoming:
Expand Down
15 changes: 9 additions & 6 deletions src/data/location/atlanta-usa.us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,19 @@ header:

badges:
title: ""
paragraph: "4Geeks Academy is the place where developers grow and thrive.
We are licensed by the USA F. Dep. of Education.
# NOTE: If you want to break the text into many lines avoid using double quotes
# use the pipe operator ' | ' instead, like the example below
paragraph: |
4Geeks Academy is the place where developers grow and thrive.
Chosen as one of the top 35 coding bootcamps of the world and the top coding bootcamp in Atlanta according to SwitchUp.
We are licensed by the USA F. Dep. of Education.
Chosen as one of the top 35 coding bootcamps of the world and the top coding bootcamp in Atlanta according to SwitchUp.
4Geeks Academy has been recognized as one of the top 10 coding bootcamps in the United States according to Newsweek.
4Geeks Academy has been recognized as one of the top 10 coding bootcamps in the United States according to Newsweek.
A community built for developers."
A community built for developers.
news:
title: "4Geeks Academy Atlanta has been reviewed in:"
upcoming:
Expand Down
13 changes: 7 additions & 6 deletions src/data/location/chicago-usa.es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ custom_bar:

badges:
title: ""
paragraph: "4Geeks Academy es el lugar donde los desarrolladores crecen y prosperan.
Estamos autorizados por el Departamento de Educación de Florida.
paragraph: |
4Geeks Academy es el lugar donde los desarrolladores crecen y prosperan.
Elegido como uno de los 35 mejores bootcamps de codificación del mundo y el mejor bootcamp de codificación en Chicago según SwitchUp.
Estamos autorizados por el Departamento de Educación de Florida.
Elegido como uno de los 35 mejores bootcamps de codificación del mundo y el mejor bootcamp de codificación en Chicago según SwitchUp.
4Geeks Academy ha sido reconocida como uno de los 10 mejores bootcamps de codificación en los Estados Unidos según Newsweek.
4Geeks Academy ha sido reconocida como uno de los 10 mejores bootcamps de codificación en los Estados Unidos según Newsweek.
Una comunidad construida para desarrolladores."
Una comunidad construida para desarrolladores.
news:
title: "4Geeks Academy Chicago en las noticias..."
upcoming:
Expand Down
13 changes: 7 additions & 6 deletions src/data/location/chicago-usa.us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ header:

badges:
title: ""
paragraph: "4Geeks Academy is the place where developers grow and thrive.
We are licensed by the USA F. Dep. of Education.
paragraph: |
4Geeks Academy is the place where developers grow and thrive.
Chosen as one of the top 35 coding bootcamps of the world and the top coding bootcamp in Chicago according to SwitchUp.
We are licensed by the USA F. Dep. of Education.
Chosen as one of the top 35 coding bootcamps of the world and the top coding bootcamp in Chicago according to SwitchUp.
4Geeks Academy has been recognized as one of the top 10 coding bootcamps in the United States according to Newsweek.
4Geeks Academy has been recognized as one of the top 10 coding bootcamps in the United States according to Newsweek.
A community built for developers."
A community built for developers.
news:
title: "4Geeks Academy Chicago has been reviewed in:"
upcoming:
Expand Down
13 changes: 7 additions & 6 deletions src/data/location/houston-usa.es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ custom_bar:

badges:
title: ""
paragraph: "4Geeks Academy es el lugar donde los desarrolladores crecen y prosperan.
Estamos autorizados por el Departamento de Educación de Florida.
paragraph: |
4Geeks Academy es el lugar donde los desarrolladores crecen y prosperan.
Elegido como uno de los 35 mejores bootcamps de codificación del mundo y el mejor bootcamp de codificación en Houston según SwitchUp.
Estamos autorizados por el Departamento de Educación de Florida.
Elegido como uno de los 35 mejores bootcamps de codificación del mundo y el mejor bootcamp de codificación en Houston según SwitchUp.
4Geeks Academy ha sido reconocida como uno de los 10 mejores bootcamps de codificación en los Estados Unidos según Newsweek.
4Geeks Academy ha sido reconocida como uno de los 10 mejores bootcamps de codificación en los Estados Unidos según Newsweek.
Una comunidad construida para desarrolladores."
Una comunidad construida para desarrolladores.
news:
title: "4Geeks Academy Houston en las noticias..."
upcoming:
Expand Down
13 changes: 7 additions & 6 deletions src/data/location/houston-usa.us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ header:

badges:
title: ""
paragraph: "4Geeks Academy is the place where developers grow and thrive.
We are licensed by the USA F. Dep. of Education.
paragraph: |
4Geeks Academy is the place where developers grow and thrive.
Chosen as one of the top 35 coding bootcamps of the world and the top coding bootcamp in Houston according to SwitchUp.
We are licensed by the USA F. Dep. of Education.
Chosen as one of the top 35 coding bootcamps of the world and the top coding bootcamp in Houston according to SwitchUp.
4Geeks Academy has been recognized as one of the top 10 coding bootcamps in the United States according to Newsweek.
4Geeks Academy has been recognized as one of the top 10 coding bootcamps in the United States according to Newsweek.
A community built for developers."
A community built for developers.
news:
title: "4Geeks Academy Houston has been reviewed in:"
upcoming:
Expand Down
13 changes: 7 additions & 6 deletions src/data/location/losangeles-usa.es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ custom_bar:

badges:
title: ""
paragraph: "4Geeks Academy es el lugar donde los desarrolladores crecen y prosperan.
Estamos autorizados por el Departamento de Educación de Florida.
paragraph: |
4Geeks Academy es el lugar donde los desarrolladores crecen y prosperan.
Elegido como uno de los 35 mejores bootcamps de codificación del mundo y el mejor bootcamp de codificación en Los Angeles según SwitchUp.
Estamos autorizados por el Departamento de Educación de Florida.
Elegido como uno de los 35 mejores bootcamps de codificación del mundo y el mejor bootcamp de codificación en Los Angeles según SwitchUp.
4Geeks Academy ha sido reconocida como uno de los 10 mejores bootcamps de codificación en los Estados Unidos según Newsweek.
4Geeks Academy ha sido reconocida como uno de los 10 mejores bootcamps de codificación en los Estados Unidos según Newsweek.
Una comunidad construida para desarrolladores."
Una comunidad construida para desarrolladores.
news:
title: "4Geeks Academy Los Angeles en las noticias..."
upcoming:
Expand Down
13 changes: 7 additions & 6 deletions src/data/location/losangeles-usa.us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ header:

badges:
title: ""
paragraph: "4Geeks Academy is the place where developers grow and thrive.
We are licensed by the USA F. Dep. of Education.
paragraph: |
4Geeks Academy is the place where developers grow and thrive.
Chosen as one of the top 35 coding bootcamps of the world and the top coding bootcamp in Los Angeles according to SwitchUp.
We are licensed by the USA F. Dep. of Education.
Chosen as one of the top 35 coding bootcamps of the world and the top coding bootcamp in Los Angeles according to SwitchUp.
4Geeks Academy has been recognized as one of the top 10 coding bootcamps in the United States according to Newsweek.
4Geeks Academy has been recognized as one of the top 10 coding bootcamps in the United States according to Newsweek.
A community built for developers."
A community built for developers.
news:
title: "4Geeks Academy Los Angeles has been reviewed in:"
upcoming:
Expand Down
15 changes: 8 additions & 7 deletions src/data/location/newyork-usa.es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ custom_bar:

badges:
title: ""
paragraph: "4Geeks Academy es el lugar donde los desarrolladores crecen y prosperan.
Estamos autorizados por el Departamento de Educación de Florida.
Elegido como uno de los 35 mejores bootcamps de codificación del mundo y el mejor bootcamp de codificación en NYC según SwitchUp.
paragraph: |
4Geeks Academy es el lugar donde los desarrolladores crecen y prosperan.
Estamos autorizados por el Departamento de Educación de Florida.
Elegido como uno de los 35 mejores bootcamps de codificación del mundo y el mejor bootcamp de codificación en NYC según SwitchUp.
4Geeks Academy ha sido reconocida como uno de los 10 mejores bootcamps de codificación en los Estados Unidos según Newsweek.
4Geeks Academy ha sido reconocida como uno de los 10 mejores bootcamps de codificación en los Estados Unidos según Newsweek.
Una comunidad construida para desarrolladores."
Una comunidad construida para desarrolladores.
news:
title: "4Geeks Academy NYC en las noticias..."
upcoming:
Expand Down
13 changes: 7 additions & 6 deletions src/data/location/newyork-usa.us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ header:

badges:
title: ""
paragraph: "4Geeks Academy is the place where developers grow and thrive.
We are licensed by the USA F. Dep. of Education.
paragraph: |
4Geeks Academy is the place where developers grow and thrive.
Chosen as one of the top 35 coding bootcamps of the world and the top coding bootcamp in NYC according to SwitchUp.
We are licensed by the USA F. Dep. of Education.
Chosen as one of the top 35 coding bootcamps of the world and the top coding bootcamp in NYC according to SwitchUp.
4Geeks Academy has been recognized as one of the top 10 coding bootcamps in the United States according to Newsweek.
4Geeks Academy has been recognized as one of the top 10 coding bootcamps in the United States according to Newsweek.
A community built for developers."
A community built for developers.
news:
title: "4Geeks Academy NYC has been reviewed in:"
upcoming:
Expand Down
3 changes: 2 additions & 1 deletion src/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export default ({ children }) => {
const message = {
locationsArray: data.allLocationYaml,
storedSession: getStorage("academy_session"),
path: window.location.pathname,
seed: {
navigator: JSON.stringify(window.navigator),
location:
Expand All @@ -107,7 +108,7 @@ export default ({ children }) => {
},
};
const worker = new Worker(new URL("./worker.js", import.meta.url));
console.log("Initializing worker with: ", message)
console.log("Initializing worker with: ", message);
worker.postMessage(message);
worker.onmessage = (e) => {
const _session = e.data;
Expand Down
4 changes: 2 additions & 2 deletions src/templates/landing_a.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ const Landing = (props) => {
setComponents({ ...yml, ..._components });
}, [yml]);
useEffect(() => {
// if (yml.meta_info && yml.meta_info.utm_location)
// setLocation(yml.meta_info.utm_location[0] || null);
if (yml.meta_info && yml.meta_info.utm_location)
setLocation(yml.meta_info.utm_location[0] || null);

const urlParams = new URLSearchParams(window.location.search);
const _inLoc = urlParams.get("in") || null;
Expand Down
4 changes: 2 additions & 2 deletions src/templates/landing_nonav.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const Landing = (props) => {
setComponents({ ...yml, ..._components });
}, [yml]);
useEffect(() => {
// if (yml.meta_info && yml.meta_info.utm_location)
// setLocation(yml.meta_info?.utm_location[0]);
if (yml.meta_info && yml.meta_info.utm_location)
setLocation(yml.meta_info?.utm_location[0]);

const urlParams = new URLSearchParams(window.location.search);
const _inLoc = urlParams.get("in") || null;
Expand Down
14 changes: 8 additions & 6 deletions src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ const getRegion = (shortName, regions) => {
return region.length === 1 ? region[0] : null;
};

const initSession = async (locationsArray, storedSession, seed = {}) => {
console.log("Initializing session")
const initSession = async (locationsArray, storedSession, path, seed = {}) => {
console.log("Initializing session");
var v4 = null;
var latitude = null;
var longitude = null;
Expand Down Expand Up @@ -157,7 +157,7 @@ const initSession = async (locationsArray, storedSession, seed = {}) => {
longitude = location.longitude;
}

if (location === null) {
if (location === null && !path.includes("/landings")) {
console.log("Calculating nearest location because it was null...");
try {
const response = await fetch(
Expand Down Expand Up @@ -255,7 +255,9 @@ const initSession = async (locationsArray, storedSession, seed = {}) => {
}
}

if (!language) language = location.defaultLanguage;
const defaultLang = path.split("/").filter((l) => l !== "")[0] || "us";

if (!language) language = location?.defaultLanguage || defaultLang;

//construct the academy alias dictionary
let academyAlias = await fetch(
Expand Down Expand Up @@ -301,7 +303,7 @@ const initSession = async (locationsArray, storedSession, seed = {}) => {
};

self.onmessage = async (message) => {
const { locationsArray, storedSession, seed } = message.data;
const _session = await initSession(locationsArray, storedSession, seed);
const { locationsArray, storedSession, seed, path } = message.data;
const _session = await initSession(locationsArray, storedSession, path, seed);
self.postMessage(_session);
};

0 comments on commit d25bf40

Please sign in to comment.