mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 14:46:04 +02:00
Fix clear and copy favorites
This commit is contained in:
+3
-47
@@ -1187,61 +1187,18 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* aka: `$app.methods.bulkCopyFavoriteSelection`
|
|
||||||
* @param {'friend'|'world'|'avatar'} type
|
|
||||||
*/
|
|
||||||
function bulkCopyFavoriteSelection(type) {
|
|
||||||
let idList = '';
|
|
||||||
switch (type) {
|
|
||||||
case 'friend':
|
|
||||||
for (const ctx of state.favoriteFriends) {
|
|
||||||
if (ctx.$selected) {
|
|
||||||
idList += `${ctx.id}\n`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state.friendImportDialogInput = idList;
|
|
||||||
showFriendImportDialog();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'world':
|
|
||||||
for (const ctx of state.favoriteWorlds) {
|
|
||||||
if (ctx.$selected) {
|
|
||||||
idList += `${ctx.id}\n`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state.worldImportDialogInput = idList;
|
|
||||||
showWorldImportDialog();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'avatar':
|
|
||||||
for (const ctx of state.favoriteAvatars) {
|
|
||||||
if (ctx.$selected) {
|
|
||||||
idList += `${ctx.id}\n`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state.avatarImportDialogInput = idList;
|
|
||||||
showAvatarImportDialog();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
console.log('Favorite selection\n', idList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* aka: `$app.methods.clearBulkFavoriteSelection`
|
* aka: `$app.methods.clearBulkFavoriteSelection`
|
||||||
*/
|
*/
|
||||||
function clearBulkFavoriteSelection() {
|
function clearBulkFavoriteSelection() {
|
||||||
let ctx;
|
let ctx;
|
||||||
for (ctx of state.favoriteFriends) {
|
for (ctx of state.favoriteFriends_) {
|
||||||
ctx.$selected = false;
|
ctx.$selected = false;
|
||||||
}
|
}
|
||||||
for (ctx of state.favoriteWorlds) {
|
for (ctx of state.favoriteWorlds_) {
|
||||||
ctx.$selected = false;
|
ctx.$selected = false;
|
||||||
}
|
}
|
||||||
for (ctx of state.favoriteAvatars) {
|
for (ctx of state.favoriteAvatars_) {
|
||||||
ctx.$selected = false;
|
ctx.$selected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1967,7 +1924,6 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
|||||||
showWorldImportDialog,
|
showWorldImportDialog,
|
||||||
showAvatarImportDialog,
|
showAvatarImportDialog,
|
||||||
showFriendImportDialog,
|
showFriendImportDialog,
|
||||||
bulkCopyFavoriteSelection,
|
|
||||||
getLocalWorldFavoriteGroupLength,
|
getLocalWorldFavoriteGroupLength,
|
||||||
addLocalWorldFavorite,
|
addLocalWorldFavorite,
|
||||||
hasLocalWorldFavorite,
|
hasLocalWorldFavorite,
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
<div style="font-size: 13px; position: absolute; display: flex; right: 0; z-index: 1; margin-right: 15px">
|
<div style="font-size: 13px; position: absolute; display: flex; right: 0; z-index: 1; margin-right: 15px">
|
||||||
<div v-if="editFavoritesMode" style="display: inline-block; margin-right: 10px">
|
<div v-if="editFavoritesMode" style="display: inline-block; margin-right: 10px">
|
||||||
<el-button size="small" @click="clearBulkFavoriteSelection">{{ t('view.favorite.clear') }}</el-button>
|
<el-button size="small" @click="clearBulkFavoriteSelection">{{ t('view.favorite.clear') }}</el-button>
|
||||||
<el-button size="small" @click="bulkCopyFavoriteSelection">{{ t('view.favorite.copy') }}</el-button>
|
<el-button size="small" @click="handleBulkCopyFavoriteSelection">{{
|
||||||
|
t('view.favorite.copy')
|
||||||
|
}}</el-button>
|
||||||
<el-button size="small" @click="showBulkUnfavoriteSelectionConfirm">{{
|
<el-button size="small" @click="showBulkUnfavoriteSelectionConfirm">{{
|
||||||
t('view.favorite.bulk_unfavorite')
|
t('view.favorite.bulk_unfavorite')
|
||||||
}}</el-button>
|
}}</el-button>
|
||||||
@@ -72,15 +74,20 @@
|
|||||||
favoriteAvatars,
|
favoriteAvatars,
|
||||||
isFavoriteLoading,
|
isFavoriteLoading,
|
||||||
localAvatarFavoritesList,
|
localAvatarFavoritesList,
|
||||||
localWorldFavoritesList
|
localWorldFavoritesList,
|
||||||
|
avatarImportDialogInput,
|
||||||
|
worldImportDialogInput,
|
||||||
|
friendImportDialogInput
|
||||||
} = storeToRefs(useFavoriteStore());
|
} = storeToRefs(useFavoriteStore());
|
||||||
const {
|
const {
|
||||||
refreshFavorites,
|
refreshFavorites,
|
||||||
refreshFavoriteGroups,
|
refreshFavoriteGroups,
|
||||||
clearBulkFavoriteSelection,
|
clearBulkFavoriteSelection,
|
||||||
bulkCopyFavoriteSelection,
|
|
||||||
getLocalWorldFavorites,
|
getLocalWorldFavorites,
|
||||||
handleFavoriteGroup
|
handleFavoriteGroup,
|
||||||
|
showFriendImportDialog,
|
||||||
|
showWorldImportDialog,
|
||||||
|
showAvatarImportDialog
|
||||||
} = useFavoriteStore();
|
} = useFavoriteStore();
|
||||||
const { menuActiveIndex } = storeToRefs(useUiStore());
|
const { menuActiveIndex } = storeToRefs(useUiStore());
|
||||||
const { applyAvatar } = useAvatarStore();
|
const { applyAvatar } = useAvatarStore();
|
||||||
@@ -175,6 +182,49 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleBulkCopyFavoriteSelection() {
|
||||||
|
let idList = '';
|
||||||
|
switch (currentTabName.value) {
|
||||||
|
case 'friend':
|
||||||
|
for (const ctx of favoriteFriends.value) {
|
||||||
|
if (ctx.$selected) {
|
||||||
|
idList += `${ctx.id}\n`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
friendImportDialogInput.value = idList;
|
||||||
|
showFriendImportDialog();
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'world':
|
||||||
|
for (const ctx of favoriteWorlds.value) {
|
||||||
|
if (ctx.$selected) {
|
||||||
|
idList += `${ctx.id}\n`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
worldImportDialogInput.value = idList;
|
||||||
|
showWorldImportDialog();
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'avatar':
|
||||||
|
for (const ctx of favoriteAvatars.value) {
|
||||||
|
if (ctx.$selected) {
|
||||||
|
idList += `${ctx.id}\n`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
avatarImportDialogInput.value = idList;
|
||||||
|
showAvatarImportDialog();
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Favorite selection\n', idList);
|
||||||
|
}
|
||||||
|
|
||||||
async function refreshLocalAvatarFavorites() {
|
async function refreshLocalAvatarFavorites() {
|
||||||
if (refreshingLocalFavorites.value) {
|
if (refreshingLocalFavorites.value) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user