diff --git a/html/src/app.js b/html/src/app.js index 02ceed1b..9e4a47d1 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -19799,6 +19799,29 @@ speechSynthesis.getVoices(); $app.getLocalWorldFavorites(); }); + $app.methods.refreshLocalWorldFavorites = async function () { + if (this.refreshingLocalFavorites) { + return; + } + this.refreshingLocalFavorites = true; + for (var worldId of this.localWorldFavoritesList) { + if (!this.refreshingLocalFavorites) { + break; + } + try { + await API.getWorld({ + worldId + }); + } catch (err) { + console.error(err); + } + await new Promise((resolve) => { + workerTimers.setTimeout(resolve, 1000); + }); + } + this.refreshingLocalFavorites = false; + }; + $app.data.worldFavoriteSearch = ''; $app.data.worldFavoriteSearchResults = []; @@ -20187,6 +20210,31 @@ speechSynthesis.getVoices(); }); }; + $app.data.refreshingLocalFavorites = false; + + $app.methods.refreshLocalAvatarFavorites = async function () { + if (this.refreshingLocalFavorites) { + return; + } + this.refreshingLocalFavorites = true; + for (var avatarId of this.localAvatarFavoritesList) { + if (!this.refreshingLocalFavorites) { + break; + } + try { + await API.getAvatar({ + avatarId + }); + } catch (err) { + console.error(err); + } + await new Promise((resolve) => { + workerTimers.setTimeout(resolve, 1000); + }); + } + this.refreshingLocalFavorites = false; + }; + $app.data.avatarFavoriteSearch = ''; $app.data.avatarFavoriteSearchResults = []; diff --git a/html/src/localization/en/en.json b/html/src/localization/en/en.json index 4f434ce4..eeae304f 100644 --- a/html/src/localization/en/en.json +++ b/html/src/localization/en/en.json @@ -90,14 +90,18 @@ "search": "Search", "vrchat_favorites": "VRChat Favorites", "local_favorites": "Local Favorites", - "new_group": "New Group" + "new_group": "New Group", + "refresh": "Refresh", + "cancel_refresh": "Cancel Refresh" }, "avatars": { "header": "Avatars", "search": "Search", "vrchat_favorites": "VRChat Favorites", "local_favorites": "Local Favorites (Requires VRC+)", - "new_group": "New Group" + "new_group": "New Group", + "refresh": "Refresh", + "cancel_refresh": "Cancel Refresh" }, "bulk_unfavorite_mode": "Bulk Unfavorite Mode", "bulk_unfavorite_selection": "Bulk Unfavorite Selection", diff --git a/html/src/mixins/tabs/favorites.pug b/html/src/mixins/tabs/favorites.pug index 78e4a2d4..1693ce95 100644 --- a/html/src/mixins/tabs/favorites.pug +++ b/html/src/mixins/tabs/favorites.pug @@ -12,7 +12,7 @@ mixin favoritesTab() el-tab-pane(:label="$t('view.favorite.friends.header')") el-collapse(v-if="$refs.menu && $refs.menu.activeIndex === 'favorite' && $refs.favoriteTabRef && $refs.favoriteTabRef.currentName === '0'" style="border:0") el-button(size="small" @click="showFriendExportDialog") {{ $t('view.favorite.export') }} - el-button(size="small" @click="showFriendImportDialog") {{ $t('view.favorite.import') }} + el-button(size="small" @click="showFriendImportDialog" style="margin-left:5px") {{ $t('view.favorite.import') }} div(style="display:inline-block;float:right;font-size:13px;margin-right:10px") span.name(style="margin-right:5px") {{ $t('view.favorite.sort_by') }} el-switch(v-model="sortFavorites" :inactive-text="$t('view.settings.appearance.appearance.sort_favorite_by_name')" :active-text="$t('view.settings.appearance.appearance.sort_favorite_by_date')" @change="saveSortFavoritesOption") @@ -54,7 +54,7 @@ mixin favoritesTab() el-tab-pane(:label="$t('view.favorite.worlds.header')") el-collapse(v-if="$refs.menu && $refs.menu.activeIndex === 'favorite' && $refs.favoriteTabRef && $refs.favoriteTabRef.currentName === '1'" style="border:0") el-button(size="small" @click="showWorldExportDialog") {{ $t('view.favorite.export') }} - el-button(size="small" @click="showWorldImportDialog") {{ $t('view.favorite.import') }} + el-button(size="small" @click="showWorldImportDialog" style="margin-left:5px") {{ $t('view.favorite.import') }} div(style="display:inline-block;float:right;font-size:13px;margin-right:10px") span.name(style="margin-right:5px") {{ $t('view.favorite.sort_by') }} el-switch(v-model="sortFavorites" :inactive-text="$t('view.settings.appearance.appearance.sort_favorite_by_name')" :active-text="$t('view.settings.appearance.appearance.sort_favorite_by_date')" @change="saveSortFavoritesOption") @@ -124,7 +124,12 @@ mixin favoritesTab() i.el-icon-warning(style="color:#f56c6c;margin-left:5px") el-button(type="text" icon="el-icon-close" size="mini" @click.stop="deleteFavorite(favorite.id)" style="margin-left:5px") span(style="display:block;margin-top:20px") {{ $t('view.favorite.worlds.local_favorites') }} - el-button(size="small" @click="promptNewLocalWorldFavoriteGroup" style="display:block;margin-top:10px") {{ $t('view.favorite.worlds.new_group') }} + br + el-button(size="small" @click="promptNewLocalWorldFavoriteGroup") {{ $t('view.favorite.worlds.new_group') }} + el-button(v-if="!refreshingLocalFavorites" size="small" @click="refreshLocalWorldFavorites" style="margin-left:5px") {{ $t('view.favorite.worlds.refresh') }} + el-button(v-else size="small" @click="refreshingLocalFavorites = false" style="margin-left:5px") + i.el-icon-loading(style="margin-right:5px") + span {{ $t('view.favorite.worlds.cancel_refresh') }} el-collapse-item(v-for="group in localWorldFavoriteGroups" v-if="localWorldFavorites[group]" :key="group") template(slot="title") span(v-text="group" style="font-weight:bold;font-size:14px;margin-left:10px") @@ -153,7 +158,7 @@ mixin favoritesTab() el-tab-pane(:label="$t('view.favorite.avatars.header')") el-collapse(v-if="$refs.menu && $refs.menu.activeIndex === 'favorite' && $refs.favoriteTabRef && $refs.favoriteTabRef.currentName === '2'" style="border:0") el-button(size="small" @click="showAvatarExportDialog") {{ $t('view.favorite.export') }} - el-button(size="small" @click="showAvatarImportDialog") {{ $t('view.favorite.import') }} + el-button(size="small" @click="showAvatarImportDialog" style="margin-left:5px") {{ $t('view.favorite.import') }} div(style="display:inline-block;float:right;font-size:13px;margin-right:10px") span.name(style="margin-right:5px") {{ $t('view.favorite.sort_by') }} el-switch(v-model="sortFavorites" :inactive-text="$t('view.settings.appearance.appearance.sort_favorite_by_name')" :active-text="$t('view.settings.appearance.appearance.sort_favorite_by_date')" @change="saveSortFavoritesOption") @@ -237,7 +242,12 @@ mixin favoritesTab() el-tooltip(placement="right" content="Favorite" :disabled="hideTooltips") el-button(@click.stop="showFavoriteDialog('avatar', favorite.id)" type="default" icon="el-icon-star-off" size="mini" circle style="margin-left:5px") span(style="display:block;margin-top:20px") {{ $t('view.favorite.avatars.local_favorites') }} - el-button(size="small" :disabled="!isLocalUserVrcplusSupporter()" @click="promptNewLocalAvatarFavoriteGroup" style="display:block;margin-top:10px") {{ $t('view.favorite.avatars.new_group') }} + br + el-button(size="small" :disabled="!isLocalUserVrcplusSupporter()" @click="promptNewLocalAvatarFavoriteGroup") {{ $t('view.favorite.avatars.new_group') }} + el-button(v-if="!refreshingLocalFavorites" size="small" @click="refreshLocalAvatarFavorites" style=";margin-left:5px") {{ $t('view.favorite.avatars.refresh') }} + el-button(v-else size="small" @click="refreshingLocalFavorites = false" style="margin-left:5px") + i.el-icon-loading(style="margin-right:5px") + span {{ $t('view.favorite.avatars.cancel_refresh') }} el-collapse-item(v-for="group in localAvatarFavoriteGroups" v-if="localAvatarFavorites[group]" :key="group") template(slot="title") span(v-text="group" style="font-weight:bold;font-size:14px;margin-left:10px")