Skip to content

Commit

Permalink
massNav is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
xzhou82 committed Dec 17, 2024
1 parent 1ec84a9 commit 49f497f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion client/mass/about.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { getProfileLogin } from '../plots/profilePlot.js'
- server info
*/

const cohortTableActiveColor = 'yellow'

// this type is fully defined in MassNav def in dataset.ts but not in a form that can extract "about" config to share. thus need to repeat here to avoid tsc err
type AboutObj = {
html: string
Expand Down Expand Up @@ -258,7 +260,7 @@ export class MassAbout {
}
}
const activeColumns = this.dom.cohortTable.selectAll(selector)
const color = state.termdbConfig.massNav.activeColor || 'yellow'
const color = state.termdbConfig.massNav?.activeColor || cohortTableActiveColor
activeColumns.style('background-color', color)
}

Expand Down
4 changes: 3 additions & 1 deletion client/mass/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ nav {}
todo: steps to add a new tab
*/

const navTabActiveColor = '#ececec' // default active color of nav tab

// to be used for assigning unique
// radio button names by object instance
// otherwise termdp app popups
Expand Down Expand Up @@ -428,7 +430,7 @@ function setRenderers(self) {
.style('color', d => (d.colNum == self.activeTab ? '#000' : 'gray'))
.style('background-color', d =>
d.colNum == self.activeTab && self.dom.subheaderDiv.style('display') != 'none'
? self.state.termdbConfig.massNav.activeColor || '#ececec'
? self.state.termdbConfig.massNav?.activeColor || navTabActiveColor
: 'transparent'
)
.html(function (d, i) {
Expand Down
1 change: 1 addition & 0 deletions shared/types/src/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,7 @@ type MassNav = {
}
}
}
/** customize background color of active navigation tab */
activeColor?: string
}

Expand Down

0 comments on commit 49f497f

Please sign in to comment.