diff --git a/src/components/charts/chartController.vue b/src/components/charts/chartController.vue index 3ab039e1..2bd89638 100644 --- a/src/components/charts/chartController.vue +++ b/src/components/charts/chartController.vue @@ -363,7 +363,7 @@ export default { // check if current chart is the largest chart, don't map if so // may need a better way to differentiate charts, but this works for now // and accounts for have two charts that are the same length - if (chart.backgroundColor != largestChart.backgroundColor) { + if (chart.backgroundColor !== largestChart.backgroundColor) { // loop through all data points in current chart and map x-value to largest chart // also create a datapoint for the original x-value so that we can display it on tooltip hover for (let i in chart.data) { diff --git a/src/components/view/navdir.vue b/src/components/view/navdir.vue index 71bb30ad..d34aa605 100644 --- a/src/components/view/navdir.vue +++ b/src/components/view/navdir.vue @@ -8,6 +8,9 @@ + $route section (20 lines or so below), then configure + // this.otherView (or whatever) in navdir.vue file. + // However, this.navVis is still needed here as it guarantees the navbar is not shown before + // await this.$store.dispatch('map/loadMap') completes, preventing errors in navdir file. + // this.navVis = true + this.navVis = this.$route.path.includes('building') + console.log(this.navVis) await this.$store.dispatch('user/user') if (!this.view.id) { await this.$store.dispatch('view/changeView', this.$route.params.id) @@ -61,6 +70,8 @@ export default { $route: { immediate: true, handler: async function (to, from) { + this.navVis = this.$route.path.includes('building') + console.log(this.navVis) if ( !this.$route.path.includes('building') && !this.$route.path.includes('compare') && @@ -75,21 +86,24 @@ export default { this.$store.commit(card.path + '/intervalUnit', this.intervalUnit) } } - // Reset multStart and multEnd variables whenever you are on a comparison page for just 1 building - let buildingComparisonNumber = JSON.parse(decodeURI(this.$route.params.buildings)).length - if (this.$route.path.includes('compare') && buildingComparisonNumber === 1) { - for (let card of this.cards) { - if (!card.path) return - this.$nextTick(() => { - let blockpath = this.cards[0].path - let searchTerm = 'block_' - let chartIndex = blockpath.indexOf(searchTerm) - // console.log(blockpath.slice(chartIndex + searchTerm.length)) - let blockID = blockpath.slice(chartIndex + searchTerm.length) - // console.log(blockpath + '/chart_' + blockID + '/multStart') - this.$store.commit(blockpath + '/chart_' + blockID + '/clearAndSetMultStart', [this.dateStart]) - this.$store.commit(blockpath + '/chart_' + blockID + '/clearAndSetMultEnd', [this.dateEnd]) - }) + if (this.$route.path.includes('compare')) { + // Reset multStart and multEnd variables whenever you are on a comparison page for just 1 building + let buildingComparisonNumber = JSON.parse(decodeURI(this.$route.params.buildings)).length + console.log(buildingComparisonNumber) + if (buildingComparisonNumber === 1) { + for (let card of this.cards) { + if (!card.path) return + this.$nextTick(() => { + let blockpath = this.cards[0].path + let searchTerm = 'block_' + let chartIndex = blockpath.indexOf(searchTerm) + // console.log(blockpath.slice(chartIndex + searchTerm.length)) + let blockID = blockpath.slice(chartIndex + searchTerm.length) + // console.log(blockpath + '/chart_' + blockID + '/multStart') + this.$store.commit(blockpath + '/chart_' + blockID + '/clearAndSetMultStart', [this.dateStart]) + this.$store.commit(blockpath + '/chart_' + blockID + '/clearAndSetMultEnd', [this.dateEnd]) + }) + } } } } @@ -159,23 +173,25 @@ export default { this.$store.commit(card.path + '/intervalUnit', this.intervalUnit) }) } - // Reset multStart and multEnd variables whenever you are on a comparison page for just 1 building - let buildingComparisonNumber = JSON.parse(decodeURI(this.$route.params.buildings)).length - // console.log(buildingComparisonNumber) - if (this.$route.path.includes('compare') && buildingComparisonNumber === 1) { - for (let card of this.cards) { - if (!card.path) return - this.$nextTick(() => { - let blockpath = this.cards[0].path - let searchTerm = 'block_' - let chartIndex = blockpath.indexOf(searchTerm) - // console.log(blockpath.slice(chartIndex + searchTerm.length)) - let blockID = blockpath.slice(chartIndex + searchTerm.length) - // console.log(blockpath + '/chart_' + blockID + '/multStart') - this.$store.commit(blockpath + '/chart_' + blockID + '/clearAndSetMultStart', [this.dateStart]) - this.$store.commit(blockpath + '/chart_' + blockID + '/clearAndSetMultEnd', [this.dateEnd]) - // console.log(this.$store.getters) - }) + if (this.$route.path.includes('compare')) { + // Reset multStart and multEnd variables whenever you are on a comparison page for just 1 building + let buildingComparisonNumber = JSON.parse(decodeURI(this.$route.params.buildings)).length + console.log(buildingComparisonNumber) + if (buildingComparisonNumber === 1) { + for (let card of this.cards) { + if (!card.path) return + this.$nextTick(() => { + let blockpath = this.cards[0].path + let searchTerm = 'block_' + let chartIndex = blockpath.indexOf(searchTerm) + // console.log(blockpath.slice(chartIndex + searchTerm.length)) + let blockID = blockpath.slice(chartIndex + searchTerm.length) + // console.log(blockpath + '/chart_' + blockID + '/multStart') + this.$store.commit(blockpath + '/chart_' + blockID + '/clearAndSetMultStart', [this.dateStart]) + this.$store.commit(blockpath + '/chart_' + blockID + '/clearAndSetMultEnd', [this.dateEnd]) + // console.log(this.$store.getters) + }) + } } } } @@ -195,14 +211,6 @@ export default { return false } }, - otherView: { - get () { - if (this.view.path === 'view') { - return true - } - return false - } - }, view: { get () { if (this.$route.path.includes('building')) {