diff --git a/background.html b/background.html
index 536d1ad05..0a03d5540 100644
--- a/background.html
+++ b/background.html
@@ -702,6 +702,8 @@
+
+
diff --git a/js/background.js b/js/background.js
index ca0bbcc90..42a278f70 100644
--- a/js/background.js
+++ b/js/background.js
@@ -819,6 +819,7 @@
type: options.type || '',
};
+
// Give all toasts an ID. User may define.
const toastID = params.id;
const toast = !!toastID && window.toasts.get(toastID);
@@ -831,8 +832,10 @@
new Whisper.SessionToastView({
el: $('#session-toast-container'),
})
+
);
+
window.toasts.get(toastID).render();
window.toasts.get(toastID).update(params);
}
diff --git a/js/modules/signal.js b/js/modules/signal.js
index d0e00e394..1b0a6e10b 100644
--- a/js/modules/signal.js
+++ b/js/modules/signal.js
@@ -53,6 +53,7 @@ const { UserDetailsDialog } = require('../../ts/components/UserDetailsDialog');
const { SessionToast } = require('../../ts/components/session/SessionToast');
const { SessionToggle } = require('../../ts/components/session/SessionToggle');
const { SessionModal } = require('../../ts/components/session/SessionModal');
+const { SessionDropdown } = require('../../ts/components/session/SessionDropdown');
const {
SessionRegistrationView,
} = require('../../ts/components/session/SessionRegistrationView');
@@ -254,6 +255,7 @@ exports.setup = (options = {}) => {
SessionToast,
SessionToggle,
SessionModal,
+ SessionDropdown,
MediaGallery,
Message,
MessageBody,
diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js
index 06df077dc..98893afcb 100644
--- a/js/views/conversation_view.js
+++ b/js/views/conversation_view.js
@@ -1375,11 +1375,11 @@
if (!isAllOurs && !isModerator) {
window.pushToast({
- title: i18n('messageDeletionForbidden'),
- type: 'error',
- id: 'messageDeletionForbidden',
+ title: i18n('messageDeletionForbidden'),
+ type: 'error',
+ id: 'messageDeletionForbidden',
});
-
+
return;
}
diff --git a/js/views/session_dropdown_view.js b/js/views/session_dropdown_view.js
new file mode 100644
index 000000000..8446fbb09
--- /dev/null
+++ b/js/views/session_dropdown_view.js
@@ -0,0 +1,38 @@
+/* global Whisper */
+
+// eslint-disable-next-line func-names
+(function() {
+ 'use strict';
+
+ window.Whisper = window.Whisper || {};
+
+ Whisper.SessionDropdownView = Whisper.View.extend({
+ initialize(options) {
+ this.props = {
+ items: options.items,
+ };
+
+ this.render();
+ },
+
+ render() {
+ this.dropdownView = new Whisper.ReactWrapperView({
+ className: 'session-dropdown-wrapper',
+ Component: window.Signal.Components.SessionDropdown,
+ props: this.props,
+ });
+
+ this.$el.append(this.dropdownView.el);
+ },
+
+ openDropdown() {
+
+ },
+
+ closeDropdown() {
+
+ },
+
+ });
+ })();
+
\ No newline at end of file
diff --git a/stylesheets/_session.scss b/stylesheets/_session.scss
index 8c183e823..37c640205 100644
--- a/stylesheets/_session.scss
+++ b/stylesheets/_session.scss
@@ -562,7 +562,39 @@ label {
}
+// .react-contextmenu {
+// padding: 0px;
+// margin: 0px;
+
+// border: none !important;
+// border-radius: 0px;
+// }
+
+// .react-contextmenu-item {
+// display: flex;
+// align-items: center;
+
+// height: 25px;
+// padding: 0px 10px;
+
+// background-color: #1B1B1B;
+
+// color: $session-color-white;
+// font-family: 'Wasa';
+// font-size: 12px;
+// line-height: $session-icon-size-sm;
+// font-weight: 700;
+
+// &--active, &--selected{
+// background-color: $session-shade-7 !important;
+// }
+// }
+
+
.session-dropdown{
+ position: absolute;
+ top: 50px;
+ left: 50px;
display: inline-block;
ul {
@@ -603,5 +635,4 @@ label {
}
}
}
-
}
\ No newline at end of file
diff --git a/stylesheets/_session_theme_dark.scss b/stylesheets/_session_theme_dark.scss
index 291853042..08e836935 100644
--- a/stylesheets/_session_theme_dark.scss
+++ b/stylesheets/_session_theme_dark.scss
@@ -53,4 +53,6 @@
margin-left: 5px;
}
}
+
}
+
diff --git a/ts/components/UserDetailsDialog.tsx b/ts/components/UserDetailsDialog.tsx
index 3f07d8631..9ed4e43dd 100644
--- a/ts/components/UserDetailsDialog.tsx
+++ b/ts/components/UserDetailsDialog.tsx
@@ -1,8 +1,7 @@
import React from 'react';
import { Avatar } from './Avatar';
-import { SessionDropdown, SessionDropDownType } from './session/SessionDropdown';
-import { SessionIconType } from './session/icon';
+import { SessionDropdown } from './session/SessionDropdown';
declare global {
interface Window {
@@ -35,41 +34,41 @@ export class UserDetailsDialog extends React.Component {
const cancelText = i18n('cancel');
const startConversation = i18n('startConversation');
-
+
const items = [
{
- id: "myid1",
- content: "Copy Chat ID",
- icon: SessionIconType.Eye,
- type: SessionDropDownType.Default,
- active: false
+ content: "sdgsdfg",
+ display: true,//!isPublic && !isMe,
+ },
+ {
+ content: i18n('changeNickname'),
+ display: true,//!isPublic && !isMe,
+ },
+ {
+ content: i18n('clearNickname'),
+ display: true,//!isPublic && !isMe && hasNickname,
},
{
- id: "myid1",
- content: "Invite Friends",
- icon: null,
- type: SessionDropDownType.Default,
- active: false
+ content: i18n('copyPublicKey'),
+ display: false,//!isPublic,
},
{
- id: "myid1",
- content: "Clear Chat History",
- icon: SessionIconType.Check,
- type: SessionDropDownType.Default,
- active: true
+ content: i18n('deleteMessages'),
},
{
- id: "myid1",
- content: "Leave Group",
- icon: SessionIconType.Check,
- type: SessionDropDownType.Danger,
- active: false
+ content: i18n('deleteContact'),
+ display: true,//!isMe && isClosable && !isPublic,
+ },
+ {
+ content: i18n('deletePublicChannel'),
+ display: true,//!isMe && isClosable && !isPublic,
},
];
-
+
return (
-
+
+
diff --git a/ts/components/session/SessionDropdown.tsx b/ts/components/session/SessionDropdown.tsx
index 21b6a1f7f..e88e5f037 100644
--- a/ts/components/session/SessionDropdown.tsx
+++ b/ts/components/session/SessionDropdown.tsx
@@ -1,23 +1,26 @@
import React from 'react';
import classNames from 'classnames';
-import { SessionDropdownItem, SessionDropDownItemType } from './SessionDropdownItem';
import { SessionIconType } from './icon/';
+import { SessionDropdownItem, SessionDropDownItemType } from './SessionDropdownItem';
+// THIS IS A FUTURE-PROOFING ELEMENT TO REPLACE ELECTRON CONTEXTMENUS IN PRELOAD.JS
interface Props {
+ id?: string,
items: Array<{
- id: string,
content: string,
- icon: SessionIconType | null,
- type: SessionDropDownItemType,
- active: boolean,
+ id?: string,
+ icon?: SessionIconType | null,
+ type?: SessionDropDownItemType,
+ active?: boolean,
+ onClick?: any,
+ display?: boolean,
}>,
}
export class SessionDropdown extends React.PureComponent {
- public static readonly defaultProps = SessionDropdownItem.defaultProps;
-
+
constructor(props: any) {
super(props);
}
@@ -28,13 +31,18 @@ export class SessionDropdown extends React.PureComponent {
return (
- {items.map((item: any) =>
+ {items.map((item: any) => {
+ return item.display ? (
+
+ ) : null
+ }
)}
diff --git a/ts/components/session/SessionDropdownItem.tsx b/ts/components/session/SessionDropdownItem.tsx
index f8862f748..41341d681 100644
--- a/ts/components/session/SessionDropdownItem.tsx
+++ b/ts/components/session/SessionDropdownItem.tsx
@@ -24,6 +24,8 @@ export class SessionDropdownItem extends React.PureComponent {
public static defaultProps = {
id: generateID(),
type: SessionDropDownItemType.Default,
+ icon: null,
+ active: false,
onClick: () => null,
};