make drag n drop prettier

This commit is contained in:
or-else
2022-12-14 10:54:39 -08:00
parent 03e87697cf
commit ed3107405f
8 changed files with 30 additions and 26 deletions
+14 -11
View File
@@ -2982,25 +2982,28 @@ ul.tabbar li.active > a {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: absolute; position: absolute;
width: 100%; top: 0;
height: 100%; left: 0;
right: 0;
bottom: 0;
} }
.drag-and-drop .banner { .drag-and-drop .banner {
border: dashed grey 1px;
background-color: rgba(255,255,255,.8);
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 9999;
/* Center text & font. */
display: flex; display: flex;
border: dashed grey 0.15rem;
border-radius: 1rem;
background-color: rgba(255,255,255,.95);
position: absolute;
top: 1.5rem;
bottom: 1.5rem;
left: 1.5rem;
right: 1.5rem;
z-index: 3;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
font-size: 2rem; font-size: 2rem;
color: grey; color: grey;
outline: 0.5rem solid rgba(255,255,255,.95);
} }
/* /*
+1 -1
View File
File diff suppressed because one or more lines are too long
+3 -2
View File
@@ -1486,8 +1486,9 @@ class MessagesView extends React.Component {
onClearError={this.props.onError} /> onClearError={this.props.onError} />
: null} : null}
<LoadSpinner show={this.state.fetchingMessages} /> <LoadSpinner show={this.state.fetchingMessages} />
{!this.state.unconfirmed && !this.props.forwardMessage ? {!this.state.unconfirmed && !this.props.forwardMessage && this.state.isWriter && !this.state.peerMessagingDisabled ?
<DragAndDrop actionPrompt={this.props.intl.formatMessage(messages.drag_file)} onDrop={this.handleFileDrop} >{messagesComponent}</DragAndDrop> <DragAndDrop actionPrompt={this.props.intl.formatMessage(messages.drag_file)}
onDrop={this.handleFileDrop} >{messagesComponent}</DragAndDrop>
: messagesComponent} : messagesComponent}
</> </>
); );
+5 -5
View File
@@ -22,7 +22,7 @@ export default class DragAndDrop extends React.PureComponent {
} }
componentDidMount() { componentDidMount() {
let div = this.dropRef.current; const div = this.dropRef.current;
div.addEventListener('dragenter', this.handleDragIn); div.addEventListener('dragenter', this.handleDragIn);
div.addEventListener('dragleave', this.handleDragOut); div.addEventListener('dragleave', this.handleDragOut);
div.addEventListener('dragover', this.handleDrag); div.addEventListener('dragover', this.handleDrag);
@@ -30,7 +30,7 @@ export default class DragAndDrop extends React.PureComponent {
} }
componentWillUnmount() { componentWillUnmount() {
let div = this.dropRef.current; const div = this.dropRef.current;
div.removeEventListener('dragenter', this.handleDragIn); div.removeEventListener('dragenter', this.handleDragIn);
div.removeEventListener('dragleave', this.handleDragOut); div.removeEventListener('dragleave', this.handleDragOut);
div.removeEventListener('dragover', this.handleDrag); div.removeEventListener('dragover', this.handleDrag);
@@ -55,7 +55,7 @@ export default class DragAndDrop extends React.PureComponent {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.dragCounter--; this.dragCounter--;
if (this.dragCounter == 0) { if (this.dragCounter <= 0) {
this.setState({dragging: false}); this.setState({dragging: false});
} }
} }
@@ -73,9 +73,9 @@ export default class DragAndDrop extends React.PureComponent {
render() { render() {
return ( return (
<div className='drag-and-drop' ref={this.dropRef}> <div className="drag-and-drop" ref={this.dropRef}>
{this.state.dragging ? {this.state.dragging ?
<div className='banner'>{this.props.actionPrompt}</div> <div className="banner">{this.props.actionPrompt}</div>
: null} : null}
{this.props.children} {this.props.children}
</div> </div>
+4 -4
View File
@@ -6712,7 +6712,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
onClearError: this.props.onError onClearError: this.props.onError
}) : null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_load_spinner_jsx__WEBPACK_IMPORTED_MODULE_13__["default"], { }) : null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_load_spinner_jsx__WEBPACK_IMPORTED_MODULE_13__["default"], {
show: this.state.fetchingMessages show: this.state.fetchingMessages
}), !this.state.unconfirmed && !this.props.forwardMessage ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_drag_and_drop_jsx__WEBPACK_IMPORTED_MODULE_7__["default"], { }), !this.state.unconfirmed && !this.props.forwardMessage && this.state.isWriter && !this.state.peerMessagingDisabled ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_drag_and_drop_jsx__WEBPACK_IMPORTED_MODULE_7__["default"], {
actionPrompt: this.props.intl.formatMessage(messages.drag_file), actionPrompt: this.props.intl.formatMessage(messages.drag_file),
onDrop: this.handleFileDrop onDrop: this.handleFileDrop
}, messagesComponent) : messagesComponent); }, messagesComponent) : messagesComponent);
@@ -12702,14 +12702,14 @@ class DragAndDrop extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComp
this.handleDrop = this.handleDrop.bind(this); this.handleDrop = this.handleDrop.bind(this);
} }
componentDidMount() { componentDidMount() {
let div = this.dropRef.current; const div = this.dropRef.current;
div.addEventListener('dragenter', this.handleDragIn); div.addEventListener('dragenter', this.handleDragIn);
div.addEventListener('dragleave', this.handleDragOut); div.addEventListener('dragleave', this.handleDragOut);
div.addEventListener('dragover', this.handleDrag); div.addEventListener('dragover', this.handleDrag);
div.addEventListener('drop', this.handleDrop); div.addEventListener('drop', this.handleDrop);
} }
componentWillUnmount() { componentWillUnmount() {
let div = this.dropRef.current; const div = this.dropRef.current;
div.removeEventListener('dragenter', this.handleDragIn); div.removeEventListener('dragenter', this.handleDragIn);
div.removeEventListener('dragleave', this.handleDragOut); div.removeEventListener('dragleave', this.handleDragOut);
div.removeEventListener('dragover', this.handleDrag); div.removeEventListener('dragover', this.handleDrag);
@@ -12733,7 +12733,7 @@ class DragAndDrop extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComp
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.dragCounter--; this.dragCounter--;
if (this.dragCounter == 0) { if (this.dragCounter <= 0) {
this.setState({ this.setState({
dragging: false dragging: false
}); });
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long