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

Commit e340bb1

Browse files
committed
Merge pull request #1541 from rmisio/app-bar
App bar
2 parents dad1607 + 1c7a0e0 commit e340bb1

File tree

14 files changed

+237
-93
lines changed

14 files changed

+237
-93
lines changed

css/obBase.css

Lines changed: 114 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,45 @@ form {
202202
width: calc(100% - 230px);
203203
}
204204

205-
#pageNav {
205+
#appBar {
206206
position: fixed;
207-
top: 0;
207+
width: 100%;
208+
z-index: 14;
209+
background-color: #327EB8;
210+
padding: 7px 8px 6px;
211+
box-sizing: border-box;
208212
-webkit-app-region: drag;
209-
z-index: 13;
210213
}
211214

215+
#appBar .windowControls {
216+
position: absolute;
217+
left: 8px;
218+
top: 6px;
219+
}
220+
221+
html:not(.platform-mac) #appBar .windowControls {
222+
left: auto;
223+
right: 8px;
224+
top: 5px;
225+
}
226+
227+
#appBar .btn {
228+
-webkit-app-region: no-drag;
229+
}
230+
231+
#appBar .title {
232+
/* since the loading spinners are centered in a manner
233+
where chat is excluded from the width, we'll follow
234+
suit here so our title is centered with the spinners */
235+
width: calc(100% - 45px);
236+
}
237+
238+
#pageNav {
239+
position: fixed;
240+
top: 28px;
241+
-webkit-app-region: no-drag;
242+
z-index: 13;
243+
}
212244

213245
.pageNavContainer {
214246
width: 100%;
@@ -220,7 +252,7 @@ form {
220252
}
221253

222254
#pageNav .navBar.bar {
223-
padding: 10px 8px;
255+
padding: 0 8px 10px;
224256
}
225257

226258
#pageNav .modal-about .navBar.bar {
@@ -240,7 +272,7 @@ form {
240272
#sideBar {
241273
position: fixed;
242274
right: -183px;
243-
top: 50px;
275+
top: 68px;
244276
width:230px;
245277
background-color: #252525;
246278
border-left: 0;
@@ -1037,24 +1069,24 @@ label.fieldItem {
10371069
display: block;
10381070
width: 100%;
10391071
height: 100%;
1040-
top: 0;
1072+
top: 28px;
10411073
left: 0;
10421074
transition: opacity .05s cubic-bezier(0, 0, 0.2, 1),
10431075
width 0.5s ease;
10441076
padding-top: 25px;
10451077
z-index: 1;
10461078
}
10471079

1048-
#ov1.chatLoaded .modal:not(.modal-cover-fullscreen) {
1080+
.modal:not(.modal-fullscreen) {
10491081
width: calc(100% - 45px);
10501082
}
10511083

1052-
#ov1.chatOpen .modal:not(.modal-cover-fullscreen) {
1084+
#ov1.chatOpen .modal:not(.modal-fullscreen) {
10531085
width: calc(100% - 230px);
10541086
}
10551087

10561088
.modal.modal-navOffset {
1057-
top: 50px;
1089+
top: 68px;
10581090
}
10591091

