Skip to content

added toast for sending empty string under message tab #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 27 additions & 16 deletions src/components/Shares.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<a class="button is-primary" aria-label="Add File/Folder" title="Add File/Folder">
<file-upload-icon class="icon is-small"></file-upload-icon>
<span class="icon-text">Add File</span>
<form class="form" action="./upload" enctype="multipart/form-data" method="POST">
<input type="file" id="file" name="file" multiple>
</form>
</a>
</b-upload>
</div>
Expand Down Expand Up @@ -563,25 +566,33 @@ export default {
},

sendMsg () {
const data = {
type: 'msg',
msg: this.msg,
time: new Date().toLocaleTimeString()
}

this.$store.commit('addMessage', {
...data,
...{
name: this.$store.state.settings.name,
color: this.$store.state.settings.color
// Check if message is empty
if (this.msg === '') {
this.$buefy.toast.open({
duration: 2000,
message: 'Message cannot be empty!',
position: 'is-top',
type: 'is-danger'
})
} else {
const data = {
type: 'msg',
msg: this.msg,
time: new Date().toLocaleTimeString()
}
})
this.$store.commit('addMessage', {
...data,
...{
name: this.$store.state.settings.name,
color: this.$store.state.settings.color
}
})

for (const key in this.$store.state.users) {
const user = this.$store.state.users[key]
this.$store.state.p2pt.send(user.conn, data)
for (const key in this.$store.state.users) {
const user = this.$store.state.users[key]
this.$store.state.p2pt.send(user.conn, data)
}
}

this.msg = ''
},

Expand Down
22 changes: 22 additions & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,28 @@ module.exports = {
purpose: "any maskable",
},
],
share_targets: [
{
action: "./upload",
method: "POST",
enctype: "multipart/form-data",
params: {
title: "WebDrop",
text: "WebDrop",
url: "https://webdrop.space",
files: [
{
name: "image",
accept: ["image/*"],
},
{
name: "pdf",
accept: "application/pdf",
},
],
},
},
],
},
themeColor: "#23D160",
msTileColor: "#000000",
Expand Down