Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit 3cf419a

Browse files
committed
Merge pull request #1591 from OpenBazaar/positioningFixes
Patch layout issues with page connect modals
2 parents a929e37 + 1d871aa commit 3cf419a

File tree

5 files changed

+37
-53
lines changed

5 files changed

+37
-53
lines changed

css/obBase.css

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ form {
197197
position: relative;
198198
}
199199

200+
#contentFrame.modalOpen #pageNav .badge {
201+
display: none;
202+
}
203+
200204
#pageNav {
201205
position: relative;
202206
-webkit-app-region: no-drag;
@@ -1520,18 +1524,9 @@ h5 {
15201524
padding-top: 100px;
15211525
}
15221526
1523-
/*
1524-
will cover entire screen aside from the #appBar,
1525-
which should never be covered.
1526-
*/
1527-
.modal-fullscreen {
1528-
top: 28px;
1529-
}
1530-
15311527
.modal-childMain {
15321528
border-radius: 3px;
15331529
background-color: #327eb8;
1534-
box-shadow: 0 0 10px #383838;
15351530
}
15361531
15371532
.modal-hero {
@@ -4350,21 +4345,6 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
43504345
padding-top: 0;
43514346
}
43524347
4353-
#loadingModal, .page-connect-modal.server-connect {
4354-
z-index: 13;
4355-
}
4356-
4357-
/*
4358-
Different types of modals (e.g. loading, page-connect-modal, server-connect...) have
4359-
different dimensions (e.g. some cover chat, some cover nav bar...). We'll be
4360-
fudging the position of loading spinners and content so that if these modals
4361-
are shown in succession, there is no "jump" of the spinner / content.
4362-
*/
4363-
#loadingModal .spinner-with-logo, .page-connect-modal.server-connect .spinner-with-logo {
4364-
margin-top: 6px;
4365-
margin-left: -20px;
4366-
}
4367-
43684348
.page-connect-modal .spinner-with-logo {
43694349
margin-top: -45px;
43704350
}
@@ -4403,10 +4383,6 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
44034383
opacity: 0;
44044384
}
44054385

4406-
#ov1 .server-connect-modal {
4407-
z-index: 15;
4408-
}
4409-
44104386
#ov1 .server-connect-modal .modal-child {
44114387
height: 625px;
44124388
overflow: hidden;
@@ -4702,10 +4678,6 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
47024678
transition: transform 0.5s ease;
47034679
}
47044680

4705-
.page-connect-modal.server-connect .content {
4706-
transform: translate(-20px, 51px);
4707-
}
4708-
47094681
.page-connect-modal .content .btn {
47104682
float: none;
47114683
}

index.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,19 @@ <h2 class="ion-android-close custCol-text clickable"></h2>
5858

5959
</div>
6060

61-
</div>
62-
63-
<div id="loadingModal" class="modal modal-opaque modal-fullscreen js-loadingModal hide">
64-
<div class="spinner-with-logo fullCentered">
65-
<i class="ion-android-sync spinner fontSize30 spinner-with-logo-icon"></i>
66-
</div>
67-
<div id="loadingModalContent">
68-
<p class="fontSize16 js-translate" data-translate="errorMessages.loadingViewError"></p>
69-
<div id="loadingModalBtns">
70-
<a class="btn btn-large marginRight10 custCol-secondary custCol-text js-indexReload"><i class="ion-android-sync"></i> <span class="js-translate" data-translate="Reload"></span></a>
71-
<a class="btn btn-large custCol-secondary custCol-text" href="#home"><i class="ion-eye"></i> <span class="js-translate" data-translate="LoadIndex"></span></a>
61+
<div id="loadingModal" class="modal modal-opaque modal-fullscreen js-loadingModal hide">
62+
<div class="spinner-with-logo fullCentered">
63+
<i class="ion-android-sync spinner fontSize30 spinner-with-logo-icon"></i>
64+
</div>
65+
<div id="loadingModalContent">
66+
<p class="fontSize16 js-translate" data-translate="errorMessages.loadingViewError"></p>
67+
<div id="loadingModalBtns">
68+
<a class="btn btn-large marginRight10 custCol-secondary custCol-text js-indexReload"><i class="ion-android-sync"></i> <span class="js-translate" data-translate="Reload"></span></a>
69+
<a class="btn btn-large custCol-secondary custCol-text" href="#home"><i class="ion-eye"></i> <span class="js-translate" data-translate="LoadIndex"></span></a>
70+
</div>
7271
</div>
7372
</div>
73+
7474
</div>
7575