10601092
.modalHolder {
@@ -1455,31 +1487,27 @@ h5 {
14551487
.modal-opaque {
14561488
background-color: rgba(6, 55, 83, 0.80);
14571489
box-shadow: inset 0px -70px 112px -62px rgba(37,37,37,.9);
1458-
top: 50px;
1490+
top: 68px;;
14591491
}
14601492
14611493
.modal-opaqueDark {
14621494
background-color: rgba(25,25,25,0.9);
14631495
box-shadow: inset 0px -70px 112px -62px rgba(37,37,37,.9);
1464-
top: 50px;
1496+
top: 68px;
14651497
}
14661498
14671499
.modal-opaque.modal-navBlock {
1468-
background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.2) 50px, rgba(7,65,97,1) 51px);
1500+
background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.2) 68px, rgba(7,65,97,1) 69px);
14691501
top: 0;
1470-
padding-top: 70px;
1471-
}
1472-
1473-
.modal-cover-fullscreen {
1474-
top: 0;
1475-
}
1476-
1477-
.modal-cover-fullscreen .modal-childMain {
1478-
top: 50px;
1502+
padding-top: 100px;
14791503
}
14801504
1481-
.modal-cover-fullscreen.modal.modal-navOffset .modal-childMain {
1482-
top: 0;
1505+
/*
1506+
will cover entire screen aside from the #appBar,
1507+
which should never be covered.
1508+
*/
1509+
.modal-fullscreen {
1510+
top: 28px;
14831511
}
14841512
14851513
.modal-childMain {
@@ -2008,7 +2036,40 @@ margin: auto;
20082036
.btn.btn-win.btn-winMax {
20092037
background-color: #B8E986;
20102038
position: relative;
2039+
}
2040+
2041+
html:not(.platform-mac) .btn.btn-win {
2042+
background-color: transparent;
2043+
border-radius: 0;
2044+
width: 19px;
2045+
height: 19px;
2046+
box-shadow: none;
2047+
}
20112048

2049+
html:not(.platform-mac) .btn.btn-winClose {
2050+
float: right;
2051+
margin-left: 6px;
2052+
}
2053+
2054+
html:not(.platform-mac) .btn.btn-win .btn-win-icon {
2055+
display: block;
2056+
top: -3px;
2057+
font-size: 21px;
2058+
color: #fff;
2059+
}
2060+
2061+
html:not(.platform-mac) .btn.btn-winMax {
2062+
float: right;
2063+
margin-left: 6px;
2064+
border: 1px solid #fff;
2065+
width: 13px;
2066+
height: 13px;
2067+
top: 3px;
2068+
}
2069+
2070+
html:not(.platform-mac) .btn.btn-winMax .btn-win-icon,
2071+
html:not(.platform-mac) .btn.btn-win.btn-winMax:hover .btn-win-icon {
2072+
display: none;
20122073
}
20132074

20142075
.btn.btn-bar {
@@ -4299,8 +4360,27 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
42994360
z-index: 9;
43004361
}
43014362
4363+
#loadingModal {
4364+
padding-top: 0;
4365+
}
4366+
43024367
#loadingModal, .page-connect-modal.server-connect {
4303-
z-index: 14;
4368+
z-index: 13;
4369+
}
4370+
4371+
/*
4372+
Different types of modals (e.g. loading, page-connect-modal, server-connect...) have
4373+
different dimensions (e.g. some cover chat, some cover nav bar...). We'll be
4374+
fudging the position of loading spinners and content so that if these modals
4375+
are shown in succession, there is no "jump" of the spinner / content.
4376+
*/
4377+
#loadingModal .spinner-with-logo, .page-connect-modal.server-connect .spinner-with-logo {
4378+
margin-top: 6px;
4379+
margin-left: -20px;
4380+
}
4381+
4382+
.page-connect-modal .spinner-with-logo {
4383+
margin-top: -45px;
43044384
}
43054385
43064386
#ov1 #loadingModal.hide {
@@ -4315,7 +4395,8 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
43154395
right: 0;
43164396
left: 0;
43174397
top: 50%;
4318-
margin-top: 120px;
4398+
margin-top: 117px;
4399+
margin-left: -40px;
43194400
opacity: 1;
43204401
transition: opacity 1s 5s ease;
43214402
box-sizing: border-box;
@@ -4346,7 +4427,7 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
43464427
}
43474428

43484429
#ov1 .server-connect-modal .message-bar {
4349-
top: 50px;
4430+
top: 59px;
43504431
left: 25px;
43514432
right: 25px;
43524433
z-index: 1;
@@ -4563,7 +4644,7 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
45634644
padding-top: 20px;
45644645
-webkit-app-region: no-drag;
45654646
position: relative;
4566-
top: 50px;
4647+
top: 68px;
45674648
box-sizing: border-box;
45684649
}
45694650

@@ -4613,15 +4694,6 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
46134694
height: 100%;
46144695
}
46154696

4616-
.page-connect-modal .spinner-with-logo {
4617-
/*
4618-
so it lines up with the loading modal,
4619-
otherwise there's a jump when this guy loads
4620-
right after the loading one.
4621-
*/
4622-
margin-top: -37px;
4623-
}
4624-
46254697
.page-connect-modal .spinner-with-logo .icon-no-connection {
46264698
top: 18px;
46274699
left: 22px;
@@ -4633,13 +4705,17 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
46334705
left: 0;
46344706
top: 50%;
46354707
max-width: 600px;
4636-
margin-top: 90px;
4708+
margin-top: 75px;
46374709
margin-left: auto;
46384710
margin-right: auto;
46394711
text-align: center;
46404712
transition: transform 0.5s ease;
46414713
}
46424714

4715+
.page-connect-modal.server-connect .content {
4716+
transform: translate(-20px, 51px);
4717+
}
4718+
46434719
.page-connect-modal .content .btn {
46444720
float: none;
46454721
}
@@ -6170,4 +6246,4 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
61706246
.buyWizardMap .mapWrap {
61716247
background-color: #eeeae1;
61726248
height: 100%;
6173-
}
6249+
}

