@expofp/floorplan
Version:
Interactive floor plan library for expos and events
2 lines (1 loc) • 1.87 kB
JavaScript
import{__decorate as r}from"tslib";import{computed as i}from"mobx";import{BaseSubButtonProvider as n}from"../SubButtonProvider";export class SessionsSubButtonProvider extends n{constructor(t){super(),this.rootStore=t,this.id="sessions"}get computedSubButtons(){const t=[];return t.push({id:"sessions_show_all",label:"All Tracks",text:"All Tracks",enabled:!0,active:this.rootStore.searchButtonsStore.activeSubButtonId==="sessions_show_all"||!this.rootStore.searchButtonsStore.activeSubButtonId&&!this.rootStore.uiState.selectedTrack,parentButtonId:"sessions",type:"show_all",onClick:()=>this.handleSessionsShowAllClick()}),this.rootStore.eventStore.tracks.forEach(s=>{const e=this.rootStore.eventStore.getEventsByTrack(s.id).length;t.push({id:`sessions_track_${s.id}`,label:s.name,text:s.name,enabled:!0,active:this.rootStore.searchButtonsStore.activeSubButtonId===`sessions_track_${s.id}`,parentButtonId:"sessions",type:"track",data:s,count:e,onClick:()=>this.handleSessionsTrackClick(s)})}),t}createSubButtons(){return this.computedSubButtons}handleSubButtonClick(t){if(t==="sessions_show_all")this.handleSessionsShowAllClick();else if(t.startsWith("sessions_track_")){const s=parseInt(t.replace("sessions_track_","")),e=this.rootStore.eventStore.tracks.find(o=>o.id===s);e&&this.handleSessionsTrackClick(e)}}shouldShowSubButtons(){return this.rootStore.eventStore.tracks.length>0}handleSessionsShowAllClick(){this.rootStore.uiState.list={type:"sessions",text:"",focused:!1},this.rootStore.uiState.selectedTrack=null,this.rootStore.searchButtonsStore.setSubButtonId("sessions_show_all")}handleSessionsTrackClick(t){this.rootStore.uiState.list={type:"sessions",text:"",focused:!1},this.rootStore.uiState.selectedTrack=t,this.rootStore.searchButtonsStore.setSubButtonId(`sessions_track_${t.id}`)}}r([i],SessionsSubButtonProvider.prototype,"computedSubButtons",null);