Skip to content

Commit 288bab1

Browse files
authored
Merge pull request RocketChat#311 from alexbrazier/feature/loading
Added loading screen before load
2 parents b3cb129 + 3cf9e64 commit 288bab1

File tree

5 files changed

+76
-2
lines changed

5 files changed

+76
-2
lines changed

src/public/app.html

+7-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@
2929
<img src="./images/logo.svg" />
3030
</a>
3131
</header>
32-
<form id="login-card" method="/">
32+
<div class="loading-animation" id="loading">
33+
<div class="bounce1"></div>
34+
<div class="bounce2"></div>
35+
<div class="bounce3"></div>
36+
</div>
37+
<form id="login-card" method="/" style="display:none;">
3338
<header>
3439
<h2>Enter your server URL</h2>
3540
</header>
@@ -49,7 +54,7 @@ <h2>Enter your server URL</h2>
4954
<input type="submit" data-loading-text="Connecting..." class="button primary login" value="Connect"></input>
5055
</div>
5156
</form>
52-
<footer>
57+
<footer style="display:none;">
5358
<div class="social">
5459
<nav>
5560
<a target="_system" class="button share twitter" href="https://twitter.com/RocketChatApp"><i class="icon-twitter"></i><span>Twitter</span></a>

src/scripts/servers.js

+1
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ class Servers extends EventEmitter {
190190
this.emit('active-setted', hostUrl);
191191
return true;
192192
}
193+
this.emit('loaded');
193194
return false;
194195
}
195196

src/scripts/webview.js

+14
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ class WebView extends EventEmitter {
2828
servers.on('active-cleared', (hostUrl) => {
2929
this.deactiveAll(hostUrl);
3030
});
31+
32+
servers.once('loaded', () => {
33+
this.loaded();
34+
});
35+
}
36+
37+
loaded () {
38+
var loading = document.querySelector('#loading');
39+
var form = document.querySelector('#login-card');
40+
var footer = document.querySelector('footer');
41+
loading.style.display = 'none';
42+
form.style.display = 'block';
43+
footer.style.display = 'block';
3144
}
3245

3346
add (host) {
@@ -68,6 +81,7 @@ class WebView extends EventEmitter {
6881

6982
webviewObj.addEventListener('dom-ready', () => {
7083
this.emit('dom-ready', host.url);
84+
this.loaded();
7185
});
7286

7387
// Open external app on clicked link. e.g. mailto:, tel:, etc...

src/stylesheets/main.less

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@import "start-page.less";
44
@import "../branding/branding.less";
55
@import "fontello.less";
6+
@import "utils/_loading.import.less";
67

78
*,
89
*:before,
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
.loading-animation {
2+
color: @secondary-font-color;
3+
font-size: 1.3rem;
4+
margin-left: 32px;
5+
margin-top: 12px;
6+
margin-bottom: 5px;
7+
}
8+
9+
.loading-animation > div {
10+
width: 8px;
11+
height: 8px;
12+
border-radius: 100%;
13+
display: inline-block;
14+
background-color: @secondary-font-color;
15+
-webkit-animation: loading-bouncedelay 1.4s infinite ease-in-out both;
16+
animation: loading-bouncedelay 1.4s infinite ease-in-out both;
17+
}
18+
19+
.loading-animation .bounce1 {
20+
-webkit-animation-delay: -0.32s;
21+
animation-delay: -0.32s;
22+
}
23+
24+
.loading-animation .bounce2 {
25+
-webkit-animation-delay: -0.16s;
26+
animation-delay: -0.16s;
27+
}
28+
29+
@-webkit-keyframes loading-bouncedelay {
30+
0%,
31+
80%,
32+
100% {
33+
-webkit-transform: scale(0);
34+
}
35+
36+
40% {
37+
-webkit-transform: scale(1);
38+
}
39+
}
40+
41+
@keyframes loading-bouncedelay {
42+
0%,
43+
80%,
44+
100% {
45+
-webkit-transform: scale(0);
46+
transform: scale(0);
47+
}
48+
49+
40% {
50+
-webkit-transform: scale(1);
51+
transform: scale(1);
52+
}
53+
}

0 commit comments

Comments
 (0)