Skip to content

Commit

Permalink
refactor: active prop defined in component
Browse files Browse the repository at this point in the history
  • Loading branch information
blackbirdem committed Jul 3, 2024
1 parent e31f7c4 commit 2ba1937
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import IschronesDetails from './components/isochrones-details/IsochronesDetails'
export default {
mixins: [MapFormMixin],
data: () => ({
active: true,
mode: constants.modes.isochrones,
mapViewData: new MapViewData(),
places: [new Place()],
Expand Down Expand Up @@ -121,6 +122,9 @@ export default {
} else {
this.places = [new Place()]
}
},
'$store.getters.mode': function (activeMode) {
this.active = activeMode === this.mode
}
},
methods: {
Expand Down
21 changes: 0 additions & 21 deletions src/fragments/forms/map-form/components/map-form-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,6 @@ import Place from '@/models/place'
import {EventBus} from '@/common/event-bus'

export default {
props: {
active: {
default: true,
type: Boolean
}
},
watch: {
active: function (newVal) {
this.activeChanged(newVal)
}
},
computed: {
/**
* Provides an accessor to the ors map filters object
Expand All @@ -44,16 +33,6 @@ export default {
}
},
methods: {
/**
* If the active state changes
* reset the places array
* @param {Boolean} isActive
*/
activeChanged(isActive) {
if (isActive) {
// this.places = [new Place()]
}
},
/**
* Toggle round trip
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import EditSkills from './components/edit-skills/EditSkills.vue'
export default {
mixins: [MapFormMixin],
data: () => ({
active: true,
mode: constants.modes.optimization,
mapViewData: new MapViewData(),
skills: [],
Expand Down Expand Up @@ -216,6 +217,9 @@ export default {
this.jobs = []
this.vehicles = []
}
},
'$store.getters.mode': function (activeMode) {
this.active = activeMode === this.mode
}
},
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import RoundTrip from './components/round-trip/RoundTrip.vue'
export default {
mixins: [MapFormMixin],
data: () => ({
active: true,
mapViewData: new MapViewData(),
places: [new Place()],
roundTripActive: false,
Expand All @@ -51,6 +52,9 @@ export default {
if (newVal === true && this.places.length === 1) {
this.setFocusedPlaceInput(0)
}
},
'$store.getters.mode': function (activeMode) {
this.active = activeMode === constants.modes.place || activeMode === constants.modes.directions
}
},
computed: {
Expand Down

0 comments on commit 2ba1937

Please sign in to comment.