mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
Add header options.
This commit is contained in:
parent
14ecbc3f35
commit
1cb09cad2a
9 changed files with 115 additions and 23 deletions
|
@ -1656,5 +1656,18 @@
|
||||||
"editProfileDisplayNameWarning": {
|
"editProfileDisplayNameWarning": {
|
||||||
"message": "Note: Your display name will be visible to your contacts",
|
"message": "Note: Your display name will be visible to your contacts",
|
||||||
"description": "Shown to the user as a warning about setting display name"
|
"description": "Shown to the user as a warning about setting display name"
|
||||||
|
},
|
||||||
|
|
||||||
|
"copyPublicKey": {
|
||||||
|
"message": "Copy public key",
|
||||||
|
"description": "Button action that the user can click to copy their public keys"
|
||||||
|
},
|
||||||
|
"copiedPublicKey": {
|
||||||
|
"message": "Copied public key",
|
||||||
|
"description": "A toast message telling the user that the key was copied"
|
||||||
|
},
|
||||||
|
"editDisplayName": {
|
||||||
|
"message": "Edit display name",
|
||||||
|
"description": "Button action that the user can click to edit their display name"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,11 @@
|
||||||
<div class='main-header-title-wrapper'>
|
<div class='main-header-title-wrapper'>
|
||||||
<div class='main-header-content-toggle'/>
|
<div class='main-header-content-toggle'/>
|
||||||
</div>
|
</div>
|
||||||
<div class='main-header-content-wrapper'><div>
|
<div class='main-header-content-wrapper'>
|
||||||
|
{{ #items }}
|
||||||
|
<div role='button' id='{{ id }}'>{{ text }}</div>
|
||||||
|
{{ /items }}
|
||||||
|
</div>
|
||||||
</script>
|
</script>
|
||||||
<script type='text/x-tmpl-mustache' id='scroll-down-button-view'>
|
<script type='text/x-tmpl-mustache' id='scroll-down-button-view'>
|
||||||
<button class='text module-scroll-down__button {{ buttonClass }}' alt='{{ moreBelow }}'>
|
<button class='text module-scroll-down__button {{ buttonClass }}' alt='{{ moreBelow }}'>
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
/* global i18n: false */
|
/* global i18n: false */
|
||||||
/* global Whisper: false */
|
/* global Whisper: false */
|
||||||
/* global textsecure: false */
|
/* global textsecure: false */
|
||||||
/* global Signal: false */
|
/* global clipboard: false */
|
||||||
/* global StringView: false */
|
|
||||||
/* global storage: false */
|
|
||||||
|
|
||||||
// eslint-disable-next-line func-names
|
// eslint-disable-next-line func-names
|
||||||
(function() {
|
(function() {
|
||||||
|
@ -106,6 +104,7 @@
|
||||||
|
|
||||||
this.mainHeaderView = new Whisper.MainHeaderView({
|
this.mainHeaderView = new Whisper.MainHeaderView({
|
||||||
el: this.$('.main-header-placeholder'),
|
el: this.$('.main-header-placeholder'),
|
||||||
|
items: this.getMainHeaderItems(),
|
||||||
});
|
});
|
||||||
|
|
||||||
this.conversation_stack = new Whisper.ConversationStack({
|
this.conversation_stack = new Whisper.ConversationStack({
|
||||||
|
@ -326,6 +325,30 @@
|
||||||
onClick(e) {
|
onClick(e) {
|
||||||
this.closeRecording(e);
|
this.closeRecording(e);
|
||||||
},
|
},
|
||||||
|
getMainHeaderItems() {
|
||||||
|
return [
|
||||||
|
this._mainHeaderItem('copyPublicKey', () => {
|
||||||
|
const ourNumber = textsecure.storage.user.getNumber();
|
||||||
|
clipboard.writeText(ourNumber);
|
||||||
|
|
||||||
|
const toast = new Whisper.MessageToastView({
|
||||||
|
message: i18n('copiedPublicKey'),
|
||||||
|
});
|
||||||
|
toast.$el.appendTo(this.$('.gutter'));
|
||||||
|
toast.render();
|
||||||
|
}),
|
||||||
|
this._mainHeaderItem('editDisplayName', () => {
|
||||||
|
window.Whisper.events.trigger('onEditProfile');
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
},
|
||||||
|
_mainHeaderItem(textKey, onClick) {
|
||||||
|
return {
|
||||||
|
id: textKey,
|
||||||
|
text: i18n(textKey),
|
||||||
|
onClick,
|
||||||
|
};
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Whisper.ExpiredAlertBanner = Whisper.View.extend({
|
Whisper.ExpiredAlertBanner = Whisper.View.extend({
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global Whisper, textsecure, ConversationController, Signal */
|
/* global Whisper, textsecure, ConversationController, Signal, i18n */
|
||||||
|
|
||||||
// eslint-disable-next-line func-names
|
// eslint-disable-next-line func-names
|
||||||
(function() {
|
(function() {
|
||||||
|
@ -10,10 +10,14 @@
|
||||||
templateName: 'main-header-placeholder',
|
templateName: 'main-header-placeholder',
|
||||||
events: {
|
events: {
|
||||||
'click .main-header-title-wrapper': 'onClick',
|
'click .main-header-title-wrapper': 'onClick',
|
||||||
|
'click .edit-name': 'onEditProfile',
|
||||||
|
'click .copy-key': 'onCopyKey',
|
||||||
},
|
},
|
||||||
initialize() {
|
initialize(options) {
|
||||||
const ourNumber = textsecure.storage.user.getNumber();
|
this.items = options.items || [];
|
||||||
const me = ConversationController.getOrCreate(ourNumber, 'private');
|
|
||||||
|
this.ourNumber = textsecure.storage.user.getNumber();
|
||||||
|
const me = ConversationController.getOrCreate(this.ourNumber, 'private');
|
||||||
|
|
||||||
this.mainHeaderView = new Whisper.ReactWrapperView({
|
this.mainHeaderView = new Whisper.ReactWrapperView({
|
||||||
className: 'main-header-wrapper',
|
className: 'main-header-wrapper',
|
||||||
|
@ -24,10 +28,25 @@
|
||||||
this.listenTo(me, 'change', update);
|
this.listenTo(me, 'change', update);
|
||||||
|
|
||||||
this.render();
|
this.render();
|
||||||
|
|
||||||
this.$('.main-header-title-wrapper').prepend(this.mainHeaderView.el);
|
this.$('.main-header-title-wrapper').prepend(this.mainHeaderView.el);
|
||||||
this.$content = this.$('.main-header-content-wrapper');
|
|
||||||
this.$toggle = this.$('.main-header-content-toggle');
|
this.$toggle = this.$('.main-header-content-toggle');
|
||||||
|
this.$content = this.$('.main-header-content-wrapper');
|
||||||
|
this.$content.hide();
|
||||||
|
|
||||||
|
this.registerCallbacks();
|
||||||
|
},
|
||||||
|
registerCallbacks() {
|
||||||
|
this.items.forEach(item => {
|
||||||
|
if (item.onClick) {
|
||||||
|
this.$(`#${item.id}`).click(item.onClick);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
render_attributes() {
|
||||||
|
return {
|
||||||
|
items: this.items,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
onClick() {
|
onClick() {
|
||||||
// Toggle section visibility
|
// Toggle section visibility
|
||||||
|
|
|
@ -28,4 +28,13 @@
|
||||||
setTimeout(this.close.bind(this), 2000);
|
setTimeout(this.close.bind(this), 2000);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Whisper.MessageToastView = Whisper.ToastView.extend({
|
||||||
|
initialize(options) {
|
||||||
|
this.message = options.message || '-';
|
||||||
|
},
|
||||||
|
render_attributes() {
|
||||||
|
return { toastMessage: this.message };
|
||||||
|
},
|
||||||
|
})
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -7,6 +7,7 @@ const semver = require('semver');
|
||||||
const { deferredToPromise } = require('./js/modules/deferred_to_promise');
|
const { deferredToPromise } = require('./js/modules/deferred_to_promise');
|
||||||
|
|
||||||
const { app } = electron.remote;
|
const { app } = electron.remote;
|
||||||
|
const { clipboard } = electron;
|
||||||
|
|
||||||
window.PROTO_ROOT = 'protos';
|
window.PROTO_ROOT = 'protos';
|
||||||
const config = require('url').parse(window.location.toString(), true).query;
|
const config = require('url').parse(window.location.toString(), true).query;
|
||||||
|
@ -277,6 +278,8 @@ window.React = require('react');
|
||||||
window.ReactDOM = require('react-dom');
|
window.ReactDOM = require('react-dom');
|
||||||
window.moment = require('moment');
|
window.moment = require('moment');
|
||||||
|
|
||||||
|
window.clipboard = clipboard;
|
||||||
|
|
||||||
const Signal = require('./js/modules/signal');
|
const Signal = require('./js/modules/signal');
|
||||||
const i18n = require('./js/modules/i18n');
|
const i18n = require('./js/modules/i18n');
|
||||||
const Attachments = require('./app/attachments');
|
const Attachments = require('./app/attachments');
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
float: left;
|
float: left;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.tool-bar {
|
.tool-bar {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
|
@ -53,6 +54,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.toast {
|
||||||
|
bottom: 78px;
|
||||||
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
max-height: calc(100% - 88px);
|
max-height: calc(100% - 88px);
|
||||||
|
|
|
@ -2186,11 +2186,26 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: $color-dark-75;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-header-title-wrapper:hover {
|
.main-header-content-wrapper {
|
||||||
|
color: $color-dark-05;
|
||||||
|
|
||||||
|
div {
|
||||||
|
padding: 12px;
|
||||||
|
background-color: $color-dark-90;
|
||||||
|
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
background-color: $color-dark-75;
|
background-color: $color-dark-75;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.main-header-wrapper {
|
.main-header-wrapper {
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
@ -2214,9 +2229,8 @@
|
||||||
user-select: none;
|
user-select: none;
|
||||||
color: white;
|
color: white;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
|
||||||
|
|
||||||
.main-header-content-toggle::after {
|
&:after {
|
||||||
-webkit-transition: all .35s;
|
-webkit-transition: all .35s;
|
||||||
-o-transition: all .35s;
|
-o-transition: all .35s;
|
||||||
transition: all .35s;
|
transition: all .35s;
|
||||||
|
@ -2226,6 +2240,7 @@
|
||||||
content: '\25BE';
|
content: '\25BE';
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.main-header-content-toggle-visible::after {
|
.main-header-content-toggle-visible::after {
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
|
|
|
@ -115,6 +115,7 @@ $color-dark-60: #797a7c;
|
||||||
$color-dark-70: #414347;
|
$color-dark-70: #414347;
|
||||||
$color-dark-75: #292c33;
|
$color-dark-75: #292c33;
|
||||||
$color-dark-85: #1a1c20;
|
$color-dark-85: #1a1c20;
|
||||||
|
$color-dark-90: #121417;
|
||||||
$color-black-008: rgba($color-black, 0.08);
|
$color-black-008: rgba($color-black, 0.08);
|
||||||
$color-black-008-no-tranparency: #ededed;
|
$color-black-008-no-tranparency: #ededed;
|
||||||
$color-black-016-no-tranparency: #d9d9d9;
|
$color-black-016-no-tranparency: #d9d9d9;
|
||||||
|
|
Loading…
Reference in a new issue