index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ <h2 class="ion-android-close custCol-text clickable"></h2>
4242
</div>
4343
<div id="statusBar"></div>
4444
<div id="pageNav" class="bar navBar navBar-main custCol-secondary padding0"></div>
45-
<div id="loadingModal" class="modal modal-opaque modal-cover-fullscreen js-loadingModal hide">
45+
<div id="appBar" class="top0 alignCenter custCol-secondary"></div>
46+
<div id="loadingModal" class="modal modal-opaque modal-fullscreen js-loadingModal hide">
4647
<div class="spinner-with-logo fullCentered">
4748
<i class="ion-android-sync spinner fontSize30 spinner-with-logo-icon"></i>
4849
</div>

js/languages/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"Cancel": "Cancel",
1616
"TryAgain": "Try Again",
1717
"ClosingOpenBazaar": "Close (Your page will go offline)",
18+
"ClosingOpenBazaarNonInstaller": "Close",
1819
"Minimize": "Minimize",
1920
"Maximize": "Maximize",
2021
"Restore": "Restore",

js/router.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ module.exports = Backbone.Router.extend({
267267

268268
// hide the discover onboarding callout
269269
$('.js-OnboardingIntroDiscoverHolder').addClass('hide');
270+
app.appBar.setTitle(polyglot.t('Discover'));
270271
},
271272

272273
userPage: function(userID, state, itemHash, skipNSFWmodal, handle){
@@ -283,6 +284,7 @@ module.exports = Backbone.Router.extend({
283284
if (handle) options.handle = handle;
284285

285286
this.newView(new userPageView(options),"userPage",'','onPage');
287+
app.appBar.setTitle(handle ? handle : options.userId || this.userModel.get('guid'));
286288
},
287289

288290
userPageViaHandle: function(handle, subPath) {
@@ -324,6 +326,7 @@ module.exports = Backbone.Router.extend({
324326
state: state,
325327
orderID: orderID
326328
}),"userPage");
329+
app.appBar.setTitle(polyglot.t('Transactions'));
327330
},
328331

329332
settings: function(state){
@@ -335,5 +338,6 @@ module.exports = Backbone.Router.extend({
335338
state: state,
336339
socketView: this.socketView
337340
}), "userPage");
341+
app.appBar.setTitle(polyglot.t('Settings'));
338342
}
339343
});

js/start.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ var Polyglot = require('node-polyglot'),
3737
pageNavView = require('./views/pageNavVw'),
3838
ChatVw = require('./views/chatVw'),
3939
StatusBarView = require('./views/statusBarVw'),
40+
AppBarVw = require('./views/appBarVw'),
4041
user = new userModel(),
4142
userProfile = new userProfileModel(),
4243
languages = new languagesModel(),
4344
socketView = require('./views/socketVw'),
4445
cCode = "",
46+
$html = $('html'),
4547
$loadingModal = $('.js-loadingModal'),
4648
ServerConfigsCl = require('./collections/serverConfigsCl'),
4749
ServerConnectModal = require('./views/serverConnectModal'),
@@ -63,7 +65,20 @@ var Polyglot = require('node-polyglot'),
6365
pageConnectModal,
6466
launchOnboarding,
6567
setServerUrl,
66-
guidCreating;
68+
guidCreating,
69+
platformClass;
70+
71+
if (process.platform === 'darwin') {
72+
platformClass = 'platform-mac';
73+
} else if (process.platform === 'win32') {
74+
platformClass = 'platform-win';
75+
} else {
76+
// http://stackoverflow.com/a/8684009
77+
// could be linux, sunos or freebsd
78+
platformClass = `platform-${process.platform}`
79+
}
80+
81+
$html.addClass(platformClass);
6782

6883
//put language in the window so all templates and models can reach it. It's especially important in formatting currency.
6984
//retrieve the stored value, since user is a blank model at this point
@@ -89,6 +104,11 @@ user.on('change:language', function(md, lang) {
89104
window.translateIndex();
90105
});
91106

107+
// add in our app bar
108+
app.appBar = new AppBarVw({
109+
el: '#appBar'
110+
}).render();
111+
92112
window.addEventListener('contextmenu', (e) => {
93113
e.preventDefault();
94114
ipcRenderer.send('contextmenu-click', e);
@@ -231,7 +251,7 @@ $(window).bind('hashchange', function(){
231251

232252
//set fancy styles class
233253
if(localStorage.getItem('notFancy') == "true"){
234-
$('html').addClass('notFancy')
254+
$html.addClass('notFancy')
235255
}
236256

237257
//prevent dragging a file to the window from loading that file
@@ -453,7 +473,7 @@ launchOnboarding = function(guidCreating) {
453473
var activeServer = app.serverConfigs.getActive();
454474

455475
pageConnectModal = new PageConnectModal({
456-
className: 'server-connect top0',
476+
className: 'server-connect modal-fullscreen',
457477
initialState: {
458478
statusText: activeServer && activeServer.get('default') ?
459479
polyglot.t('serverConnectModal.connectingToDefault') :

0 commit comments

Comments
 (0)