mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 14:56:06 +02:00
Retain dialog data when reopening same dialog
This commit is contained in:
@@ -468,8 +468,8 @@
|
|||||||
<div class="detail">
|
<div class="detail">
|
||||||
<span class="name">{{ t('dialog.avatar.info.time_spent') }}</span>
|
<span class="name">{{ t('dialog.avatar.info.time_spent') }}</span>
|
||||||
|
|
||||||
<span v-if="timeSpent === 0" class="extra">-</span>
|
<span v-if="avatarDialog.timeSpent === 0" class="extra">-</span>
|
||||||
<span v-else class="extra">{{ timeToText(timeSpent) }}</span>
|
<span v-else class="extra">{{ timeToText(avatarDialog.timeSpent) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="x-friend-item" style="width: 100%; cursor: default">
|
<div class="x-friend-item" style="width: 100%; cursor: default">
|
||||||
@@ -615,7 +615,6 @@
|
|||||||
const previousImageUrl = ref('');
|
const previousImageUrl = ref('');
|
||||||
|
|
||||||
const treeData = ref({});
|
const treeData = ref({});
|
||||||
const timeSpent = ref(0);
|
|
||||||
const memo = ref('');
|
const memo = ref('');
|
||||||
const setAvatarTagsDialog = ref({
|
const setAvatarTagsDialog = ref({
|
||||||
visible: false,
|
visible: false,
|
||||||
@@ -707,7 +706,7 @@
|
|||||||
|
|
||||||
function handleDialogOpen() {
|
function handleDialogOpen() {
|
||||||
setAvatarTagsDialog.value.visible = false;
|
setAvatarTagsDialog.value.visible = false;
|
||||||
timeSpent.value = 0;
|
avatarDialog.value.timeSpent = 0;
|
||||||
memo.value = '';
|
memo.value = '';
|
||||||
treeData.value = {};
|
treeData.value = {};
|
||||||
getAvatarTimeSpent();
|
getAvatarTimeSpent();
|
||||||
@@ -716,12 +715,12 @@
|
|||||||
|
|
||||||
function getAvatarTimeSpent() {
|
function getAvatarTimeSpent() {
|
||||||
const D = avatarDialog.value;
|
const D = avatarDialog.value;
|
||||||
timeSpent.value = 0;
|
avatarDialog.value.timeSpent = 0;
|
||||||
database.getAvatarTimeSpent(D.id).then((aviTime) => {
|
database.getAvatarTimeSpent(D.id).then((aviTime) => {
|
||||||
if (D.id === aviTime.avatarId) {
|
if (D.id === aviTime.avatarId) {
|
||||||
timeSpent.value = aviTime.timeSpent;
|
avatarDialog.value.timeSpent = aviTime.timeSpent;
|
||||||
if (D.id === currentUser.value.currentAvatar && currentUser.value.$previousAvatarSwapTime) {
|
if (D.id === currentUser.value.currentAvatar && currentUser.value.$previousAvatarSwapTime) {
|
||||||
timeSpent.value += Date.now() - currentUser.value.$previousAvatarSwapTime;
|
avatarDialog.value.timeSpent += Date.now() - currentUser.value.$previousAvatarSwapTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -740,7 +739,9 @@
|
|||||||
const D = avatarDialog.value;
|
const D = avatarDialog.value;
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case 'Refresh':
|
case 'Refresh':
|
||||||
showAvatarDialog(D.id);
|
const avatarId = D.id;
|
||||||
|
D.id = '';
|
||||||
|
showAvatarDialog(avatarId);
|
||||||
break;
|
break;
|
||||||
case 'Share':
|
case 'Share':
|
||||||
copyAvatarUrl(D.id);
|
copyAvatarUrl(D.id);
|
||||||
|
|||||||
@@ -1532,7 +1532,9 @@
|
|||||||
showInviteGroupDialog(D.id, '');
|
showInviteGroupDialog(D.id, '');
|
||||||
break;
|
break;
|
||||||
case 'Refresh':
|
case 'Refresh':
|
||||||
showGroupDialog(D.id);
|
const groupId = D.id;
|
||||||
|
D.id = '';
|
||||||
|
showGroupDialog(groupId);
|
||||||
break;
|
break;
|
||||||
case 'Leave Group':
|
case 'Leave Group':
|
||||||
leaveGroupPrompt(D.id);
|
leaveGroupPrompt(D.id);
|
||||||
|
|||||||
@@ -553,7 +553,7 @@
|
|||||||
<RefreshCw v-else />
|
<RefreshCw v-else />
|
||||||
</Button>
|
</Button>
|
||||||
<span style="margin-left: 5px">{{
|
<span style="margin-left: 5px">{{
|
||||||
t('dialog.user.groups.total_count', { count: userGroups.groups.length })
|
t('dialog.user.groups.total_count', { count: userDialog.userGroups.groups.length })
|
||||||
}}</span>
|
}}</span>
|
||||||
<template v-if="userDialogGroupEditMode">
|
<template v-if="userDialogGroupEditMode">
|
||||||
<span
|
<span
|
||||||
@@ -793,18 +793,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<template v-if="userGroups.ownGroups.length > 0">
|
<template v-if="userDialog.userGroups.ownGroups.length > 0">
|
||||||
<span style="font-weight: bold; font-size: 16px">{{
|
<span style="font-weight: bold; font-size: 16px">{{
|
||||||
t('dialog.user.groups.own_groups')
|
t('dialog.user.groups.own_groups')
|
||||||
}}</span>
|
}}</span>
|
||||||
<span style="font-size: 12px; margin-left: 5px"
|
<span style="font-size: 12px; margin-left: 5px"
|
||||||
>{{ userGroups.ownGroups.length }}/{{
|
>{{ userDialog.userGroups.ownGroups.length }}/{{
|
||||||
|
// @ts-ignore
|
||||||
cachedConfig?.constants?.GROUPS?.MAX_OWNED
|
cachedConfig?.constants?.GROUPS?.MAX_OWNED
|
||||||
}}</span
|
}}</span
|
||||||
>
|
>
|
||||||
<div class="x-friend-list" style="margin-top: 10px; margin-bottom: 15px; min-height: 60px">
|
<div class="x-friend-list" style="margin-top: 10px; margin-bottom: 15px; min-height: 60px">
|
||||||
<div
|
<div
|
||||||
v-for="group in userGroups.ownGroups"
|
v-for="group in userDialog.userGroups.ownGroups"
|
||||||
:key="group.id"
|
:key="group.id"
|
||||||
class="x-friend-item x-friend-item-border"
|
class="x-friend-item x-friend-item-border"
|
||||||
@click="showGroupDialog(group.id)">
|
@click="showGroupDialog(group.id)">
|
||||||
@@ -835,14 +836,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="userGroups.mutualGroups.length > 0">
|
<template v-if="userDialog.userGroups.mutualGroups.length > 0">
|
||||||
<span style="font-weight: bold; font-size: 16px">{{
|
<span style="font-weight: bold; font-size: 16px">{{
|
||||||
t('dialog.user.groups.mutual_groups')
|
t('dialog.user.groups.mutual_groups')
|
||||||
}}</span>
|
}}</span>
|
||||||
<span style="font-size: 12px; margin-left: 5px">{{ userGroups.mutualGroups.length }}</span>
|
<span style="font-size: 12px; margin-left: 5px">{{
|
||||||
|
userDialog.userGroups.mutualGroups.length
|
||||||
|
}}</span>
|
||||||
<div class="x-friend-list" style="margin-top: 10px; margin-bottom: 15px; min-height: 60px">
|
<div class="x-friend-list" style="margin-top: 10px; margin-bottom: 15px; min-height: 60px">
|
||||||
<div
|
<div
|
||||||
v-for="group in userGroups.mutualGroups"
|
v-for="group in userDialog.userGroups.mutualGroups"
|
||||||
:key="group.id"
|
:key="group.id"
|
||||||
class="x-friend-item x-friend-item-border"
|
class="x-friend-item x-friend-item-border"
|
||||||
@click="showGroupDialog(group.id)">
|
@click="showGroupDialog(group.id)">
|
||||||
@@ -873,10 +876,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="userGroups.remainingGroups.length > 0">
|
<template v-if="userDialog.userGroups.remainingGroups.length > 0">
|
||||||
<span style="font-weight: bold; font-size: 16px">{{ t('dialog.user.groups.groups') }}</span>
|
<span style="font-weight: bold; font-size: 16px">{{ t('dialog.user.groups.groups') }}</span>
|
||||||
<span style="font-size: 12px; margin-left: 5px">
|
<span style="font-size: 12px; margin-left: 5px">
|
||||||
{{ userGroups.remainingGroups.length }}
|
{{ userDialog.userGroups.remainingGroups.length }}
|
||||||
<template v-if="currentUser.id === userDialog.id">
|
<template v-if="currentUser.id === userDialog.id">
|
||||||
/
|
/
|
||||||
<template v-if="isLocalUserVrcPlusSupporter">
|
<template v-if="isLocalUserVrcPlusSupporter">
|
||||||
@@ -889,7 +892,7 @@
|
|||||||
</span>
|
</span>
|
||||||
<div class="x-friend-list" style="margin-top: 10px; margin-bottom: 15px; min-height: 60px">
|
<div class="x-friend-list" style="margin-top: 10px; margin-bottom: 15px; min-height: 60px">
|
||||||
<div
|
<div
|
||||||
v-for="group in userGroups.remainingGroups"
|
v-for="group in userDialog.userGroups.remainingGroups"
|
||||||
:key="group.id"
|
:key="group.id"
|
||||||
class="x-friend-item x-friend-item-border"
|
class="x-friend-item x-friend-item-border"
|
||||||
@click="showGroupDialog(group.id)">
|
@click="showGroupDialog(group.id)">
|
||||||
@@ -1019,7 +1022,7 @@
|
|||||||
style="position: absolute; right: 15px; bottom: 15px; z-index: 99"
|
style="position: absolute; right: 15px; bottom: 15px; z-index: 99"
|
||||||
@click="getUserFavoriteWorlds(userDialog.id)">
|
@click="getUserFavoriteWorlds(userDialog.id)">
|
||||||
</Button> -->
|
</Button> -->
|
||||||
<template v-if="userFavoriteWorlds && userFavoriteWorlds.length > 0">
|
<template v-if="userDialog.userFavoriteWorlds && userDialog.userFavoriteWorlds.length > 0">
|
||||||
<TabsUnderline
|
<TabsUnderline
|
||||||
v-model="favoriteWorldsTab"
|
v-model="favoriteWorldsTab"
|
||||||
:items="favoriteWorldTabs"
|
:items="favoriteWorldTabs"
|
||||||
@@ -1027,7 +1030,7 @@
|
|||||||
class="zero-margin-tabs"
|
class="zero-margin-tabs"
|
||||||
style="margin-top: 10px; height: 50vh">
|
style="margin-top: 10px; height: 50vh">
|
||||||
<template
|
<template
|
||||||
v-for="(list, index) in userFavoriteWorlds"
|
v-for="(list, index) in userDialog.userFavoriteWorlds"
|
||||||
:key="`favorite-worlds-label-${index}`"
|
:key="`favorite-worlds-label-${index}`"
|
||||||
v-slot:[`label-${index}`]>
|
v-slot:[`label-${index}`]>
|
||||||
<span>
|
<span>
|
||||||
@@ -1043,7 +1046,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template
|
||||||
v-for="(list, index) in userFavoriteWorlds"
|
v-for="(list, index) in userDialog.userFavoriteWorlds"
|
||||||
:key="`favorite-worlds-content-${index}`"
|
:key="`favorite-worlds-content-${index}`"
|
||||||
v-slot:[String(index)]>
|
v-slot:[String(index)]>
|
||||||
<div
|
<div
|
||||||
@@ -1339,7 +1342,7 @@
|
|||||||
return tabs;
|
return tabs;
|
||||||
});
|
});
|
||||||
const favoriteWorldTabs = computed(() =>
|
const favoriteWorldTabs = computed(() =>
|
||||||
(userFavoriteWorlds.value || []).map((list, index) => ({
|
(userDialog.value.userFavoriteWorlds || []).map((list, index) => ({
|
||||||
value: String(index),
|
value: String(index),
|
||||||
label: list?.[0] ?? ''
|
label: list?.[0] ?? ''
|
||||||
}))
|
}))
|
||||||
@@ -1413,13 +1416,6 @@
|
|||||||
const userDialogLastAvatar = ref('');
|
const userDialogLastAvatar = ref('');
|
||||||
const userDialogLastWorld = ref('');
|
const userDialogLastWorld = ref('');
|
||||||
const userDialogLastFavoriteWorld = ref('');
|
const userDialogLastFavoriteWorld = ref('');
|
||||||
const userFavoriteWorlds = ref([]);
|
|
||||||
const userGroups = ref({
|
|
||||||
groups: [],
|
|
||||||
ownGroups: [],
|
|
||||||
mutualGroups: [],
|
|
||||||
remainingGroups: []
|
|
||||||
});
|
|
||||||
|
|
||||||
const favoriteWorldsTab = ref('0');
|
const favoriteWorldsTab = ref('0');
|
||||||
|
|
||||||
@@ -1732,7 +1728,9 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (command === 'Refresh') {
|
if (command === 'Refresh') {
|
||||||
showUserDialog(D.id);
|
const userId = D.id;
|
||||||
|
D.id = '';
|
||||||
|
showUserDialog(userId);
|
||||||
} else if (command === 'Share') {
|
} else if (command === 'Share') {
|
||||||
copyUserURL(D.id);
|
copyUserURL(D.id);
|
||||||
} else if (command === 'Add Favorite') {
|
} else if (command === 'Add Favorite') {
|
||||||
@@ -2064,7 +2062,7 @@
|
|||||||
async function getUserGroups(userId) {
|
async function getUserGroups(userId) {
|
||||||
exitEditModeCurrentUserGroups();
|
exitEditModeCurrentUserGroups();
|
||||||
userDialog.value.isGroupsLoading = true;
|
userDialog.value.isGroupsLoading = true;
|
||||||
userGroups.value = {
|
userDialog.value.userGroups = {
|
||||||
groups: [],
|
groups: [],
|
||||||
ownGroups: [],
|
ownGroups: [],
|
||||||
mutualGroups: [],
|
mutualGroups: [],
|
||||||
@@ -2088,7 +2086,7 @@
|
|||||||
|
|
||||||
saveCurrentUserGroups();
|
saveCurrentUserGroups();
|
||||||
}
|
}
|
||||||
userGroups.value.groups = args.json;
|
userDialog.value.userGroups.groups = args.json;
|
||||||
for (let i = 0; i < args.json.length; ++i) {
|
for (let i = 0; i < args.json.length; ++i) {
|
||||||
const group = args.json[i];
|
const group = args.json[i];
|
||||||
if (!group?.id) {
|
if (!group?.id) {
|
||||||
@@ -2096,20 +2094,20 @@
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (group.ownerId === userId) {
|
if (group.ownerId === userId) {
|
||||||
userGroups.value.ownGroups.unshift(group);
|
userDialog.value.userGroups.ownGroups.unshift(group);
|
||||||
}
|
}
|
||||||
if (userId === currentUser.value.id) {
|
if (userId === currentUser.value.id) {
|
||||||
// skip mutual groups for current user
|
// skip mutual groups for current user
|
||||||
if (group.ownerId !== userId) {
|
if (group.ownerId !== userId) {
|
||||||
userGroups.value.remainingGroups.unshift(group);
|
userDialog.value.userGroups.remainingGroups.unshift(group);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (group.mutualGroup) {
|
if (group.mutualGroup) {
|
||||||
userGroups.value.mutualGroups.unshift(group);
|
userDialog.value.userGroups.mutualGroups.unshift(group);
|
||||||
}
|
}
|
||||||
if (!group.mutualGroup && group.ownerId !== userId) {
|
if (!group.mutualGroup && group.ownerId !== userId) {
|
||||||
userGroups.value.remainingGroups.unshift(group);
|
userDialog.value.userGroups.remainingGroups.unshift(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (userId === currentUser.value.id) {
|
if (userId === currentUser.value.id) {
|
||||||
@@ -2193,9 +2191,9 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
userGroups.value.ownGroups.sort(sortMethod);
|
userDialog.value.userGroups.ownGroups.sort(sortMethod);
|
||||||
userGroups.value.mutualGroups.sort(sortMethod);
|
userDialog.value.userGroups.mutualGroups.sort(sortMethod);
|
||||||
userGroups.value.remainingGroups.sort(sortMethod);
|
userDialog.value.userGroups.remainingGroups.sort(sortMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUserDialogAvatars(userId) {
|
function setUserDialogAvatars(userId) {
|
||||||
@@ -2270,7 +2268,7 @@
|
|||||||
async function getUserFavoriteWorlds(userId) {
|
async function getUserFavoriteWorlds(userId) {
|
||||||
userDialog.value.isFavoriteWorldsLoading = true;
|
userDialog.value.isFavoriteWorldsLoading = true;
|
||||||
favoriteWorldsTab.value = '0';
|
favoriteWorldsTab.value = '0';
|
||||||
userFavoriteWorlds.value = [];
|
userDialog.value.userFavoriteWorlds = [];
|
||||||
const worldLists = [];
|
const worldLists = [];
|
||||||
let params = {
|
let params = {
|
||||||
ownerId: userId,
|
ownerId: userId,
|
||||||
@@ -2301,7 +2299,7 @@
|
|||||||
console.error('getUserFavoriteWorlds', err);
|
console.error('getUserFavoriteWorlds', err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userFavoriteWorlds.value = worldLists;
|
userDialog.value.userFavoriteWorlds = worldLists;
|
||||||
userDialog.value.isFavoriteWorldsLoading = false;
|
userDialog.value.isFavoriteWorldsLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1088,7 +1088,9 @@
|
|||||||
showChangeWorldImageDialog();
|
showChangeWorldImageDialog();
|
||||||
break;
|
break;
|
||||||
case 'Refresh':
|
case 'Refresh':
|
||||||
showWorldDialog(D.id);
|
const worldId = D.id;
|
||||||
|
D.id = '';
|
||||||
|
showWorldDialog(worldId);
|
||||||
break;
|
break;
|
||||||
case 'New Instance':
|
case 'New Instance':
|
||||||
showNewInstanceDialog(D.$location.tag);
|
showNewInstanceDialog(D.$location.tag);
|
||||||
|
|||||||
@@ -65,7 +65,8 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
|||||||
cacheSize: '',
|
cacheSize: '',
|
||||||
cacheLocked: false,
|
cacheLocked: false,
|
||||||
cachePath: '',
|
cachePath: '',
|
||||||
fileAnalysis: {}
|
fileAnalysis: {},
|
||||||
|
timeSpent: 0
|
||||||
});
|
});
|
||||||
const avatarHistory = ref([]);
|
const avatarHistory = ref([]);
|
||||||
|
|
||||||
@@ -183,7 +184,11 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
|||||||
id: avatarId,
|
id: avatarId,
|
||||||
skipBreadcrumb: options.skipBreadcrumb
|
skipBreadcrumb: options.skipBreadcrumb
|
||||||
});
|
});
|
||||||
|
D.visible = true;
|
||||||
|
if (D.id === avatarId) {
|
||||||
|
uiStore.setDialogCrumbLabel('avatar', D.id, D.ref?.name || D.id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
D.loading = true;
|
D.loading = true;
|
||||||
D.id = avatarId;
|
D.id = avatarId;
|
||||||
D.inCache = false;
|
D.inCache = false;
|
||||||
@@ -220,7 +225,6 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
D.visible = true;
|
|
||||||
avatarRequest
|
avatarRequest
|
||||||
.getAvatar({ avatarId })
|
.getAvatar({ avatarId })
|
||||||
.then((args) => {
|
.then((args) => {
|
||||||
|
|||||||
@@ -142,6 +142,10 @@ export const useGroupStore = defineStore('Group', () => {
|
|||||||
});
|
});
|
||||||
const D = groupDialog.value;
|
const D = groupDialog.value;
|
||||||
D.visible = true;
|
D.visible = true;
|
||||||
|
if (D.id === groupId) {
|
||||||
|
uiStore.setDialogCrumbLabel('group', D.id, D.ref?.name || D.id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
D.loading = true;
|
D.loading = true;
|
||||||
D.id = groupId;
|
D.id = groupId;
|
||||||
D.inGroup = false;
|
D.inGroup = false;
|
||||||
|
|||||||
@@ -216,6 +216,13 @@ export const useUserStore = defineStore('User', () => {
|
|||||||
isFavoriteWorldsLoading: false,
|
isFavoriteWorldsLoading: false,
|
||||||
isAvatarsLoading: false,
|
isAvatarsLoading: false,
|
||||||
isGroupsLoading: false,
|
isGroupsLoading: false,
|
||||||
|
userFavoriteWorlds: [],
|
||||||
|
userGroups: {
|
||||||
|
groups: [],
|
||||||
|
ownGroups: [],
|
||||||
|
mutualGroups: [],
|
||||||
|
remainingGroups: []
|
||||||
|
},
|
||||||
|
|
||||||
worldSorting: {
|
worldSorting: {
|
||||||
name: 'dialog.user.worlds.sorting.updated',
|
name: 'dialog.user.worlds.sorting.updated',
|
||||||
@@ -771,6 +778,14 @@ export const useUserStore = defineStore('User', () => {
|
|||||||
});
|
});
|
||||||
const D = userDialog.value;
|
const D = userDialog.value;
|
||||||
D.visible = true;
|
D.visible = true;
|
||||||
|
if (D.id === userId) {
|
||||||
|
uiStore.setDialogCrumbLabel(
|
||||||
|
'user',
|
||||||
|
D.id,
|
||||||
|
D.ref?.displayName || D.id
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
D.id = userId;
|
D.id = userId;
|
||||||
D.memo = '';
|
D.memo = '';
|
||||||
D.note = '';
|
D.note = '';
|
||||||
|
|||||||
@@ -90,6 +90,10 @@ export const useWorldStore = defineStore('World', () => {
|
|||||||
skipBreadcrumb: options.skipBreadcrumb
|
skipBreadcrumb: options.skipBreadcrumb
|
||||||
});
|
});
|
||||||
D.visible = true;
|
D.visible = true;
|
||||||
|
if (D.id === L.worldId) {
|
||||||
|
uiStore.setDialogCrumbLabel('world', D.id, D.ref?.name || D.id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
L.shortName = shortName;
|
L.shortName = shortName;
|
||||||
D.id = L.worldId;
|
D.id = L.worldId;
|
||||||
D.$location = L;
|
D.$location = L;
|
||||||
|
|||||||
Reference in New Issue
Block a user