Skip to content

Commit

Permalink
Merge pull request #1614 from NicoPennec/main
Browse files Browse the repository at this point in the history
Fix navigation
  • Loading branch information
frankrousseau authored Dec 16, 2024
2 parents 5170027 + d8f0dfb commit 1513755
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 52 deletions.
49 changes: 2 additions & 47 deletions src/components/tops/Topbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,8 @@ export default {
configureProduction(routeProductionId, routeEpisodeId = undefined) {
this.setProduction(routeProductionId)
this.currentProductionId = routeProductionId
this.currentEpisodeId = null
this.clearEpisodes()
if (this.isTVShow) {
this.loadEpisodes()
.then(episodes => {
Expand All @@ -644,7 +646,6 @@ export default {
})
.catch(console.error)
} else {
this.clearEpisodes()
this.updateCombosFromRoute()
}
},
Expand Down Expand Up @@ -764,52 +765,6 @@ export default {
route.name = this.isCurrentUserClient ? 'playlists' : 'assets'
}
return route
},
resetEpisodeForTVShow(soft = false) {
// TODO seems deprecated
const section =
this.currentProjectSection || this.getCurrentSectionFromRoute()
const isEditSection = this.editSections.includes(section)
const isShotSection = this.shotSections.includes(section)
const isAssetEpisode = ['all', 'main'].includes(this.currentEpisodeId)
const production = this.productionMap.get(this.currentProductionId)
if (!production) return
const isTVShow = production.production_type === 'tvshow'
if (isAssetEpisode) {
// It's an asset episode. We have to switch if we are in a shot
// section.
if (isShotSection) {
// Set current episode to first episode if it's a shot section.
this.currentEpisodeId =
this.episodes.length > 0 ? this.episodes[0].id : null
}
}
// If no episode is set and we are in a tv show, select the first one.
if (isTVShow) {
// It's an asset section, and episode is not set, we chose all
if (isEditSection && !this.currentEpisodeId) {
this.currentEpisodeId = 'all'
this.setCurrentEpisode(this.currentEpisodeId)
// It's a shot section, and episode is not set, we chose the first
// one.
} else if (!this.currentEpisode) {
if (!this.currentEpisodeId) {
if (this.episodes.length > 0) {
this.currentEpisodeId = this.episodes[0].id
} else {
this.currentEpisodeId = production.first_episode_id
}
}
this.setCurrentEpisode(this.currentEpisodeId)
} else if (!this.currentEpisodeId && this.currentEpisode) {
this.currentEpisodeId = this.currentEpisode.id
}
} else {
this.currentEpisodeId = null
}
}
},
Expand Down
8 changes: 3 additions & 5 deletions src/store/modules/episodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -565,11 +565,9 @@ const mutations = {
},

[SET_CURRENT_EPISODE](state, episodeId) {
if (episodeId) {
if (episodeId === 'main') {
state.currentEpisode = { id: 'main' }
} else if (episodeId === 'all') {
state.currentEpisode = { id: 'all' }
if (episodeId && episodeId !== state.currentEpisode?.id) {
if (['all', 'main'].includes(episodeId)) {
state.currentEpisode = { id: episodeId }
} else {
state.currentEpisode = cache.episodeMap.get(episodeId)
}
Expand Down

0 comments on commit 1513755

Please sign in to comment.