Skip to content

Commit

Permalink
refactor: resolve warnings
Browse files Browse the repository at this point in the history
fix undefined variable previousMode
inline variables, update java docs and remove unused function
  • Loading branch information
Seli0303 committed Jun 19, 2024
1 parent d4269d4 commit 2f41ad0
Showing 1 changed file with 14 additions and 32 deletions.
46 changes: 14 additions & 32 deletions src/fragments/forms/place-input/place-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ export default {
* @returns {String}
*/
predictableId () {
let id = `place-input-container-${this.idPostfix}-${this.index}`
return id
return `place-input-container-${this.idPostfix}-${this.index}`
},
/**
* Determines if the automatic focus must be set or not
Expand All @@ -122,16 +121,14 @@ export default {
* @returns {Boolean}
*/
isMobile () {
let isMobile = Utils.isMobile()
return isMobile
return Utils.isMobile()
},
/**
* Determines if the 'pick a place' button must show its tooltip
* @returns {Boolean}
*/
showInputPickPlaceTooltip () {
let show = this.model.isEmpty() && !this.single && this.$store.getters.isSidebarVisible
return show
return this.model.isEmpty() && !this.single && this.$store.getters.isSidebarVisible
},
/**
* Get the input hint to be displayed
Expand All @@ -149,17 +146,7 @@ export default {
* @returns {Boolean}
*/
hideDetails () {
let hide = this.single || (!this.focused && !this.hasAutomaticFocus)
return hide
},
/**
* Returns the place input rule required message if it is empty
* @returns {Boolean|String}
*/
placeNameRules () {
return [
v => !!v || this.$t('placeInput.placeNameRequired')
]
return this.single || (!this.focused && !this.hasAutomaticFocus)
},
/**
* Return the column breakpoint that must be applied to the input flex
Expand Down Expand Up @@ -214,7 +201,6 @@ export default {
},
/**
* Get the place input label based on the current view mode
* @param {*} index
*/
placeInputLabel () {
let label = null
Expand Down Expand Up @@ -257,12 +243,10 @@ export default {
},
// Switch the coordinates position ([lat, long] -> [long, lat] and [long, lat] -> [lat, long])
switchCoordsAvailable () {
const canSwitch = this.model.nameIsNumeric()
return canSwitch
return this.model.nameIsNumeric()
},
searchAvailable () {
let available = appConfig.supportsSearchMode
return available
return appConfig.supportsSearchMode
},
/**
* Determines if the place input floating menu button is available for the current place input
Expand Down Expand Up @@ -305,8 +289,7 @@ export default {
},

showSuggestion () {
let show = this.focused && !this.focusIsAutomatic
return show
return this.focused && !this.focusIsAutomatic
},
appendBtn () {
if (this.supportSearch) {
Expand All @@ -332,7 +315,7 @@ export default {
/**
* highlight typed place name
* @param {String} placeName
* @returns {Html}
* @returns {string}
*/
highlightedName (placeName) {
let searchMask = this.localModel.placeName
Expand Down Expand Up @@ -386,8 +369,7 @@ export default {
}, 1000)
},
showAreaIcon (place) {
let show = place.properties.layer === 'country' || place.properties.layer === 'region'
return show
return place.properties.layer === 'country' || place.properties.layer === 'region'
},
inputFocused (event) {
event.stopPropagation()
Expand Down Expand Up @@ -638,12 +620,14 @@ export default {
this.showError(this.$t('placeInput.pleaseTypeSomething'))

} else {
const previousMode = this.$store.getters.mode
if (previousMode === constants.modes.search) {
this.$emit('searchChanged')
} else {
}
//TODO: check if the following else is needed (seems like event is not been caught)
else {
this.$emit('switchedToSearchMode')
}
const previousMode = this.$store.getters.mode
this.$store.commit('mode', constants.modes.search)
const appMode = new AppMode(this.$store.getters.mode)
const route = appMode.getRoute([this.localModel])
Expand Down Expand Up @@ -738,7 +722,6 @@ export default {

/**
* Reset a place input at a given index
* @param {*} index
*/
placeCleared () {
if (!this.model.isEmpty()) {
Expand Down Expand Up @@ -872,8 +855,7 @@ export default {
this.$emit('changedDirectPlace', data)
},
getNewGuid (prefix) {
let guid = Utils.guid(prefix)
return guid
return Utils.guid(prefix)
}
}
}

0 comments on commit 2f41ad0

Please sign in to comment.