Remove duplicate scrollbar & move scrollbar (#443)

* Remove duplicate scrollbar

* Move scrolling from modal-content to log-container

* Replace css autoscroll with stable js autoscroll
This commit is contained in:
Florian Gareis 2019-02-19 20:30:12 +01:00 committed by Otto Winter
parent fe54700687
commit 6f22006bf7
No known key found for this signature in database
GPG key ID: DB66C0BE6013F97E
3 changed files with 32 additions and 46 deletions

View file

@ -46,17 +46,8 @@ i.very-large {
font-family: "SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace;
}
.autoscroll {
display: flex;
flex-direction: column-reverse;
flex-basis: auto;
}
.autoscroll div {
flex-basis: 100%;
}
.log {
max-height: calc(100% - 56px);
background-color: #1c1c1c;
margin-top: 0;
margin-bottom: 0;
@ -161,6 +152,10 @@ ul.stepper:not(.horizontal) .step.active::before, ul.stepper:not(.horizontal) .s
height: auto !important;
}
.tap-target-wrapper {
position: fixed !important;
}
/* https://github.com/tnhu/status-indicator/blob/master/styles.css */
.status-indicator .status-indicator-icon {
display: inline-block;
@ -223,9 +218,8 @@ ul.stepper:not(.horizontal) .step.active::before, ul.stepper:not(.horizontal) .s
#editor {
margin-top: 0;
margin-bottom: 0;
padding: 16px;
border-radius: 3px;
height: 100%
height: calc(100% - 56px);
}
.update-available i {

View file

@ -168,6 +168,7 @@ const colorReplace = (pre, state, text) => {
}
}
addSpan(text.substring(i));
scrollToBottomOfElement(pre);
};
const removeUpdateAvailable = (filename) => {
@ -700,4 +701,15 @@ const startWizard = () => {
});
};
const scrollToBottomOfElement = (element) => {
var atBottom = false;
if (element.scrollTop + 30 >= (element.scrollHeight - element.offsetHeight)) {
atBottom = true;
}
if (atBottom) {
element.scrollTop = element.scrollHeight;
}
}
setupWizardStart.addEventListener('click', startWizard);

View file

@ -93,15 +93,9 @@
</div>
<div id="modal-logs" class="modal modal-fixed-footer">
<div class="modal-content autoscroll">
<div>
<h4>Show Logs <code class="inlinecode filename"></code></h4>
<div>
<div class="log-container">
<pre class="log"></pre>
</div>
</div>
</div>
<div class="modal-content">
<h4>Show Logs <code class="inlinecode filename"></code></h4>
<pre class="log"></pre>
</div>
<div class="modal-footer">
<a class="modal-close waves-effect waves-green btn-flat stop-logs">Close</a>
@ -109,13 +103,9 @@
</div>
<div id="modal-upload" class="modal modal-fixed-footer">
<div class="modal-content autoscroll">
<div>
<h4>Compile And Upload <code class="inlinecode filename"></code></h4>
<div class="log-container">
<pre class="log"></pre>
</div>
</div>
<div class="modal-content">
<h4>Compile And Upload <code class="inlinecode filename"></code></h4>
<pre class="log"></pre>
</div>
<div class="modal-footer">
<a href="https://esphome.io/guides/faq.html#i-can-t-get-flashing-over-usb-to-work" target="_blank"
@ -127,13 +117,9 @@
</div>
<div id="modal-compile" class="modal modal-fixed-footer">
<div class="modal-content autoscroll">
<div>
<h4>Compile <code class="inlinecode filename"></code></h4>
<div class="log-container">
<pre class="log"></pre>
</div>
</div>
<div class="modal-content">
<h4>Compile <code class="inlinecode filename"></code></h4>
<pre class="log"></pre>
</div>
<div class="modal-footer">
<a href="https://esphome.io/guides/faq.html#i-can-t-get-flashing-over-usb-to-work"
@ -400,12 +386,10 @@
</div>
<div id="modal-clean-mqtt" class="modal modal-fixed-footer">
<div class="modal-content autoscroll">
<div class="modal-content">
<div>
<h4>Clean MQTT discovery <code class="inlinecode filename"></code></h4>
<div class="log-container">
<pre class="log"></pre>
</div>
<pre class="log"></pre>
</div>
</div>
<div class="modal-footer">
@ -414,12 +398,10 @@
</div>
<div id="modal-clean" class="modal modal-fixed-footer">
<div class="modal-content autoscroll">
<div class="modal-content">
<div>
<h4>Clean Build Files <code class="inlinecode filename"></code></h4>
<div class="log-container">
<pre class="log"></pre>
</div>
<pre class="log"></pre>
</div>
</div>
<div class="modal-footer">
@ -430,9 +412,7 @@
<div id="modal-hass-config" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Generate Home Assistant Configuration <code class="inlinecode filename"></code></h4>
<div class="log-container">
<pre class="log"></pre>
</div>
<pre class="log"></pre>
</div>
<div class="modal-footer">
<a class="modal-close waves-effect waves-green btn-flat stop-logs">Stop</a>