mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
Load avatars/worlds on tab click
This commit is contained in:
+76
-22
@@ -1421,7 +1421,7 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var array = Array.from(map.values());
|
var array = Array.from(map.values());
|
||||||
$app.setUserDialogWorlds(array);
|
$app.sortUserDialogWorlds(array);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1816,7 +1816,7 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var array = Array.from(map.values());
|
var array = Array.from(map.values());
|
||||||
$app.setUserDialogAvatars(array);
|
$app.sortUserDialogAvatars(array);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -7667,6 +7667,8 @@ speechSynthesis.getVoices();
|
|||||||
D.memo = this.loadMemo(userId);
|
D.memo = this.loadMemo(userId);
|
||||||
D.visible = true;
|
D.visible = true;
|
||||||
D.loading = true;
|
D.loading = true;
|
||||||
|
D.avatars = [];
|
||||||
|
D.worlds = [];
|
||||||
API.getCachedUser({
|
API.getCachedUser({
|
||||||
userId
|
userId
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
@@ -7699,23 +7701,27 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
D.isFavorite = API.cachedFavoritesByObjectId.has(D.id);
|
D.isFavorite = API.cachedFavoritesByObjectId.has(D.id);
|
||||||
this.applyUserDialogLocation();
|
this.applyUserDialogLocation();
|
||||||
var worlds = [];
|
if (this.$refs.userDialogTabs.currentName === '0') {
|
||||||
for (var ref of API.cachedWorlds.values()) {
|
this.userDialogLastActiveTab = 'Info';
|
||||||
if (ref.authorId === D.id) {
|
} else if (this.$refs.userDialogTabs.currentName === '1') {
|
||||||
worlds.push(ref);
|
this.userDialogLastActiveTab = 'Worlds';
|
||||||
|
this.setUserDialogWorlds(userId);
|
||||||
|
if (this.userDialogLastWorld !== userId) {
|
||||||
|
this.userDialogLastWorld = userId;
|
||||||
|
this.refreshUserDialogWorlds();
|
||||||
}
|
}
|
||||||
}
|
} else if (this.$refs.userDialogTabs.currentName === '2') {
|
||||||
this.setUserDialogWorlds(worlds);
|
this.userDialogLastActiveTab = 'Avatars';
|
||||||
var avatars = [];
|
this.setUserDialogAvatars(userId);
|
||||||
for (var ref of API.cachedAvatars.values()) {
|
if (this.userDialogLastAvatar !== userId) {
|
||||||
if (ref.authorId === D.id) {
|
this.userDialogLastAvatar = userId;
|
||||||
avatars.push(ref);
|
if ((userId === API.currentUser.id) && (D.avatars.length === 0)) {
|
||||||
|
this.refreshUserDialogAvatars();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else if (this.$refs.userDialogTabs.currentName === '3') {
|
||||||
|
this.userDialogLastActiveTab = 'JSON';
|
||||||
}
|
}
|
||||||
this.setUserDialogAvatars(avatars);
|
|
||||||
D.avatars = avatars;
|
|
||||||
D.isWorldsLoading = false;
|
|
||||||
D.isAvatarsLoading = false;
|
|
||||||
API.getFriendStatus({
|
API.getFriendStatus({
|
||||||
userId: D.id
|
userId: D.id
|
||||||
});
|
});
|
||||||
@@ -7836,7 +7842,17 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.setUserDialogWorlds = function (array) {
|
$app.methods.setUserDialogWorlds = function (userId) {
|
||||||
|
var worlds = [];
|
||||||
|
for (var ref of API.cachedWorlds.values()) {
|
||||||
|
if (ref.authorId === userId) {
|
||||||
|
worlds.push(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.sortUserDialogWorlds(worlds);
|
||||||
|
};
|
||||||
|
|
||||||
|
$app.methods.sortUserDialogWorlds = function (array) {
|
||||||
var D = this.userDialog;
|
var D = this.userDialog;
|
||||||
if (D.worldSorting === 'update') {
|
if (D.worldSorting === 'update') {
|
||||||
array.sort(compareByUpdatedAt);
|
array.sort(compareByUpdatedAt);
|
||||||
@@ -7846,7 +7862,17 @@ speechSynthesis.getVoices();
|
|||||||
D.worlds = array;
|
D.worlds = array;
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.setUserDialogAvatars = function (array) {
|
$app.methods.setUserDialogAvatars = function (userId) {
|
||||||
|
var avatars = [];
|
||||||
|
for (var ref of API.cachedAvatars.values()) {
|
||||||
|
if (ref.authorId === userId) {
|
||||||
|
avatars.push(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.sortUserDialogAvatars(avatars);
|
||||||
|
};
|
||||||
|
|
||||||
|
$app.methods.sortUserDialogAvatars = function (array) {
|
||||||
var D = this.userDialog;
|
var D = this.userDialog;
|
||||||
if (D.avatarSorting === 'update') {
|
if (D.avatarSorting === 'update') {
|
||||||
array.sort(compareByUpdatedAt);
|
array.sort(compareByUpdatedAt);
|
||||||
@@ -7896,7 +7922,7 @@ speechSynthesis.getVoices();
|
|||||||
done: () => {
|
done: () => {
|
||||||
if (D.id === params.userId) {
|
if (D.id === params.userId) {
|
||||||
var array = Array.from(map.values());
|
var array = Array.from(map.values());
|
||||||
this.setUserDialogWorlds(array);
|
this.sortUserDialogWorlds(array);
|
||||||
}
|
}
|
||||||
D.isWorldsLoading = false;
|
D.isWorldsLoading = false;
|
||||||
}
|
}
|
||||||
@@ -7940,7 +7966,7 @@ speechSynthesis.getVoices();
|
|||||||
},
|
},
|
||||||
done: () => {
|
done: () => {
|
||||||
var array = Array.from(map.values());
|
var array = Array.from(map.values());
|
||||||
this.setUserDialogAvatars(array);
|
this.sortUserDialogAvatars(array);
|
||||||
D.isAvatarsLoading = false;
|
D.isAvatarsLoading = false;
|
||||||
if (fileId) {
|
if (fileId) {
|
||||||
D.loading = false;
|
D.loading = false;
|
||||||
@@ -8133,12 +8159,12 @@ speechSynthesis.getVoices();
|
|||||||
|
|
||||||
$app.methods.changeUserDialogWorldSorting = function () {
|
$app.methods.changeUserDialogWorldSorting = function () {
|
||||||
var D = this.userDialog;
|
var D = this.userDialog;
|
||||||
this.setUserDialogWorlds(D.worlds);
|
this.sortUserDialogWorlds(D.worlds);
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.changeUserDialogAvatarSorting = function () {
|
$app.methods.changeUserDialogAvatarSorting = function () {
|
||||||
var D = this.userDialog;
|
var D = this.userDialog;
|
||||||
this.setUserDialogAvatars(D.avatars);
|
this.sortUserDialogAvatars(D.avatars);
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.computed.userDialogAvatars = function () {
|
$app.computed.userDialogAvatars = function () {
|
||||||
@@ -10844,6 +10870,34 @@ speechSynthesis.getVoices();
|
|||||||
this.discordNamesDialogVisible = true;
|
this.discordNamesDialogVisible = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// userDialog world/avatar tab click
|
||||||
|
|
||||||
|
$app.data.userDialogLastActiveTab = '';
|
||||||
|
$app.data.userDialogLastAvatar = '';
|
||||||
|
$app.data.userDialogLastWorld = '';
|
||||||
|
|
||||||
|
$app.methods.userDialogTabClick = function (obj) {
|
||||||
|
var userId = this.userDialog.id;
|
||||||
|
if (this.userDialogLastActiveTab === obj.label) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (obj.label === 'Avatars') {
|
||||||
|
this.setUserDialogAvatars(userId);
|
||||||
|
if (this.userDialogLastAvatar !== userId) {
|
||||||
|
if ((userId === API.currentUser.id) && (this.userDialog.avatars.length === 0)) {
|
||||||
|
this.refreshUserDialogAvatars();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (obj.label === 'Worlds') {
|
||||||
|
this.setUserDialogWorlds(userId);
|
||||||
|
if (this.userDialogLastWorld !== userId) {
|
||||||
|
this.userDialogLastWorld = userId;
|
||||||
|
this.refreshUserDialogWorlds();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.userDialogLastActiveTab = obj.label;
|
||||||
|
};
|
||||||
|
|
||||||
$app = new Vue($app);
|
$app = new Vue($app);
|
||||||
window.$app = $app;
|
window.$app = $app;
|
||||||
}());
|
}());
|
||||||
|
|||||||
+1
-1
@@ -1041,7 +1041,7 @@ html
|
|||||||
el-dropdown-item(v-else icon="el-icon-user" command="Hide Avatar") Hide Avatar
|
el-dropdown-item(v-else icon="el-icon-user" command="Hide Avatar") Hide Avatar
|
||||||
template(v-if="userDialog.isFriend")
|
template(v-if="userDialog.isFriend")
|
||||||
el-dropdown-item(icon="el-icon-delete" command="Unfriend" divided) Unfriend
|
el-dropdown-item(icon="el-icon-delete" command="Unfriend" divided) Unfriend
|
||||||
el-tabs
|
el-tabs(ref="userDialogTabs" @tab-click="userDialogTabClick")
|
||||||
el-tab-pane(label="Info")
|
el-tab-pane(label="Info")
|
||||||
div(v-if="userDialog.ref.location" style="display:flex;flex-direction:column;margin-bottom:10px;padding-bottom:10px;border-bottom:1px solid #eee")
|
div(v-if="userDialog.ref.location" style="display:flex;flex-direction:column;margin-bottom:10px;padding-bottom:10px;border-bottom:1px solid #eee")
|
||||||
div(style="flex:none")
|
div(style="flex:none")
|
||||||
|
|||||||
Reference in New Issue
Block a user