7676
</div>

js/utils/setTheme.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ module.exports = function(primaryColor, secondaryColor, backgroundColor, textCol
8585
"#ov1 #userPage .customThemeScrollbar::-webkit-scrollbar-thumb { background: " + shadeColor2(primaryColor, 0.25) + ";}" +
8686
"#ov1 #userPage .user-page-header-slim-bg { box-shadow: inset 0px -120px 112px -52px rgba(" + opaque1.r + ", " + opaque1.g + ", " + opaque1.b + ", .65);}" +
8787
"#ov1 #userPage .custCol-background { background-color: " + backgroundColor + ";}" +
88-
"#ov1 #userPage .modal-childMain { box-shadow: 0px 0px 15px " + shadeColor2(backgroundColor, -0.15) + ";}" +
8988
"#ov1 #userPage #overlay { background-color: rgba(" + opaque.r + ", " + opaque.g + ", " + opaque.b + ", 0.70);}";
9089

9190
// Medium Editor

js/views/baseModal.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ module.exports = baseVw.extend({
4848

4949
open: function() {
5050
if (!domUtils.isInPage(this.el)) {
51-
document.getElementById('appFrame').appendChild(this.el);
51+
var container = document.getElementById('contentFrame');
52+
container.classList.add("modalOpen");
53+
container.appendChild(this.el);
5254

5355
this._open = true;
5456
this.trigger('open');
@@ -60,7 +62,9 @@ module.exports = baseVw.extend({
6062

6163
close: function() {
6264
if (domUtils.isInPage(this.el)) {
63-
document.getElementById('appFrame').removeChild(this.el);
65+
var container = document.getElementById('contentFrame');
66+
container.classList.remove("modalOpen");
67+
container.removeChild(this.el);
6468

6569
this._open = false;
6670
this.trigger('close');

js/views/serverConnectModal.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,11 @@ module.exports = BaseModal.extend({
262262
promise = deferred.promise(),
263263
startTime = Date.now(),
264264
minAttemptTime = 1000,
265-
//timesup,
265+
loginRequest,
266+
timesup,
266267
conclude,
267-
login;
268+
login,
269+
onClose;
268270

269271
conclude = function(reject) {
270272
// Sometimes the connection attempt concludes so fast that the UI doesn't
@@ -285,7 +287,7 @@ module.exports = BaseModal.extend({
285287

286288
login = function() {
287289
// check authentication
288-
app.login().done(function(data) {
290+
loginRequest = app.login().done(function(data) {
289291
if (data.success) {
290292
conclude(false, data);
291293
self.trigger('connected');
@@ -307,6 +309,14 @@ module.exports = BaseModal.extend({
307309

308310
app.connectHeartbeatSocket();
309311

312+
promise.cleanup = function() {
313+
clearTimeout(timesup);
314+
clearTimeout(conclude);
315+
loginRequest && loginRequest.abort();
316+
app.getHeartbeatSocket().off(null, login);
317+
app.getHeartbeatSocket().off(null, onClose);
318+
};
319+
310320
promise.cancel = function() {
311321
conclude(true, 'canceled');
312322
};
@@ -317,22 +327,21 @@ module.exports = BaseModal.extend({
317327

318328
app.getHeartbeatSocket().on('open', login);
319329

320-
app.getHeartbeatSocket().on('close', function() {
330+
app.getHeartbeatSocket().on('close', onClose = function() {
321331
// On local servers the close event on a down server is
322332
// almost instantaneous and the UI can't even show the
323333
// user we're attempting to connect. So we'll put up a bit
324334
// of a facade.
325335
conclude(true);
326336
});
327337

328-
/*
329338
timesup = setTimeout(function() {
330339
// not timeing out our connections for now, due to
331340
// server issue where valid connections may take
332341
// 1 min. +
333-
conclude(true, 'timedout');
342+
// conclude(true, 'timedout');
343+
console.log("connection timeout");
334344
}, 10000);
335-
*/
336345

337346
return promise;
338347
},

0 commit comments

Comments
 (0)