@@ -71,6 +71,38 @@ const redirectToNewGame = (data) => (_dispatch, getState) => {
7171 }
7272} ;
7373
74+ const deployBannerId = 'cb-deploy-handoff-banner' ;
75+
76+ const renderDeployBanner = ( text , backgroundColor = '#2f3747' ) => {
77+ const existing = document . getElementById ( deployBannerId ) ;
78+ const el = existing || document . createElement ( 'div' ) ;
79+
80+ el . id = deployBannerId ;
81+ el . textContent = text ;
82+ el . style . position = 'fixed' ;
83+ el . style . top = '0' ;
84+ el . style . left = '0' ;
85+ el . style . right = '0' ;
86+ el . style . zIndex = '2000' ;
87+ el . style . padding = '8px 12px' ;
88+ el . style . textAlign = 'center' ;
89+ el . style . fontSize = '14px' ;
90+ el . style . color = '#ffffff' ;
91+ el . style . backgroundColor = backgroundColor ;
92+
93+ if ( ! existing ) {
94+ document . body . appendChild ( el ) ;
95+ }
96+ } ;
97+
98+ const removeDeployBanner = ( ) => {
99+ const existing = document . getElementById ( deployBannerId ) ;
100+
101+ if ( existing ) {
102+ existing . remove ( ) ;
103+ }
104+ } ;
105+
74106const initPresence = ( followId ) => ( dispatch ) => {
75107 channel = new Channel ( 'main' , {
76108 ...getUserStateByPath ( ) ,
@@ -109,6 +141,25 @@ const initPresence = (followId) => (dispatch) => {
109141 ( data ) => {
110142 camelizeKeysAndDispatch ( dispatch , actions . changeTournamentState ) ( data ) ;
111143 } ,
144+ ) . addListener (
145+ channelTopics . deployHandoffStarted ,
146+ ( ) => {
147+ renderDeployBanner ( 'Deploy in progress. Reconnecting game session...' ) ;
148+ } ,
149+ ) . addListener (
150+ channelTopics . deployHandoffDone ,
151+ ( ) => {
152+ renderDeployBanner ( 'Deploy finished. Syncing latest session...' , '#3a8b3a' ) ;
153+ setTimeout ( ( ) => {
154+ removeDeployBanner ( ) ;
155+ window . location . reload ( ) ;
156+ } , 1200 ) ;
157+ } ,
158+ ) . addListener (
159+ channelTopics . deployHandoffFailed ,
160+ ( ) => {
161+ renderDeployBanner ( 'Deploy handoff incomplete. Reconnecting...' , '#b34d4d' ) ;
162+ } ,
112163 ) ;
113164} ;
114165
0 commit comments