11// Libraries
2- import React , { FC , useEffect , useCallback } from 'react'
2+ import React , { FC , useCallback , useContext , useEffect } from 'react'
33import { connect , ConnectedProps } from 'react-redux'
4- import { withRouter , RouteComponentProps } from 'react-router-dom'
4+ import { RouteComponentProps , withRouter } from 'react-router-dom'
55
66// Components
77import AutoRefreshDropdown from 'src/shared/components/dropdown_auto_refresh/AutoRefreshDropdown'
88import TimeRangeDropdown from 'src/shared/components/TimeRangeDropdown'
9- import PresentationModeToggle from 'src/shared/components/PresentationModeToggle'
109import DashboardLightModeToggle from 'src/dashboards/components/DashboardLightModeToggle'
1110import GraphTips from 'src/shared/components/graph_tips/GraphTips'
1211import RenamablePageTitle from 'src/pageLayout/components/RenamablePageTitle'
1312import TimeZoneDropdown from 'src/shared/components/TimeZoneDropdown'
1413import {
14+ Appearance ,
1515 Button ,
16- IconFont ,
1716 ComponentColor ,
18- Page ,
19- Appearance ,
17+ Dropdown ,
18+ FlexBox ,
19+ IconFont ,
2020 InputLabel ,
2121 InputToggleType ,
22+ JustifyContent ,
23+ Page ,
2224 Toggle ,
2325} from '@influxdata/clockface'
2426import { AnnotationsControlBarToggleButton } from 'src/annotations/components/AnnotationsControlBarToggleButton'
@@ -27,16 +29,16 @@ import {AnnotationsControlBarToggleButton} from 'src/annotations/components/Anno
2729import { toggleShowVariablesControls as toggleShowVariablesControlsAction } from 'src/userSettings/actions'
2830import { updateDashboard as updateDashboardAction } from 'src/dashboards/actions/thunks'
2931import {
30- setAutoRefreshStatus as setAutoRefreshStatusAction ,
3132 resetDashboardAutoRefresh as resetDashboardAutoRefreshAction ,
33+ setAutoRefreshStatus as setAutoRefreshStatusAction ,
3234} from 'src/shared/actions/autoRefresh'
3335import {
3436 setDashboardTimeRange as setDashboardTimeRangeAction ,
3537 updateQueryParams as updateQueryParamsAction ,
3638} from 'src/dashboards/actions/ranges'
3739import {
38- showOverlay as showOverlayAction ,
3940 dismissOverlay as dismissOverlayAction ,
41+ showOverlay as showOverlayAction ,
4042} from 'src/overlays/actions/overlays'
4143
4244// Utils
@@ -52,10 +54,12 @@ import {getOrg} from 'src/organizations/selectors'
5254// Constants
5355import { DemoDataDashboardNames } from 'src/cloud/constants'
5456import {
55- DEFAULT_DASHBOARD_NAME ,
5657 DASHBOARD_NAME_MAX_LENGTH ,
58+ DEFAULT_DASHBOARD_NAME ,
5759} from 'src/dashboards/constants/index'
5860
61+ import './DashboardHeader.scss'
62+
5963// Types
6064import {
6165 AppState ,
@@ -65,6 +69,7 @@ import {
6569 ResourceType ,
6670 TimeRange ,
6771} from 'src/types'
72+ import { AppSettingContext } from '../../shared/contexts/app'
6873
6974interface OwnProps {
7075 autoRefresh : AutoRefresh
@@ -143,6 +148,8 @@ const DashboardHeader: FC<Props> = ({
143148 const isActive =
144149 autoRefresh ?. status && autoRefresh . status === AutoRefreshStatus . Active
145150
151+ const { setPresentationMode, presentationMode} = useContext ( AppSettingContext )
152+
146153 return (
147154 < >
148155 < Page . Header fullWidth = { true } >
@@ -176,6 +183,7 @@ const DashboardHeader: FC<Props> = ({
176183 checked = { showVariablesControls }
177184 testID = "variables--button"
178185 onChange = { toggleShowVariablesControls }
186+ className = "control_buttons_collapsible"
179187 >
180188 < InputLabel
181189 htmlFor = "variables--button"
@@ -185,9 +193,68 @@ const DashboardHeader: FC<Props> = ({
185193 Show Variables
186194 </ InputLabel >
187195 </ Toggle >
188- < AnnotationsControlBarToggleButton />
189- < DashboardLightModeToggle />
190- < PresentationModeToggle />
196+ < AnnotationsControlBarToggleButton className = "control_buttons_collapsible" />
197+
198+ < Dropdown
199+ style = { { width : '40px' } }
200+ button = { ( active , onClick ) => (
201+ < Button
202+ icon = { IconFont . More }
203+ onClick = { onClick }
204+ active = { active }
205+ testID = "collapsible_menu"
206+ />
207+ ) }
208+ menu = { ( ) => (
209+ < Dropdown . Menu style = { { width : '200px' } } >
210+ < Toggle
211+ id = "variables--button"
212+ type = { InputToggleType . Checkbox }
213+ fill = { Appearance . Solid }
214+ titleText = "Variables"
215+ checked = { showVariablesControls }
216+ testID = "variables--button"
217+ onChange = { toggleShowVariablesControls }
218+ style = { { marginBottom : '8px' } }
219+ className = "control_buttons_in_collapsed_menu"
220+ >
221+ < InputLabel
222+ htmlFor = "variables--button"
223+ active = { showVariablesControls }
224+ style = { { fontWeight : 500 } }
225+ >
226+ Show Variables
227+ </ InputLabel >
228+ </ Toggle >
229+ < AnnotationsControlBarToggleButton className = "control_buttons_in_collapsed_menu" />
230+ < Toggle
231+ id = "toggle_presentation"
232+ type = { InputToggleType . Checkbox }
233+ onChange = { ( ) => {
234+ setPresentationMode ( true )
235+ } }
236+ fill = { Appearance . Solid }
237+ style = { { marginTop : '8px' } }
238+ testID = "presentation-mode-toggle"
239+ checked = { presentationMode }
240+ >
241+ < InputLabel
242+ active = { presentationMode }
243+ style = { { fontWeight : 500 } }
244+ htmlFor = "toggle_presentation"
245+ >
246+ Presentation Mode
247+ </ InputLabel >
248+ </ Toggle >
249+ < FlexBox
250+ justifyContent = { JustifyContent . Center }
251+ style = { { marginTop : '8px' } }
252+ >
253+ < DashboardLightModeToggle />
254+ </ FlexBox >
255+ </ Dropdown . Menu >
256+ ) }
257+ />
191258 < GraphTips />
192259 </ Page . ControlBarLeft >
193260 < Page . ControlBarRight >
0 commit comments