diff --git a/src/stores/favorite.js b/src/stores/favorite.js index 02d80c2d..33b534db 100644 --- a/src/stores/favorite.js +++ b/src/stores/favorite.js @@ -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` */ function clearBulkFavoriteSelection() { let ctx; - for (ctx of state.favoriteFriends) { + for (ctx of state.favoriteFriends_) { ctx.$selected = false; } - for (ctx of state.favoriteWorlds) { + for (ctx of state.favoriteWorlds_) { ctx.$selected = false; } - for (ctx of state.favoriteAvatars) { + for (ctx of state.favoriteAvatars_) { ctx.$selected = false; } } @@ -1967,7 +1924,6 @@ export const useFavoriteStore = defineStore('Favorite', () => { showWorldImportDialog, showAvatarImportDialog, showFriendImportDialog, - bulkCopyFavoriteSelection, getLocalWorldFavoriteGroupLength, addLocalWorldFavorite, hasLocalWorldFavorite, diff --git a/src/views/Favorites/Favorites.vue b/src/views/Favorites/Favorites.vue index e5af090a..a6fc739c 100644 --- a/src/views/Favorites/Favorites.vue +++ b/src/views/Favorites/Favorites.vue @@ -3,7 +3,9 @@
{{ t('view.favorite.clear') }} - {{ t('view.favorite.copy') }} + {{ + t('view.favorite.copy') + }} {{ t('view.favorite.bulk_unfavorite') }} @@ -72,15 +74,20 @@ favoriteAvatars, isFavoriteLoading, localAvatarFavoritesList, - localWorldFavoritesList + localWorldFavoritesList, + avatarImportDialogInput, + worldImportDialogInput, + friendImportDialogInput } = storeToRefs(useFavoriteStore()); const { refreshFavorites, refreshFavoriteGroups, clearBulkFavoriteSelection, - bulkCopyFavoriteSelection, getLocalWorldFavorites, - handleFavoriteGroup + handleFavoriteGroup, + showFriendImportDialog, + showWorldImportDialog, + showAvatarImportDialog } = useFavoriteStore(); const { menuActiveIndex } = storeToRefs(useUiStore()); 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() { if (refreshingLocalFavorites.value) { return;