small fixes and style changes

This commit is contained in:
schlagmichdoch 2023-01-17 14:00:01 +01:00
parent c7ee067ef2
commit 474eb9290f
4 changed files with 18 additions and 8 deletions

View file

@ -128,11 +128,11 @@
</x-background>
</form>
</x-dialog>
<!-- Receive Dialog -->
<x-dialog id="receiveDialog">
<!-- Receive File Dialog -->
<x-dialog id="receiveFileDialog">
<x-background class="full center">
<x-paper shadow="2">
<h2 class="center">PairDrop</h2>
<h2 class="center" id="receiveTitle"></h2>
<div class="text-center file-description"></div>
<div class="font-body2 text-center file-size"></div>
<div class="center file-preview"></div>

View file

@ -361,7 +361,7 @@ class Peer {
this._onDownloadProgress(message.progress);
break;
case 'files-transfer-response':
this._onFileTransferResponded(message);
this._onFileTransferRequestResponded(message);
break;
case 'file-transfer-complete':
this._onFileTransferCompleted();
@ -456,7 +456,7 @@ class Peer {
Events.fire('deactivate-paste-mode');
}
_onFileTransferResponded(message) {
_onFileTransferRequestResponded(message) {
if (!message.accepted) {
Events.fire('set-progress', {peerId: this._peerId, progress: 1, status: 'wait'});

View file

@ -438,9 +438,10 @@ class ReceiveDialog extends Dialog {
class ReceiveFileDialog extends ReceiveDialog {
constructor() {
super('receiveDialog', false);
super('receiveFileDialog', false);
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));
this._filesQueue = [];
@ -503,13 +504,16 @@ class ReceiveFileDialog extends ReceiveDialog {
let description;
let size;
let filename;
let title;
if (files.length === 1) {
title = 'PairDrop - File Received'
description = files[0].name;
size = this._formatFileSize(files[0].size);
filename = files[0].name;
url = URL.createObjectURL(files[0])
} else {
title = `PairDrop - ${files.length} Files Received`
let completeSize = 0
for (let i=0; i<files.length; i++) {
completeSize += files[0].size;
@ -535,9 +539,9 @@ class ReceiveFileDialog extends ReceiveDialog {
filename = `PairDrop_files_${year+month+date}_${hours+minutes}.zip`;
}
this.$receiveTitleNode.textContent = title;
this.$fileDescriptionNode.textContent = description;
this.$fileSizeNode.textContent = size;
this.$shareOrDownloadBtn.download = filename;
if ((window.iOS || window.android) && !!navigator.share && navigator.canShare({files})) {
this.$shareOrDownloadBtn.innerText = "Share";
@ -549,6 +553,7 @@ class ReceiveFileDialog extends ReceiveDialog {
this.$shareOrDownloadBtn.addEventListener("click", this.continueCallback);
} else {
this.$shareOrDownloadBtn.innerText = "Download";
this.$shareOrDownloadBtn.download = filename;
this.$shareOrDownloadBtn.href = url;
}

View file

@ -471,6 +471,11 @@ x-dialog h2 {
margin-top: 1rem;
}
#receiveRequestDialog h2,
#receiveFileDialog h2 {
margin-bottom: 0.5rem;
}
x-dialog .row-reverse {
margin: auto -24px;
margin-top: 40px;
@ -489,7 +494,7 @@ x-dialog .row-reverse {
}
.file-size{
padding-bottom: 5px;
margin-bottom: 30px;
}
/* Send Text Dialog */