mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 14:56:06 +02:00
Add select all / deselect all button to favorites (#1501)
This commit is contained in:
@@ -194,6 +194,13 @@
|
||||
</div>
|
||||
<div class="favorites-content__edit-actions">
|
||||
<div v-if="friendEditMode && !isSearchActive" class="favorites-content__actions">
|
||||
<el-button size="small" @click="toggleSelectAllFriends">
|
||||
{{
|
||||
isAllFriendsSelected
|
||||
? t('view.favorite.deselect_all')
|
||||
: t('view.favorite.select_all')
|
||||
}}
|
||||
</el-button>
|
||||
<el-button size="small" :disabled="!hasFriendSelection" @click="clearSelectedFriends">
|
||||
{{ t('view.favorite.clear') }}
|
||||
</el-button>
|
||||
@@ -426,6 +433,15 @@
|
||||
return groupedByGroupKeyFavoriteFriends.value[activeRemoteGroup.value.key] || [];
|
||||
});
|
||||
|
||||
const isAllFriendsSelected = computed(() => {
|
||||
if (!activeRemoteGroup.value || !currentFriendFavorites.value.length) {
|
||||
return false;
|
||||
}
|
||||
return currentFriendFavorites.value
|
||||
.map((fav) => fav.id)
|
||||
.every((id) => selectedFavoriteFriends.value.includes(id));
|
||||
});
|
||||
|
||||
watch(
|
||||
() => favoriteFriendGroups.value.map((group) => `${group.key}:${group.count}`),
|
||||
() => {
|
||||
@@ -548,6 +564,17 @@
|
||||
selectedFavoriteFriends.value = [];
|
||||
}
|
||||
|
||||
function toggleSelectAllFriends() {
|
||||
if (!activeRemoteGroup.value) {
|
||||
return;
|
||||
}
|
||||
if (isAllFriendsSelected.value) {
|
||||
selectedFavoriteFriends.value = [];
|
||||
} else {
|
||||
selectedFavoriteFriends.value = currentFriendFavorites.value.map((fav) => fav.id);
|
||||
}
|
||||
}
|
||||
|
||||
function copySelectedFriends() {
|
||||
if (!selectedFavoriteFriends.value.length) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user