|
112 | 112 | toggleNav() { |
113 | 113 | this.$emit('toggleSideNav'); |
114 | 114 | }, |
| 115 | + pageIsActive(pageName) { |
| 116 | + return this.topLevelPageName === pageName; |
| 117 | + }, |
115 | 118 | }, |
116 | 119 | computed: { |
117 | 120 | closeStyle() { |
|
147 | 150 | ariaLabel() { |
148 | 151 | return this.$tr('navigationLabel'); |
149 | 152 | }, |
150 | | - learnActive() { |
151 | | - return this.topLevelPageName === TopLevelPageNames.LEARN; |
152 | | - }, |
153 | | - coachActive() { |
154 | | - return this.topLevelPageName === TopLevelPageNames.COACH; |
155 | | - }, |
156 | | - manageActive() { |
157 | | - return this.topLevelPageName === TopLevelPageNames.MANAGE; |
158 | | - }, |
159 | | - profileActive() { |
160 | | - return this.topLevelPageName === TopLevelPageNames.PROFILE; |
161 | | - }, |
162 | | - aboutActive() { |
163 | | - return this.topLevelPageName === TopLevelPageNames.ABOUT; |
164 | | - }, |
165 | 153 | menuOptions() { |
166 | 154 | const options = [ |
167 | 155 | { |
168 | 156 | label: this.$tr('learn'), |
169 | | - active: this.learnActive, |
| 157 | + active: this.pageIsActive(TopLevelPageNames.LEARN), |
170 | 158 | icon: 'school', |
171 | 159 | href: '/learn', |
172 | 160 | }, |
173 | 161 | ]; |
174 | 162 | if (this.isAdmin || this.isSuperuser || this.isCoach) { |
175 | 163 | options.push({ |
176 | 164 | label: this.$tr('coach'), |
177 | | - active: this.coachActive, |
| 165 | + active: this.pageIsActive(TopLevelPageNames.COACH), |
178 | 166 | icon: 'assessment', |
179 | 167 | href: '/coach', |
180 | 168 | }); |
181 | 169 | } |
182 | 170 | if (this.isAdmin || this.isSuperuser) { |
183 | 171 | options.push({ |
184 | 172 | label: this.$tr('manage'), |
185 | | - active: this.manageActive, |
| 173 | + active: this.pageIsActive(TopLevelPageNames.MANAGE), |
186 | 174 | icon: 'people', |
187 | 175 | href: '/management', |
188 | 176 | }); |
|
191 | 179 | if (this.isUserLoggedIn) { |
192 | 180 | options.push({ |
193 | 181 | label: this.$tr('profile'), |
194 | | - active: this.profileActive, |
| 182 | + active: this.pageIsActive(TopLevelPageNames.USER), |
195 | 183 | icon: 'account_circle', |
196 | 184 | href: '/user', |
197 | 185 | }); |
|
0 commit comments