mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-23 15:41:33 +00:00
moveToInbox action + actions array in bulkActions component
This commit is contained in:
@@ -3,15 +3,26 @@
|
|||||||
<span v-if="!allAreSelected && numberSelected > 0">-</span> <!-- later on this minus sign will be in the checkbox, as it is in gmail -->
|
<span v-if="!allAreSelected && numberSelected > 0">-</span> <!-- later on this minus sign will be in the checkbox, as it is in gmail -->
|
||||||
<input type="checkbox" :checked="allAreSelected" @click="bulkSelect">
|
<input type="checkbox" :checked="allAreSelected" @click="bulkSelect">
|
||||||
|
|
||||||
<button @click="emailSelection.markRead()" :disabled="Array.from(emailSelection.emails).every(e => e.read)">
|
<button @click="emailSelection.markRead()"
|
||||||
|
:disabled="Array.from(emailSelection.emails).every(e => e.read)"
|
||||||
|
v-if="actions.includes('markRead')">
|
||||||
Mark Read
|
Mark Read
|
||||||
</button>
|
</button>
|
||||||
<button @click="emailSelection.markUnread()" :disabled="Array.from(emailSelection.emails).every(e => !e.read)">
|
<button @click="emailSelection.markUnread()"
|
||||||
|
:disabled="Array.from(emailSelection.emails).every(e => !e.read)"
|
||||||
|
v-if="actions.includes('markUnread')">
|
||||||
Mark Unread
|
Mark Unread
|
||||||
</button>
|
</button>
|
||||||
<button @click="emailSelection.archive()" :disabled="numberSelected == 0">
|
<button @click="emailSelection.archive()"
|
||||||
|
:disabled="numberSelected == 0"
|
||||||
|
v-if="actions.includes('archive')">
|
||||||
Archive
|
Archive
|
||||||
</button>
|
</button>
|
||||||
|
<button @click="emailSelection.moveToInbox()"
|
||||||
|
:disabled="numberSelected == 0"
|
||||||
|
v-if="actions.includes('moveToInbox')">
|
||||||
|
Move to Inbox
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -42,6 +53,10 @@
|
|||||||
emails: {
|
emails: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: []
|
default: []
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
type: Array,
|
||||||
|
default: ['markRead', 'markUnread']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<h1>VMail Archives</h1>
|
<h1>VMail Archives</h1>
|
||||||
|
|
||||||
<BulkActionBar :emails="archivedEmails" />
|
<BulkActionBar :emails="archivedEmails" :actions="['markRead', 'markUnread', 'moveToInbox']" />
|
||||||
|
|
||||||
<MailTable :emails="archivedEmails" />
|
<MailTable :emails="archivedEmails" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<h1>VMail Inbox</h1>
|
<h1>VMail Inbox</h1>
|
||||||
|
|
||||||
<BulkActionBar :emails="inboxEmails" />
|
<BulkActionBar :emails="inboxEmails" :actions="['markRead', 'markUnread', 'archive']" />
|
||||||
|
|
||||||
<MailTable :emails="inboxEmails" />
|
<MailTable :emails="inboxEmails" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ export const useEmailSelection = function(){
|
|||||||
markRead(){ this.forSelected(e => e.read = true )},
|
markRead(){ this.forSelected(e => e.read = true )},
|
||||||
markUnread(){ this.forSelected(e => e.read = false )},
|
markUnread(){ this.forSelected(e => e.read = false )},
|
||||||
archive(){ this.forSelected(e => e.archived = true); this.clear();},
|
archive(){ this.forSelected(e => e.archived = true); this.clear();},
|
||||||
|
moveToInbox(){ this.forSelected(e => e.archived = false); this.clear();}
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user