1
0
mirror of https://github.com/beestat/app.git synced 2025-05-24 02:14:03 -04:00

Fixed a few more minor bugs and improved usability

This commit is contained in:
Jon Ziebell 2022-08-28 06:48:56 -04:00
parent 35d4d0b1f3
commit ee6bd74295
6 changed files with 76 additions and 45 deletions

View File

@ -62,6 +62,7 @@ window.addEventListener('resize', rocket.throttle(100, function() {
600,
650,
800,
850,
1000
];

View File

@ -616,35 +616,41 @@ beestat.component.card.three_d.prototype.decorate_legend_ = function(parent) {
let units;
let min = this.get_heat_map_min_();
let max = this.get_heat_map_max_();
if (beestat.setting('visualize.data_type') === 'temperature') {
min = beestat.temperature(min);
max = beestat.temperature(max);
units = beestat.setting('temperature_unit');
} else {
min *= 100;
max *= 100;
units = '%';
if (
min !== Infinity &&
max !== -Infinity
) {
if (beestat.setting('visualize.data_type') === 'temperature') {
min = beestat.temperature(min);
max = beestat.temperature(max);
units = beestat.setting('temperature_unit');
} else {
min *= 100;
max *= 100;
units = '%';
}
const min_container = document.createElement('div');
Object.assign(min_container.style, {
'position': 'absolute',
'bottom': '0',
'right': '10px',
'font-size': beestat.style.font_size.small
});
min_container.innerText = min + units;
gradient_container.appendChild(min_container);
const max_container = document.createElement('div');
Object.assign(max_container.style, {
'position': 'absolute',
'top': '0',
'right': '10px',
'font-size': beestat.style.font_size.small
});
max_container.innerText = max + units;
gradient_container.appendChild(max_container);
}
const min_container = document.createElement('div');
Object.assign(min_container.style, {
'position': 'absolute',
'bottom': '0',
'right': '10px',
'font-size': beestat.style.font_size.small
});
min_container.innerText = min + units;
gradient_container.appendChild(min_container);
const max_container = document.createElement('div');
Object.assign(max_container.style, {
'position': 'absolute',
'top': '0',
'right': '10px',
'font-size': beestat.style.font_size.small
});
max_container.innerText = max + units;
gradient_container.appendChild(max_container);
};
/**

View File

@ -19,7 +19,7 @@ beestat.component.card.visualize_intro.prototype.decorate_contents_ = function(p
const self = this;
const p1 = document.createElement('p');
p1.innerText = 'You now have early access to the new Visualize features. This is a work-in-progress, but you should find it to be mostly stable. More features and improvements are in the works, as well as documentation and videos to help explain the new capabilities.';
p1.innerText = 'You now have early access to the new Visualize features. This is a work-in-progress, but you should find it to be mostly stable. More features and improvements are in the works.';
parent.appendChild(p1);
const p2 = document.createElement('p');

View File

@ -3,7 +3,11 @@
*/
beestat.component.card.visualize_settings = function() {
const self = this;
beestat.dispatcher.addEventListener('cache.floor_plan', function() {
beestat.dispatcher.addEventListener([
'cache.floor_plan',
'cache.data.three_d__runtime_sensor'
],
function() {
self.rerender();
});
@ -45,6 +49,16 @@ beestat.component.card.visualize_settings.prototype.decorate_contents_ = functio
const heat_map_type_container = document.createElement('div');
this.decorate_heat_map_type_(heat_map_type_container);
grid_2.appendChild(heat_map_type_container);
// If at least one sensor is on the floor plan and the data is loading.
if (
beestat.cache.data.three_d__runtime_sensor === undefined &&
Object.keys(beestat.floor_plan.get_sensor_ids_map(
beestat.setting('visualize.floor_plan_id')
)).length > 0
) {
this.show_loading_('Fetching');
}
};
/**

View File

@ -74,6 +74,14 @@ beestat.component.floor_plan.prototype.render = function(parent) {
});
parent.appendChild(this.toolbar_container_);
this.toolbar_helper_container_ = $.createElement('div');
this.toolbar_helper_container_.style({
'position': 'absolute',
'top': 55,
'left': beestat.style.size.gutter * 4
});
parent.appendChild(this.toolbar_helper_container_);
this.floors_container_ = $.createElement('div');
this.floors_container_.style({
'position': 'absolute',
@ -435,6 +443,17 @@ beestat.component.floor_plan.prototype.update_toolbar = function() {
})
);
// Helper
if (beestat.floor_plan.get_area(this.floor_plan_id_) === 0) {
new beestat.component.tile()
.set_text('Start by adding a room')
.set_shadow(false)
.set_background_color(beestat.style.color.green.base)
.set_text_color('#fff')
.set_type('pill')
.render(this.toolbar_helper_container_);
}
// Remove room
const remove_room_button = new beestat.component.tile()
.set_icon('card_remove_outline')

View File

@ -38,11 +38,11 @@ beestat.component.header.prototype.decorate_ = function(parent) {
'text': 'Analyze',
'icon': 'home_search'
},
// {
// 'layer': 'visualize',
// 'text': 'Visualize',
// 'icon': 'floor_plan'
// },
{
'layer': 'visualize',
'text': 'Visualize',
'icon': 'floor_plan'
},
{
'layer': 'compare',
'text': 'Compare',
@ -127,7 +127,7 @@ beestat.component.header.prototype.decorate_ = function(parent) {
.set_shadow(false)
.set_text_color(beestat.style.color.bluegray.dark);
if (beestat.width > 800) {
if (beestat.width > 850) {
button.set_text(page.text);
}
@ -229,15 +229,6 @@ beestat.component.header.prototype.decorate_ = function(parent) {
(new beestat.layer.settings()).render();
}));
if (beestat.user.has_early_access() === true) {
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Visualize (Early Access)')
.set_icon('floor_plan')
.set_callback(function() {
(new beestat.layer.visualize()).render();
}));
}
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Log Out')
.set_icon('exit_to_app')