Skip to content

Commit

Permalink
Live stats, front-end
Browse files Browse the repository at this point in the history
  • Loading branch information
veniware committed Jun 30, 2024
1 parent e7279ee commit 7e60e4c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Protest/Front/deviceview.js
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ class DeviceView extends View {
const json = JSON.parse(event.data);

if (json.info) {
this.CreateInfo(json.info);
this.CreateInfo(json.info, json.source);
}
else if (json.warning) {
this.CreateWarning(json.warning);
Expand Down Expand Up @@ -986,6 +986,9 @@ class DeviceView extends View {
if (found) {
LOADER.OpenUserByFile(found);
}
else {
this.ConfirmBox("User don't exist in users list", true, "mono/user.svg");
}
};
}
};
Expand Down
2 changes: 1 addition & 1 deletion Protest/Front/userview.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class UserView extends View {
const json = JSON.parse(event.data);

if (json.info) {
this.CreateInfo(json.info);
this.CreateInfo(json.info, json.source);
}
else if (json.warning) {
this.CreateWarning(json.warning);
Expand Down
17 changes: 16 additions & 1 deletion Protest/Front/view.css
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ button.view-live-button:active {
.view-warning-box {
font-weight: 600;
margin: 0 0 4px 0;
padding: 6px 0px 6px 36px;
padding: 6px 0 6px 36px;
border-radius: 4px;
background-position: 4px center;
background-size: 24px 24px;
Expand All @@ -622,6 +622,21 @@ button.view-live-button:active {
background-image: url(mono/warning.svg);
}

.view-info-box[source]::before,
.view-warning-box[source]::before { /*source*/
content: attr(source);
right: 8px;
width: 80px;
color: var(--clr-dark);
background-color: #c0c0c0;
border-radius: 4px;
padding: 0 4px;
margin: 0 8px 0 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.view-side-tools {
position: absolute;
left: 4px;
Expand Down
6 changes: 4 additions & 2 deletions Protest/Front/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,18 +411,20 @@ class View extends Window {
};
}

CreateInfo(text) {
CreateInfo(text, source) {
const info = document.createElement("div");
info.className = "view-info-box";
info.textContent = text;
info.setAttribute("source", source);
this.liveB.append(info);
return info;
}

CreateWarning(text) {
CreateWarning(text, source) {
const warning = document.createElement("div");
warning.className = "view-warning-box";
warning.textContent = text;
warning.setAttribute("source", source);
this.liveB.prepend(warning);
return warning;
}
Expand Down

0 comments on commit 7e60e4c

Please sign in to comment.