-
-
Notifications
You must be signed in to change notification settings - Fork 832
Share Dialog #1948
Share Dialog #1948
Changes from 8 commits
0740512
e7a4a0b
e3c455e
64bcf6f
7f1ce52
d8a1feb
f9b3f0f
18546db
d457878
aa7d62b
7d7a6f3
e1d3c2e
bef435e
ef178b2
33a3cfe
7de7275
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
Copyright 2018 New Vector Ltd. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
.mx_ShareDialog { | ||
// this is to center the content | ||
padding-right: 58px; | ||
} | ||
|
||
.mx_ShareDialog hr { | ||
margin-top: 25px; | ||
margin-bottom: 10px; | ||
border-color: $light-fg-color; | ||
} | ||
|
||
.mx_ShareDialog_content { | ||
margin: 10px 0; | ||
} | ||
|
||
.mx_ShareDialog_matrixto { | ||
display: flex; | ||
justify-content: space-between; | ||
border-radius: 5px; | ||
border: solid 1px $light-fg-color; | ||
margin-bottom: 10px; | ||
margin-top: 30px; | ||
padding: 10px; | ||
} | ||
|
||
.mx_ShareDialog_matrixto a { | ||
text-decoration: none; | ||
} | ||
|
||
.mx_ShareDialog_matrixto_link { | ||
flex-shrink: 1; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
|
||
.mx_ShareDialog_matrixto_copy { | ||
flex-shrink: 0; | ||
cursor: pointer; | ||
margin-left: 20px; | ||
display: inherit; | ||
} | ||
.mx_ShareDialog_matrixto_copy > div { | ||
background-image: url($copy-button-url); | ||
margin-left: 5px; | ||
width: 20px; | ||
height: 20px; | ||
} | ||
|
||
.mx_ShareDialog_split { | ||
display: flex; | ||
flex-wrap: wrap; | ||
} | ||
|
||
.mx_ShareDialog_qrcode_container { | ||
float: left; | ||
background-color: #ffffff; | ||
padding: 5px; // makes qr code more readable in dark theme | ||
border-radius: 5px; | ||
height: 256px; | ||
width: 256px; | ||
margin-right: 64px; | ||
} | ||
|
||
.mx_ShareDialog_social_container { | ||
display: flex; | ||
flex-wrap: wrap; | ||
width: 299px; | ||
} | ||
|
||
.mx_ShareDialog_social_icon { | ||
margin-right: 10px; | ||
margin-bottom: 10px; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
Copyright 2015, 2016 OpenMarket Ltd | ||
Copyright 2018 Vector Creations Ltd | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're New Vector now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whoops, will fix There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
@@ -15,12 +16,10 @@ limitations under the License. | |
*/ | ||
|
||
|
||
'use strict'; | ||
|
||
const classNames = require('classnames'); | ||
const React = require('react'); | ||
const ReactDOM = require('react-dom'); | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
|
||
// Shamelessly ripped off Modal.js. There's probably a better way | ||
// of doing reusable widgets like dialog boxes & menus where we go and | ||
|
@@ -61,7 +60,12 @@ export default class ContextualMenu extends React.Component { | |
// If true, insert an invisible screen-sized element behind the | ||
// menu that when clicked will close it. | ||
hasBackground: PropTypes.bool, | ||
} | ||
|
||
// The component to render as the context menu | ||
elementClass: PropTypes.element.isRequired, | ||
// on resize callback | ||
windowResize: PropTypes.func | ||
}; | ||
|
||
render() { | ||
const position = {}; | ||
|
@@ -112,7 +116,7 @@ export default class ContextualMenu extends React.Component { | |
`; | ||
} | ||
|
||
const chevron = <div style={chevronOffset} className={"mx_ContextualMenu_chevron_" + chevronFace}></div>; | ||
const chevron = <div style={chevronOffset} className={"mx_ContextualMenu_chevron_" + chevronFace} />; | ||
const className = 'mx_ContextualMenu_wrapper'; | ||
|
||
const menuClasses = classNames({ | ||
|
@@ -158,13 +162,13 @@ export default class ContextualMenu extends React.Component { | |
{ chevron } | ||
<ElementClass {...props} onFinished={props.closeMenu} onResize={props.windowResize} /> | ||
</div> | ||
{ props.hasBackground && <div className="mx_ContextualMenu_background" onClick={props.closeMenu}></div> } | ||
{ props.hasBackground && <div className="mx_ContextualMenu_background" onClick={props.closeMenu} /> } | ||
<style>{ chevronCSS }</style> | ||
</div>; | ||
} | ||
} | ||
|
||
export function createMenu(ElementClass, props) { | ||
export function createMenu(ElementClass, props, hasBackground=true) { | ||
const closeMenu = function(...args) { | ||
ReactDOM.unmountComponentAtNode(getOrCreateContainer()); | ||
|
||
|
@@ -175,8 +179,8 @@ export function createMenu(ElementClass, props) { | |
|
||
// We only reference closeMenu once per call to createMenu | ||
const menu = <ContextualMenu | ||
hasBackground={hasBackground} | ||
{...props} | ||
hasBackground={true} | ||
elementClass={ElementClass} | ||
closeMenu={closeMenu} // eslint-disable-line react/jsx-no-bind | ||
windowResize={closeMenu} // eslint-disable-line react/jsx-no-bind | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1074,6 +1074,14 @@ module.exports = React.createClass({ | |
</div>; | ||
}, | ||
|
||
onSelfShareClick: function() { | ||
const cli = MatrixClientPeg.get(); | ||
const ShareDialog = sdk.getComponent("dialogs.ShareDialog"); | ||
Modal.createTrackedDialog('share self dialog', '', ShareDialog, { | ||
target: cli.getUser(this._me), | ||
}); | ||
}, | ||
|
||
_showSpoiler: function(event) { | ||
const target = event.target; | ||
target.innerHTML = target.getAttribute('data-spoiler'); | ||
|
@@ -1295,10 +1303,13 @@ module.exports = React.createClass({ | |
|
||
<div className="mx_UserSettings_section"> | ||
<div className="mx_UserSettings_advanced"> | ||
{ _t("Logged in as:") } { this._me } | ||
{ _t("Logged in as:") + ' ' } | ||
<span onClick={this.onSelfShareClick} className="mx_UserSettings_link"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't put onClicks on spans: it's styled to look like a link on the screen, but to people using a screen reader this is just text. A thing that causes a dialog to pop up when you click on it is a button, or failing that, a hyperlink. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
{ this._me } | ||
</span> | ||
</div> | ||
<div className="mx_UserSettings_advanced"> | ||
{ _t('Access Token:') } | ||
{ _t('Access Token:') + ' ' } | ||
<span className="mx_UserSettings_advanced_spoiler" | ||
onClick={this._showSpoiler} | ||
data-spoiler={MatrixClientPeg.get().getAccessToken()}> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uh...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the Modal sits at Z 4000
so it needs to be higher