@@ -11,6 +11,7 @@ import CharacterState from './CharacterState';
1111import CharacterStateSerializer from './CharacterStateSerializer' ;
1212import CharacterPositionController from './CharacterPositionController' ;
1313import CommandPaletteCommand from './CommandPaletteCommand' ;
14+ import CookieNotification from './CookieNotification' ;
1415import C2lcURLParams from './C2lcURLParams' ;
1516import DashConnectionErrorModal from './DashConnectionErrorModal' ;
1617import DashDriver from './DashDriver' ;
@@ -111,13 +112,15 @@ export type AppState = {
111112 disallowedActions : ActionToggleRegister ,
112113 keyBindingsEnabled : boolean ,
113114 keyboardInputSchemeName : KeyboardInputSchemeName ,
115+ showCookieNotification : boolean ,
114116 showKeyboardModal : boolean ,
115117 showSoundOptionsModal : boolean ,
116118 showThemeSelectorModal : boolean ,
117119 showWorldSelector : boolean ,
118120 showShareModal : boolean ,
119121 showActionsSimplificationMenu : boolean ,
120122 showPrivacyModal : boolean ,
123+ focusOnClosePrivacyModalSelector : string ,
121124 startingX : number ,
122125 startingY : number ,
123126 startingDirection : number
@@ -146,7 +149,7 @@ export class App extends React.Component<AppProps, AppState> {
146149 constructor ( props : any ) {
147150 super ( props ) ;
148151
149- this . version = '1.6' ;
152+ this . version = '1.6.1 ' ;
150153
151154 this . appContext = {
152155 bluetoothApiIsAvailable : FeatureDetection . bluetoothApiIsAvailable ( )
@@ -406,6 +409,9 @@ export class App extends React.Component<AppProps, AppState> {
406409 }
407410 ) ;
408411
412+ // Cookie Notification
413+ const showCookieNotification = ! ( window . localStorage . getItem ( 'c2lc-hasDismissedCookieNotification' ) ) ;
414+
409415 // Initialize startingX, startingY, and startingDirection to the world starting position
410416 const startingX = getWorldProperties ( this . defaultWorld ) . startingX ;
411417 const startingY = getWorldProperties ( this . defaultWorld ) . startingY ;
@@ -434,13 +440,15 @@ export class App extends React.Component<AppProps, AppState> {
434440 runningState : 'stopped' ,
435441 disallowedActions : { } ,
436442 keyBindingsEnabled : false ,
443+ showCookieNotification : showCookieNotification ,
437444 showKeyboardModal : false ,
438445 showSoundOptionsModal : false ,
439446 showThemeSelectorModal : false ,
440447 showWorldSelector : false ,
441448 showShareModal : false ,
442449 showActionsSimplificationMenu : false ,
443450 showPrivacyModal : false ,
451+ focusOnClosePrivacyModalSelector : '' ,
444452 startingX : startingX ,
445453 startingY : startingY ,
446454 startingDirection : startingDirection ,
@@ -529,6 +537,20 @@ export class App extends React.Component<AppProps, AppState> {
529537
530538 // Handlers
531539
540+ handleCookieNotificationDismiss = ( ) => {
541+ window . localStorage . setItem ( 'c2lc-hasDismissedCookieNotification' , true ) ;
542+ this . setState ( {
543+ showCookieNotification : false
544+ } ) ;
545+ } ;
546+
547+ handleCookieNotificationLearnMore = ( ) => {
548+ this . setState ( {
549+ showPrivacyModal : true ,
550+ focusOnClosePrivacyModalSelector : '.CookieNotification__learnMoreButton'
551+ } ) ;
552+ } ;
553+
532554 handleProgramSequenceChange = ( programSequence : ProgramSequence ) => {
533555 this . setState ( {
534556 programSequence : programSequence
@@ -1349,7 +1371,10 @@ export class App extends React.Component<AppProps, AppState> {
13491371 }
13501372
13511373 handleClickPrivacyButton = ( ) = > {
1352- this . setState ( { showPrivacyModal : true } ) ;
1374+ this . setState ( {
1375+ showPrivacyModal : true ,
1376+ focusOnClosePrivacyModalSelector : '.App__PrivacyModal__toggle-button'
1377+ } ) ;
13531378 }
13541379
13551380 handleClosePrivacyModal = ( ) = > {
@@ -1365,6 +1390,14 @@ export class App extends React.Component<AppProps, AppState> {
13651390 role = 'main'
13661391 onClick = { this . handleRootClick }
13671392 onKeyDown = { this . handleRootKeyDown } >
1393+ < div className = 'App__notificationArea' >
1394+ { this . state . showCookieNotification &&
1395+ < CookieNotification
1396+ onDismiss = { this . handleCookieNotificationDismiss }
1397+ onLearnMore = { this . handleCookieNotificationLearnMore }
1398+ />
1399+ }
1400+ </ div >
13681401 < header className = 'App__header' >
13691402 < div className = 'App__header-row' >
13701403 < h1 className = 'App__logo-container' >
@@ -1657,6 +1690,7 @@ export class App extends React.Component<AppProps, AppState> {
16571690 />
16581691 < PrivacyModal
16591692 show = { this . state . showPrivacyModal }
1693+ focusOnCloseSelector = { this . state . focusOnClosePrivacyModalSelector }
16601694 onClose = { this . handleClosePrivacyModal }
16611695 />
16621696 </ React . Fragment >
0 commit comments