Skip to content
Merged
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
68 changes: 48 additions & 20 deletions frontend/src/modules/member/components/list/member-list-toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
v-if="selectedRows.length > 0"
class="app-list-table-bulk-actions"
>
<span class="block text-sm font-semibold mr-4"
>{{ selectedRows.length }}
{{ selectedRows.length > 1 ? 'members' : 'member' }}
<span class="block text-sm font-semibold mr-4">
{{ pluralize('member', selectedRows.length, true) }}
selected</span
>
<el-dropdown trigger="click" @command="handleCommand">
Expand All @@ -14,7 +13,7 @@
<i class="ri-xl ri-arrow-down-s-line"></i>
</button>
<template #dropdown>
<el-dropdown-item command="export">
<el-dropdown-item :command="{ action: 'export' }">
<i class="ri-lg ri-file-download-line mr-1" />
Export to CSV
</el-dropdown-item>
Expand All @@ -27,7 +26,7 @@
>
<span>
<el-dropdown-item
command="enrichMember"
:command="{ action: 'enrichMember' }"
:disabled="
!elegibleEnrichmentMembersIds.length
"
Expand All @@ -43,21 +42,25 @@
</span>
</el-tooltip>
<el-dropdown-item
command="markAsTeamMember"
:command="{
action: 'markAsTeamMember',
value: markAsTeamMemberOptions.value
}"
:disabled="isReadOnly"
>
<i class="ri-lg ri-bookmark-line mr-1" />
Mark as team member{{
selectedRows.length === 1 ? '' : 's'
}}
<i
class="ri-lg mr-1"
:class="markAsTeamMemberOptions.icon"
/>
{{ markAsTeamMemberOptions.copy }}
</el-dropdown-item>
<el-dropdown-item command="editTags">
<el-dropdown-item :command="{ action: 'editTags' }">
<i class="ri-lg ri-price-tag-3-line mr-1" />
Edit tags
</el-dropdown-item>
<hr class="border-gray-200 my-1 mx-2" />
<el-dropdown-item
command="destroyAll"
:command="{ action: 'destroyAll' }"
:disabled="isReadOnly"
>
<div class="text-red-500 flex items-center">
Expand Down Expand Up @@ -105,7 +108,8 @@ export default {
...mapGetters({
currentUser: 'auth/currentUser',
currentTenant: 'auth/currentTenant',
selectedRows: 'member/selectedRows'
selectedRows: 'member/selectedRows',
activeView: 'member/activeView'
}),
isReadOnly() {
return (
Expand Down Expand Up @@ -133,6 +137,28 @@ export default {
return this.selectedRows.some(
(item) => !item.lastEnriched
)
},
markAsTeamMemberOptions() {
const isTeamView = this.activeView.id === 'team'
const membersCopy = pluralize(
'member',
this.selectedRows.length,
false
)

if (isTeamView) {
return {
icon: 'ri-bookmark-2-line',
copy: `Unmark as team ${membersCopy}`,
value: false
}
}

return {
icon: 'ri-bookmark-line',
copy: `Mark as team ${membersCopy}`,
value: true
}
}
},

Expand All @@ -145,15 +171,15 @@ export default {
}),

async handleCommand(command) {
if (command === 'markAsTeamMember') {
await this.doMarkAsTeamMember()
} else if (command === 'export') {
if (command.action === 'markAsTeamMember') {
await this.doMarkAsTeamMember(command.value)
} else if (command.action === 'export') {
await this.handleDoExport()
} else if (command === 'editTags') {
} else if (command.action === 'editTags') {
await this.handleAddTags()
} else if (command === 'destroyAll') {
} else if (command.action === 'destroyAll') {
await this.doDestroyAllWithConfirm()
} else if (command === 'enrichMember') {
} else if (command.action === 'enrichMember') {
// All members are elegible for enrichment
if (
this.elegibleEnrichmentMembersIds.length ===
Expand Down Expand Up @@ -220,7 +246,9 @@ export default {

async handleAddTags() {
this.bulkTagsUpdateVisible = true
}
},

pluralize
}
}
</script>
2 changes: 1 addition & 1 deletion frontend/src/modules/member/components/member-badge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const props = defineProps({
})

const isTeam = computed(() => {
return props.member.attributes.isTeamMember
return props.member.attributes.isTeamMember?.default
})

const isBot = computed(() => {
Expand Down
19 changes: 17 additions & 2 deletions frontend/src/modules/member/components/member-dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,29 @@
class="h-10"
:command="{
action: 'memberMarkAsTeamMember',
member: member
member: member,
value: true
}"
><i
class="ri-bookmark-line text-base mr-2"
/><span class="text-xs text-gray-900"
>Mark as team member</span
></el-dropdown-item
>
<el-dropdown-item
v-if="member.attributes.isTeamMember?.default"
class="h-10"
:command="{
action: 'memberMarkAsTeamMember',
member: member,
value: false
}"
><i
class="ri-bookmark-2-line text-base mr-2"
/><span class="text-xs text-gray-900"
>Unmark as team member</span
></el-dropdown-item
>
<el-dropdown-item
v-if="!member.attributes.isBot?.default"
class="h-10"
Expand Down Expand Up @@ -263,7 +278,7 @@ export default {
attributes: {
...command.member.attributes,
isTeamMember: {
default: true
default: command.value
}
}
})
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/modules/member/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default {
}
},

async doMarkAsTeamMember({ dispatch, getters }) {
async doMarkAsTeamMember({ dispatch, getters }, value) {
try {
const selectedRows = getters.selectedRows

Expand All @@ -134,8 +134,7 @@ export default {
attributes: {
...row.attributes,
isTeamMember: {
crowd: true,
default: true
default: value
}
}
})
Expand Down