mirror of
				https://github.com/beestat/app.git
				synced 2025-10-31 10:07:01 -04:00 
			
		
		
		
	Added rough no thermostats landing layer
This commit is contained in:
		
							parent
							
								
									3abcb2c064
								
							
						
					
					
						commit
						7ad81e5874
					
				| @ -183,6 +183,11 @@ beestat.component.header.prototype.decorate_logo_ = function(parent) { | ||||
|  * @param {rocket.Elements} parent | ||||
|  */ | ||||
| beestat.component.header.prototype.decorate_navigation_ = function(parent) { | ||||
|   // Disable navigation if you have no thermostats.
 | ||||
|   if (Object.keys(beestat.cache.thermostat).length === 0) { | ||||
|     return; | ||||
|   } | ||||
| 
 | ||||
|   const self = this; | ||||
| 
 | ||||
|   const pages = [ | ||||
| @ -404,12 +409,14 @@ beestat.component.header.prototype.decorate_menu_ = function(parent) { | ||||
|   } | ||||
|   menu.add_menu_item(announcements_menu_item); | ||||
| 
 | ||||
|   if (Object.keys(beestat.cache.thermostat).length > 0) { | ||||
|     menu.add_menu_item(new beestat.component.menu_item() | ||||
|       .set_text('Download Data') | ||||
|       .set_icon('download') | ||||
|       .set_callback(function() { | ||||
|         (new beestat.component.modal.download_data()).render(); | ||||
|       })); | ||||
|   } | ||||
| 
 | ||||
|   menu.add_menu_item(new beestat.component.menu_item() | ||||
|     .set_text('Settings') | ||||
|  | ||||
| @ -67,6 +67,7 @@ if($setting->get('environment') === 'dev' || $setting->get('environment') === 'd | ||||
|   echo '<script src="/js/layer/air_quality.js"></script>' . PHP_EOL; | ||||
|   echo '<script src="/js/layer/visualize.js"></script>' . PHP_EOL; | ||||
|   echo '<script src="/js/layer/contribute.js"></script>' . PHP_EOL; | ||||
|   echo '<script src="/js/layer/no_thermostats.js"></script>' . PHP_EOL; | ||||
| 
 | ||||
|   // Component
 | ||||
|   echo '<script src="/js/component.js"></script>' . PHP_EOL; | ||||
|  | ||||
| @ -154,6 +154,12 @@ beestat.layer.load.prototype.decorate_ = function(parent) { | ||||
|     beestat.cache.set('runtime_thermostat_summary', response.runtime_thermostat_summary); | ||||
|     beestat.cache.set('stripe_event', response.stripe_event); | ||||
| 
 | ||||
|     // Send you to the no thermostats layer if none were returned.
 | ||||
|     if(Object.keys(response.thermostat).length === 0) { | ||||
|       (new beestat.layer.no_thermostats()).render(); | ||||
|       return; | ||||
|     } | ||||
| 
 | ||||
|     // Set the active thermostat_id if this is your first time visiting.
 | ||||
|     if (beestat.setting('thermostat_id') === undefined) { | ||||
|       beestat.setting( | ||||
|  | ||||
							
								
								
									
										42
									
								
								js/layer/no_thermostats.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								js/layer/no_thermostats.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,42 @@ | ||||
| /** | ||||
|  * No thermostats layer. | ||||
|  */ | ||||
| beestat.layer.no_thermostats = function() { | ||||
|   beestat.layer.apply(this, arguments); | ||||
| }; | ||||
| beestat.extend(beestat.layer.no_thermostats, beestat.layer); | ||||
| 
 | ||||
| beestat.layer.no_thermostats.prototype.decorate_ = function(parent) { | ||||
|   /* | ||||
|    * Set the overflow on the body so the scrollbar is always present so | ||||
|    * highcharts graphs render properly. | ||||
|    */ | ||||
|   $('body').style({ | ||||
|     'overflow-y': 'scroll', | ||||
|     'background': beestat.style.color.bluegray.light, | ||||
|     'padding': '0 ' + beestat.style.size.gutter + 'px' | ||||
|   }); | ||||
| 
 | ||||
|   (new beestat.component.header('no_thermostats')).render(parent); | ||||
| 
 | ||||
|   // All the cards
 | ||||
|   const cards = []; | ||||
| 
 | ||||
|   // Manage Thermostats
 | ||||
|   cards.push([ | ||||
|     { | ||||
|       'card': new beestat.component.card.manage_thermostats(), | ||||
|       'size': 12 | ||||
|     } | ||||
|   ]); | ||||
| 
 | ||||
|   // Footer
 | ||||
|   cards.push([ | ||||
|     { | ||||
|       'card': new beestat.component.card.footer(), | ||||
|       'size': 12 | ||||
|     } | ||||
|   ]); | ||||
| 
 | ||||
|   (new beestat.component.layout(cards)).render(parent); | ||||
| }; | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user