@@ -141,10 +141,10 @@ export function createMockUserToken(
141141 ] . join ( '.' ) ;
142142}
143143
144- interface EmulatorStatuses {
144+ interface EmulatorStatusMap {
145145 [ name : string ] : boolean ;
146146}
147- const emulatorStatus : EmulatorStatuses = { } ;
147+ const emulatorStatus : EmulatorStatusMap = { } ;
148148
149149interface EmulatorSummary {
150150 prod : string [ ] ;
@@ -197,6 +197,10 @@ export function updateEmulatorBanner(
197197 }
198198
199199 emulatorStatus [ name ] = isRunningEmulator ;
200+
201+ function prefixedId ( id : string ) {
202+ return `__firebase__banner__${ id } ` ;
203+ }
200204 const bannerId = '__firebase__banner' ;
201205 const summary = getEmulatorSummary ( ) ;
202206 const showError = summary . prod . length > 0 ;
@@ -210,9 +214,17 @@ export function updateEmulatorBanner(
210214
211215 function setupDom ( ) : void {
212216 const banner = getOrCreateEl ( bannerId ) ;
217+ const firebaseTextId = prefixedId ( 'text' ) ;
213218 const firebaseText : HTMLSpanElement =
214- document . getElementById ( '__firebase__text' ) ||
215- document . createElement ( 'span' ) ;
219+ document . getElementById ( firebaseTextId ) || document . createElement ( 'span' ) ;
220+ const learnMoreId = prefixedId ( 'learnmore' ) ;
221+ const learnMoreLink : HTMLAnchorElement =
222+ ( document . getElementById ( learnMoreId ) as HTMLAnchorElement ) ||
223+ document . createElement ( 'a' ) ;
224+ const prependIconId = prefixedId ( 'preprendIcon' ) ;
225+ const prependIcon =
226+ document . getElementById ( prependIconId ) ||
227+ document . createElementNS ( 'http://www.w3.org/2000/svg' , 'svg' ) ;
216228 if ( banner . created ) {
217229 // update styles
218230 const bannerEl = banner . element ;
@@ -231,19 +243,45 @@ export function updateEmulatorBanner(
231243 closeBtn . onclick = ( ) => {
232244 tearDown ( ) ;
233245 } ;
246+ learnMoreLink . setAttribute ( 'id' , learnMoreId ) ;
247+ learnMoreLink . href =
248+ 'http://firebase.google.com/docs/studio/deploy-app#emulator ' ;
249+ bannerEl . appendChild ( prependIcon ) ;
234250 bannerEl . appendChild ( firebaseText ) ;
251+ bannerEl . appendChild ( learnMoreLink ) ;
235252 bannerEl . appendChild ( closeBtn ) ;
253+ prependIcon . setAttribute ( 'width' , '24' ) ;
254+ prependIcon . setAttribute ( 'id' , prependIconId ) ;
255+ prependIcon . setAttribute ( 'height' , '24' ) ;
256+ prependIcon . setAttribute ( 'viewBox' , '0 0 24 24' ) ;
257+ prependIcon . setAttribute ( 'fill' , 'none' ) ;
236258 document . body . appendChild ( bannerEl ) ;
237259 }
260+
238261 if ( showError ) {
239- banner . element . style . background = '#cd5c5c' ;
240- firebaseText . innerText = `Product${
241- summary . prod . length > 0 ? 's' : ''
242- } Running in Production: ${ summary . prod . join ( ', ' ) } `;
262+ firebaseText . innerText = `Running in Production` ;
263+ prependIcon . innerHTML = `<g clip-path="url(#clip0_6013_33858)">
264+ <path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
265+ </g>
266+ <defs>
267+ <clipPath id="clip0_6013_33858">
268+ <rect width="24" height="24" fill="white"/>
269+ </clipPath>
270+ </defs>` ;
243271 } else {
244- firebaseText . innerText = 'Running in this workspace' ;
272+ prependIcon . innerHTML = `<g clip-path="url(#clip0_6083_34804)">
273+ <path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>
274+ </g>
275+ <defs>
276+ <clipPath id="clip0_6083_34804">
277+ <rect width="24" height="24" fill="white"/>
278+ </clipPath>
279+ </defs>` ;
280+ firebaseText . innerText = 'Using emulated backend' ;
281+ learnMoreLink . href =
282+ 'https://firebase.google.com/docs/studio/solution-build-with-ai' ;
245283 }
246- firebaseText . setAttribute ( 'id' , '__firebase__text' ) ;
284+ firebaseText . setAttribute ( 'id' , firebaseTextId ) ;
247285 }
248286 if ( document . readyState === 'loading' ) {
249287 window . addEventListener ( 'DOMContentLoaded' , setupDom ) ;
0 commit comments