@@ -11,7 +11,10 @@ import classNames from 'classnames';
1111import { Localized } from '@fluent/react' ;
1212
1313import explicitConnect from 'firefox-profiler/utils/connect' ;
14- import { getProfileRootRange } from 'firefox-profiler/selectors/profile' ;
14+ import {
15+ getProfileRootRange ,
16+ getOverriddenZeroAtTimestamp ,
17+ } from 'firefox-profiler/selectors/profile' ;
1518import {
1619 getDataSource ,
1720 getProfileUrl ,
@@ -36,6 +39,7 @@ import {
3639 dismissNewlyPublished ,
3740 profileRemotelyDeleted ,
3841} from 'firefox-profiler/actions/app' ;
42+ import { overrideZeroAt } from 'firefox-profiler/actions/profile-view' ;
3943
4044import {
4145 getAbortFunction ,
@@ -72,12 +76,14 @@ type StateProps = {
7276 readonly hasPrePublishedState : boolean ;
7377 readonly abortFunction : ( ) => void ;
7478 readonly currentProfileUploadedInformation : UploadedProfileInformation | null ;
79+ readonly getOverriddenZeroAtTimestamp : string | null ;
7580} ;
7681
7782type DispatchProps = {
7883 readonly dismissNewlyPublished : typeof dismissNewlyPublished ;
7984 readonly revertToPrePublishedState : typeof revertToPrePublishedState ;
8085 readonly profileRemotelyDeleted : typeof profileRemotelyDeleted ;
86+ readonly overrideZeroAt : typeof overrideZeroAt ;
8187} ;
8288
8389type Props = ConnectedProps < OwnProps , StateProps , DispatchProps > ;
@@ -130,6 +136,11 @@ class MenuButtonsImpl extends React.PureComponent<Props, State> {
130136 } ) ;
131137 } ;
132138
139+ _showZeroAtMenu = ( ) => {
140+ const { overrideZeroAt } = this . props ;
141+ overrideZeroAt ( null ) ;
142+ } ;
143+
133144 _renderUploadedProfileActions (
134145 currentProfileUploadedInformation : UploadedProfileInformation
135146 ) {
@@ -309,6 +320,34 @@ class MenuButtonsImpl extends React.PureComponent<Props, State> {
309320 ) : null ;
310321 }
311322
323+ _renderZeroAt ( ) {
324+ const { getOverriddenZeroAtTimestamp } = this . props ;
325+ if ( getOverriddenZeroAtTimestamp === null ) {
326+ return null ;
327+ }
328+
329+ return (
330+ < button
331+ type = "button"
332+ className = "menuButtonsButton menuButtonsButton-hasIcon menuButtonsResetZeroAtButton"
333+ onClick = { this . _showZeroAtMenu }
334+ >
335+ < Localized
336+ id = "MenuButtons--zero-at"
337+ attrs = { { title : true } }
338+ vars = { { zeroAt : getOverriddenZeroAtTimestamp } }
339+ elems = { {
340+ span : < span className = "menuButtonsZeroAtTimestamp" /> ,
341+ } }
342+ >
343+ < >
344+ Zero at < span > { getOverriddenZeroAtTimestamp } </ span >
345+ </ >
346+ </ Localized >
347+ </ button >
348+ ) ;
349+ }
350+
312351 _renderRevertProfile ( ) {
313352 const { hasPrePublishedState, revertToPrePublishedState } = this . props ;
314353 if ( ! hasPrePublishedState ) {
@@ -330,6 +369,7 @@ class MenuButtonsImpl extends React.PureComponent<Props, State> {
330369 override render ( ) {
331370 return (
332371 < >
372+ { this . _renderZeroAt ( ) }
333373 { this . _renderRevertProfile ( ) }
334374 { this . _renderMetaInfoButton ( ) }
335375 { this . _renderPublishPanel ( ) }
@@ -360,11 +400,13 @@ export const MenuButtons = explicitConnect<OwnProps, StateProps, DispatchProps>(
360400 abortFunction : getAbortFunction ( state ) ,
361401 currentProfileUploadedInformation :
362402 getCurrentProfileUploadedInformation ( state ) ,
403+ getOverriddenZeroAtTimestamp : getOverriddenZeroAtTimestamp ( state ) ,
363404 } ) ,
364405 mapDispatchToProps : {
365406 dismissNewlyPublished,
366407 revertToPrePublishedState,
367408 profileRemotelyDeleted,
409+ overrideZeroAt,
368410 } ,
369411 component : MenuButtonsImpl ,
370412 }
0 commit comments