mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-21 15:26:17 -04:00
small fixes and style changes
This commit is contained in:
parent
c7ee067ef2
commit
474eb9290f
4 changed files with 18 additions and 8 deletions
|
@ -128,11 +128,11 @@
|
||||||
</x-background>
|
</x-background>
|
||||||
</form>
|
</form>
|
||||||
</x-dialog>
|
</x-dialog>
|
||||||
<!-- Receive Dialog -->
|
<!-- Receive File Dialog -->
|
||||||
<x-dialog id="receiveDialog">
|
<x-dialog id="receiveFileDialog">
|
||||||
<x-background class="full center">
|
<x-background class="full center">
|
||||||
<x-paper shadow="2">
|
<x-paper shadow="2">
|
||||||
<h2 class="center">PairDrop</h2>
|
<h2 class="center" id="receiveTitle"></h2>
|
||||||
<div class="text-center file-description"></div>
|
<div class="text-center file-description"></div>
|
||||||
<div class="font-body2 text-center file-size"></div>
|
<div class="font-body2 text-center file-size"></div>
|
||||||
<div class="center file-preview"></div>
|
<div class="center file-preview"></div>
|
||||||
|
|
|
@ -361,7 +361,7 @@ class Peer {
|
||||||
this._onDownloadProgress(message.progress);
|
this._onDownloadProgress(message.progress);
|
||||||
break;
|
break;
|
||||||
case 'files-transfer-response':
|
case 'files-transfer-response':
|
||||||
this._onFileTransferResponded(message);
|
this._onFileTransferRequestResponded(message);
|
||||||
break;
|
break;
|
||||||
case 'file-transfer-complete':
|
case 'file-transfer-complete':
|
||||||
this._onFileTransferCompleted();
|
this._onFileTransferCompleted();
|
||||||
|
@ -456,7 +456,7 @@ class Peer {
|
||||||
Events.fire('deactivate-paste-mode');
|
Events.fire('deactivate-paste-mode');
|
||||||
}
|
}
|
||||||
|
|
||||||
_onFileTransferResponded(message) {
|
_onFileTransferRequestResponded(message) {
|
||||||
if (!message.accepted) {
|
if (!message.accepted) {
|
||||||
Events.fire('set-progress', {peerId: this._peerId, progress: 1, status: 'wait'});
|
Events.fire('set-progress', {peerId: this._peerId, progress: 1, status: 'wait'});
|
||||||
|
|
||||||
|
|
|
@ -438,9 +438,10 @@ class ReceiveDialog extends Dialog {
|
||||||
class ReceiveFileDialog extends ReceiveDialog {
|
class ReceiveFileDialog extends ReceiveDialog {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('receiveDialog', false);
|
super('receiveFileDialog', false);
|
||||||
|
|
||||||
this.$shareOrDownloadBtn = this.$el.querySelector('#shareOrDownload');
|
this.$shareOrDownloadBtn = this.$el.querySelector('#shareOrDownload');
|
||||||
|
this.$receiveTitleNode = this.$el.querySelector('#receiveTitle')
|
||||||
|
|
||||||
Events.on('files-received', e => this._onFilesReceived(e.detail.sender, e.detail.files));
|
Events.on('files-received', e => this._onFilesReceived(e.detail.sender, e.detail.files));
|
||||||
this._filesQueue = [];
|
this._filesQueue = [];
|
||||||
|
@ -503,13 +504,16 @@ class ReceiveFileDialog extends ReceiveDialog {
|
||||||
let description;
|
let description;
|
||||||
let size;
|
let size;
|
||||||
let filename;
|
let filename;
|
||||||
|
let title;
|
||||||
|
|
||||||
if (files.length === 1) {
|
if (files.length === 1) {
|
||||||
|
title = 'PairDrop - File Received'
|
||||||
description = files[0].name;
|
description = files[0].name;
|
||||||
size = this._formatFileSize(files[0].size);
|
size = this._formatFileSize(files[0].size);
|
||||||
filename = files[0].name;
|
filename = files[0].name;
|
||||||
url = URL.createObjectURL(files[0])
|
url = URL.createObjectURL(files[0])
|
||||||
} else {
|
} else {
|
||||||
|
title = `PairDrop - ${files.length} Files Received`
|
||||||
let completeSize = 0
|
let completeSize = 0
|
||||||
for (let i=0; i<files.length; i++) {
|
for (let i=0; i<files.length; i++) {
|
||||||
completeSize += files[0].size;
|
completeSize += files[0].size;
|
||||||
|
@ -535,9 +539,9 @@ class ReceiveFileDialog extends ReceiveDialog {
|
||||||
filename = `PairDrop_files_${year+month+date}_${hours+minutes}.zip`;
|
filename = `PairDrop_files_${year+month+date}_${hours+minutes}.zip`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$receiveTitleNode.textContent = title;
|
||||||
this.$fileDescriptionNode.textContent = description;
|
this.$fileDescriptionNode.textContent = description;
|
||||||
this.$fileSizeNode.textContent = size;
|
this.$fileSizeNode.textContent = size;
|
||||||
this.$shareOrDownloadBtn.download = filename;
|
|
||||||
|
|
||||||
if ((window.iOS || window.android) && !!navigator.share && navigator.canShare({files})) {
|
if ((window.iOS || window.android) && !!navigator.share && navigator.canShare({files})) {
|
||||||
this.$shareOrDownloadBtn.innerText = "Share";
|
this.$shareOrDownloadBtn.innerText = "Share";
|
||||||
|
@ -549,6 +553,7 @@ class ReceiveFileDialog extends ReceiveDialog {
|
||||||
this.$shareOrDownloadBtn.addEventListener("click", this.continueCallback);
|
this.$shareOrDownloadBtn.addEventListener("click", this.continueCallback);
|
||||||
} else {
|
} else {
|
||||||
this.$shareOrDownloadBtn.innerText = "Download";
|
this.$shareOrDownloadBtn.innerText = "Download";
|
||||||
|
this.$shareOrDownloadBtn.download = filename;
|
||||||
this.$shareOrDownloadBtn.href = url;
|
this.$shareOrDownloadBtn.href = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -471,6 +471,11 @@ x-dialog h2 {
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#receiveRequestDialog h2,
|
||||||
|
#receiveFileDialog h2 {
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
x-dialog .row-reverse {
|
x-dialog .row-reverse {
|
||||||
margin: auto -24px;
|
margin: auto -24px;
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
|
@ -489,7 +494,7 @@ x-dialog .row-reverse {
|
||||||
}
|
}
|
||||||
|
|
||||||
.file-size{
|
.file-size{
|
||||||
padding-bottom: 5px;
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send Text Dialog */
|
/* Send Text Dialog */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue