-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix conditional rendering for post types
- Loading branch information
1 parent
7cdb27e
commit 2a8ed03
Showing
21 changed files
with
404 additions
and
77 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction | ||
|
||
export default function handler(req, res) { | ||
res.status(200).json({ name: 'John Doe' }); | ||
} |
94 changes: 94 additions & 0 deletions
94
geomapp/src/pages/api/service/google_place_autocomplete.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* eslint-disable consistent-return */ | ||
|
||
export default function useGooglePlaceAutoComplete() { | ||
const initAutoComplete = async (input, callback) => { | ||
const autoComplete = new window.google.maps.places.Autocomplete(input, { | ||
// limit to Chile for now | ||
componentRestrictions: { country: ['cl'] }, | ||
fields: ['address_component', 'geometry', 'formatted_address'], | ||
types: ['address'], | ||
}); | ||
autoComplete.addListener('place_changed', callback); | ||
return autoComplete; | ||
}; | ||
|
||
const getFullAddress = async (autoComplete) => { | ||
const place = autoComplete.getPlace(); | ||
|
||
let route = ''; | ||
let streetNumber = ''; | ||
let locality = ''; | ||
let adminArea1Short = ''; | ||
let adminArea1Long = ''; | ||
let adminArea2Short = ''; | ||
let adminArea2Long = ''; | ||
let adminArea3Short = ''; | ||
let adminArea3Long = ''; | ||
let countryShort = ''; | ||
let countryLong = ''; | ||
let postalCode = ''; | ||
|
||
// Get each component of the address from the place details, | ||
if (!place.address_components) return; | ||
// eslint-disable-next-line no-restricted-syntax | ||
for (const component of place.address_components) { | ||
const componentType = component.types[0]; | ||
|
||
if (componentType === 'street_number') { | ||
streetNumber = component.long_name; | ||
} | ||
if (componentType === 'route') { | ||
route = component.long_name; | ||
} | ||
if (componentType === 'locality') { | ||
locality = component.long_name; | ||
} | ||
if (componentType === 'administrative_area_level_1') { | ||
adminArea1Short = component.short_name; | ||
adminArea1Long = component.long_name; | ||
} | ||
if (componentType === 'administrative_area_level_2') { | ||
adminArea2Short = component.short_name; | ||
adminArea2Long = component.long_name; | ||
} | ||
if (componentType === 'administrative_area_level_3') { | ||
adminArea3Short = component.short_name; | ||
adminArea3Long = component.long_name; | ||
} | ||
if (componentType === 'postal_code') { | ||
postalCode = component.long_name; | ||
} | ||
if (componentType === 'postal_code_suffix') { | ||
postalCode = `${postalCode}-${component.long_name}`; | ||
} | ||
if (componentType === 'country') { | ||
countryShort = component.short_name; | ||
countryLong = component.long_name; | ||
} | ||
} | ||
|
||
const resAddress = { | ||
route, | ||
streetNumber, | ||
locality, | ||
adminArea1Short, | ||
adminArea1Long, | ||
adminArea2Short, | ||
adminArea2Long, | ||
adminArea3Short, | ||
adminArea3Long, | ||
postalCode, | ||
countryShort, | ||
countryLong, | ||
latitude: place.geometry.location.lat(), | ||
longitude: place.geometry.location.lng(), | ||
}; | ||
|
||
return resAddress; | ||
}; | ||
|
||
return { | ||
initAutoComplete, | ||
getFullAddress, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import '../../styles/users/zcentros.css'; | ||
import React, { useState, useRef, useEffect } from 'react'; | ||
|
||
|
||
|
||
function CentrosDeportivosForm() { | ||
|
||
|
||
return ( | ||
|
||
<div> | ||
|
||
<h1>Titulo</h1> | ||
<h1>Descripcion</h1> | ||
<h1>Fecha de inicio</h1> | ||
<h1>Fecha de fin</h1> | ||
<h1>Hora de inicio</h1> | ||
<h1>Hora de fin</h1> | ||
<h1>Subcategorias del evento</h1> | ||
|
||
|
||
</div> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
|
||
export default CentrosDeportivosForm; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import '../../styles/users/zgastronomia.css'; | ||
import React, { useState, useRef, useEffect } from 'react'; | ||
|
||
|
||
|
||
function GastronomiaForm() { | ||
|
||
|
||
return ( | ||
|
||
<div> | ||
|
||
<h1>Titulo</h1> | ||
<h1>Descripcion</h1> | ||
<h1>Fecha de inicio</h1> | ||
<h1>Fecha de fin</h1> | ||
<h1>Hora de inicio</h1> | ||
<h1>Hora de fin</h1> | ||
<h1>Subcategorias del evento</h1> | ||
|
||
|
||
</div> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
|
||
export default GastronomiaForm; |
Oops, something went wrong.