Last updated dropdown

This commit is contained in:
Natsumi
2026-02-05 16:41:33 +13:00
committed by pa
parent 33c8d97403
commit ecce12a9fc
7 changed files with 71 additions and 83 deletions

View File

@@ -54,9 +54,9 @@
>{{ avatarDialog.platformInfo.pc.performanceRating }}</span
>
<span
v-if="avatarDialog.bundleSizes['standalonewindows']"
v-if="avatarDialog.fileAnalysis.standalonewindows?._fileSize"
:class="['x-grey', 'x-tag-platform-pc', 'x-tag-border-left']"
>{{ avatarDialog.bundleSizes['standalonewindows'].fileSize }}</span
>{{ avatarDialog.fileAnalysis.standalonewindows._fileSize }}</span
>
</Badge>
</TooltipWrapper>
@@ -72,9 +72,9 @@
>{{ avatarDialog.platformInfo.android.performanceRating }}</span
>
<span
v-if="avatarDialog.bundleSizes['android']"
v-if="avatarDialog.fileAnalysis.android?._fileSize"
:class="['x-grey', 'x-tag-platform-quest', 'x-tag-border-left']"
>{{ avatarDialog.bundleSizes['android'].fileSize }}</span
>{{ avatarDialog.fileAnalysis.android._fileSize }}</span
>
</Badge>
</TooltipWrapper>
@@ -90,9 +90,9 @@
>{{ avatarDialog.platformInfo.ios.performanceRating }}</span
>
<span
v-if="avatarDialog.bundleSizes['ios']"
v-if="avatarDialog.fileAnalysis.ios?._fileSize"
:class="['x-grey', 'x-tag-border-left', 'text-[#8e8e93]', 'border-[#8e8e93]']"
>{{ avatarDialog.bundleSizes['ios'].fileSize }}</span
>{{ avatarDialog.fileAnalysis.ios._fileSize }}</span
>
</Badge>
</TooltipWrapper>
@@ -447,13 +447,24 @@
</div>
<div class="x-friend-item" style="cursor: default">
<div class="detail">
<span class="name">{{ t('dialog.avatar.info.last_updated') }}</span>
<span v-if="avatarDialog.lastUpdated" class="extra">{{
formatDateFilter(avatarDialog.lastUpdated, 'long')
}}</span>
<span v-else class="extra">{{
formatDateFilter(avatarDialog.ref.updated_at, 'long')
<span class="name" style="display: inline">{{
t('dialog.avatar.info.last_updated')
}}</span>
<TooltipWrapper
v-if="Object.keys(avatarDialog.fileAnalysis).length"
side="top"
style="margin-left: 5px">
<template #content>
<template v-for="(data, platform) in avatarDialog.fileAnalysis" :key="platform">
<div class="flex justify-between w-full">
<span class="mr-1">{{ platform }}:</span>
<span>{{ formatDateFilter(data.created_at, 'long') }}</span>
</div>
</template>
</template>
<ChevronDown class="inline-block" />
</TooltipWrapper>
<span class="extra">{{ formatDateFilter(avatarDialog.ref.updated_at, 'long') }}</span>
</div>
</div>
<div class="x-friend-item" style="cursor: default">
@@ -506,7 +517,7 @@
show-icon />
<br />
<vue-json-pretty
v-if="Object.keys(avatarDialog.fileAnalysis).length > 0"
v-if="Object.keys(avatarDialog.fileAnalysis).length"
:data="avatarDialog.fileAnalysis"
:deep="2"
:theme="isDarkMode ? 'dark' : 'light'"
@@ -529,6 +540,7 @@
Apple,
Check,
CheckCircle,
ChevronDown,
Copy,
Download,
Ellipsis,

View File

@@ -60,9 +60,9 @@
style="margin-right: 5px; margin-top: 5px">
<Monitor class="h-4 w-4 x-tag-platform-pc" />
<span
v-if="worldDialog.bundleSizes['standalonewindows']"
v-if="worldDialog.fileAnalysis.standalonewindows?._fileSize"
:class="['x-grey', 'x-tag-platform-pc', 'x-tag-border-left']">
{{ worldDialog.bundleSizes['standalonewindows'].fileSize }}
{{ worldDialog.fileAnalysis.standalonewindows._fileSize }}
</span>
</Badge>
</TooltipWrapper>
@@ -74,9 +74,9 @@
style="margin-right: 5px; margin-top: 5px">
<Smartphone class="h-4 w-4 x-tag-platform-quest" />
<span
v-if="worldDialog.bundleSizes['android']"
v-if="worldDialog.fileAnalysis.android?._fileSize"
:class="['x-grey', 'x-tag-platform-quest', 'x-tag-border-left']">
{{ worldDialog.bundleSizes['android'].fileSize }}
{{ worldDialog.fileAnalysis.android._fileSize }}
</span>
</Badge>
</TooltipWrapper>
@@ -88,9 +88,9 @@
style="margin-right: 5px; margin-top: 5px">
<Apple class="h-4 w-4 text-[#8e8e93]" />
<span
v-if="worldDialog.bundleSizes['ios']"
v-if="worldDialog.fileAnalysis.ios?._fileSize"
:class="['x-grey', 'x-tag-border-left', 'text-[#8e8e93]', 'border-[#8e8e93]']">
{{ worldDialog.bundleSizes['ios'].fileSize }}
{{ worldDialog.fileAnalysis.ios._fileSize }}
</span>
</Badge>
</TooltipWrapper>
@@ -566,13 +566,24 @@
</div>
<div class="x-friend-item" style="cursor: default">
<div class="detail">
<span class="name">
<span class="name" style="display: inline">
{{ t('dialog.world.info.last_updated') }}
</span>
<span v-if="worldDialog.lastUpdated" class="extra">
{{ formatDateFilter(worldDialog.lastUpdated, 'long') }}
</span>
<span v-else class="extra">
<TooltipWrapper
v-if="Object.keys(worldDialog.fileAnalysis).length"
side="top"
style="margin-left: 5px">
<template #content>
<template v-for="(data, platform) in worldDialog.fileAnalysis" :key="platform">
<div class="flex justify-between w-full">
<span class="mr-1">{{ platform }}:</span>
<span>{{ formatDateFilter(data.created_at, 'long') }}</span>
</div>
</template>
</template>
<ChevronDown class="inline-block" />
</TooltipWrapper>
<span class="extra">
{{ formatDateFilter(worldDialog.ref.updated_at, 'long') }}
</span>
</div>
@@ -712,7 +723,7 @@
show-icon />
<br />
<vue-json-pretty
v-if="Object.keys(worldDialog.fileAnalysis).length > 0"
v-if="Object.keys(worldDialog.fileAnalysis).length"
:data="worldDialog.fileAnalysis"
:deep="2"
:theme="isDarkMode ? 'dark' : 'light'"

View File

@@ -434,7 +434,6 @@ async function getBundleDateSize(ref) {
const instanceStore = useInstanceStore();
const { currentInstanceWorld, currentInstanceLocation } =
storeToRefs(instanceStore);
const bundleSizes = {};
const bundleJson = {};
for (let i = ref.unityPackages.length - 1; i > -1; i--) {
const unityPackage = ref.unityPackages[i];
@@ -453,7 +452,7 @@ async function getBundleDateSize(ref) {
}
const platform = unityPackage.platform;
if (bundleSizes[platform]) {
if (bundleJson[platform]) {
continue;
}
const assetUrl = unityPackage.assetUrl;
@@ -488,34 +487,22 @@ async function getBundleDateSize(ref) {
json._totalTextureUsage = `${(json.avatarStats.totalTextureUsage / 1048576).toFixed(2)} MB`;
}
bundleJson[platform] = json;
const createdAt = json.created_at;
const fileSize = `${(json.fileSize / 1048576).toFixed(2)} MB`;
bundleSizes[platform] = {
createdAt,
fileSize
};
if (avatarDialog.value.id === ref.id) {
// update avatar dialog
avatarDialog.value.bundleSizes[platform] = bundleSizes[platform];
avatarDialog.value.lastUpdated = createdAt;
avatarDialog.value.fileAnalysis = bundleJson;
avatarDialog.value.fileAnalysis[platform] = json;
}
// update world dialog
if (worldDialog.value.id === ref.id) {
worldDialog.value.bundleSizes[platform] = bundleSizes[platform];
worldDialog.value.lastUpdated = createdAt;
worldDialog.value.fileAnalysis = bundleJson;
worldDialog.value.fileAnalysis[platform] = json;
}
// update player list
if (currentInstanceLocation.value.worldId === ref.id) {
currentInstanceWorld.value.bundleSizes[platform] =
bundleSizes[platform];
currentInstanceWorld.value.lastUpdated = createdAt;
currentInstanceWorld.value.fileAnalysis[platform] = json;
}
}
return bundleSizes;
return bundleJson;
}
// #region | App: Random unsorted app methods, data structs, API functions, and an API feedback/file analysis event

View File

@@ -56,11 +56,9 @@ export const useAvatarStore = defineStore('Avatar', () => {
isPC: false,
isQuest: false,
isIos: false,
bundleSizes: {},
platformInfo: {},
galleryImages: [],
galleryLoading: false,
lastUpdated: '',
inCache: false,
cacheSize: '',
cacheLocked: false,
@@ -202,8 +200,6 @@ export const useAvatarStore = defineStore('Avatar', () => {
D.isIos = false;
D.hasImposter = false;
D.imposterVersion = '';
D.lastUpdated = '';
D.bundleSizes = {};
D.platformInfo = {};
D.galleryImages = [];
D.galleryLoading = true;
@@ -247,10 +243,8 @@ export const useAvatarStore = defineStore('Avatar', () => {
break;
}
}
if (Object.keys(D.bundleSizes).length === 0) {
getBundleDateSize(ref).then((bundleSizes) => {
D.bundleSizes = bundleSizes;
});
if (Object.keys(D.fileAnalysis).length === 0) {
getBundleDateSize(ref);
}
})
.catch((err) => {

View File

@@ -101,8 +101,7 @@ export const useInstanceStore = defineStore('Instance', () => {
focusViewDisabled: false,
inCache: false,
cacheSize: '',
bundleSizes: {},
lastUpdated: ''
fileAnalysis: {}
});
/** @type {import('vue').Ref<any>} */
@@ -386,8 +385,7 @@ export const useInstanceStore = defineStore('Instance', () => {
focusViewDisabled: false,
inCache: false,
cacheSize: '',
bundleSizes: {},
lastUpdated: ''
fileAnalysis: {}
};
currentInstanceLocation.value = {};
} else if (instanceId !== currentInstanceLocation.value.tag) {
@@ -401,8 +399,7 @@ export const useInstanceStore = defineStore('Instance', () => {
focusViewDisabled: false,
inCache: false,
cacheSize: '',
bundleSizes: {},
lastUpdated: ''
fileAnalysis: {}
};
L = parseLocation(instanceId);
currentInstanceLocation.value = L;
@@ -439,17 +436,7 @@ export const useInstanceStore = defineStore('Instance', () => {
error
);
});
getBundleDateSize(args.ref)
.then((bundleSizes) => {
currentInstanceWorld.value.bundleSizes =
bundleSizes;
})
.catch((error) => {
console.error(
'Error fetching bundle sizes:',
error
);
});
getBundleDateSize(args.ref);
return args;
})
.catch((error) => {

View File

@@ -46,8 +46,6 @@ export const useWorldStore = defineStore('World', () => {
avatarScalingDisabled: false,
focusViewDisabled: false,
rooms: [],
bundleSizes: {},
lastUpdated: '',
inCache: false,
cacheSize: '',
cacheLocked: false,
@@ -96,8 +94,6 @@ export const useWorldStore = defineStore('World', () => {
L.shortName = shortName;
D.id = L.worldId;
D.$location = L;
D.bundleSizes = {};
D.lastUpdated = '';
D.loading = true;
D.inCache = false;
D.cacheSize = '';
@@ -331,10 +327,8 @@ export const useWorldStore = defineStore('World', () => {
});
}
}
if (Object.keys(worldDialog.bundleSizes).length === 0) {
getBundleDateSize(ref).then((bundleSizes) => {
worldDialog.bundleSizes = bundleSizes;
});
if (Object.keys(worldDialog.fileAnalysis).length === 0) {
getBundleDateSize(ref);
}
}
if (favoriteStore.localWorldFavoritesList.includes(ref.id)) {

View File

@@ -61,9 +61,9 @@
<Badge class="x-tag-platform-pc" variant="outline" style="margin-right: 5px"
><Monitor class="h-4 w-4" />
<span
v-if="currentInstanceWorld.bundleSizes['standalonewindows']"
v-if="currentInstanceWorld.fileAnalysis.standalonewindows?._fileSize"
:class="['x-grey', 'x-tag-platform-pc', 'x-tag-border-left']"
>{{ currentInstanceWorld.bundleSizes['standalonewindows'].fileSize }}</span
>{{ currentInstanceWorld.fileAnalysis.standalonewindows._fileSize }}</span
>
</Badge>
</TooltipWrapper>
@@ -71,9 +71,9 @@
<Badge class="x-tag-platform-quest" variant="outline" style="margin-right: 5px"
><Smartphone class="h-4 w-4" />
<span
v-if="currentInstanceWorld.bundleSizes['android']"
v-if="currentInstanceWorld.fileAnalysis.android?._fileSize"
:class="['x-grey', 'x-tag-platform-quest', 'x-tag-border-left']"
>{{ currentInstanceWorld.bundleSizes['android'].fileSize }}</span
>{{ currentInstanceWorld.fileAnalysis.android._fileSize }}</span
>
</Badge>
</TooltipWrapper>
@@ -81,9 +81,9 @@
<Badge class="text-[#8e8e93] border-[#8e8e93]" variant="outline" style="margin-right: 5px"
><Apple class="h-4 w-4 text-[#8e8e93]" />
<span
v-if="currentInstanceWorld.bundleSizes['ios']"
v-if="currentInstanceWorld.fileAnalysis.ios?._fileSize"
:class="['x-grey', 'x-tag-border-left', 'text-[#8e8e93]', 'border-[#8e8e93]']"
>{{ currentInstanceWorld.bundleSizes['ios'].fileSize }}</span
>{{ currentInstanceWorld.fileAnalysis.ios._fileSize }}</span
>
</Badge>
</TooltipWrapper>
@@ -129,7 +129,10 @@
<div class="detail">
<span class="name">{{ t('dialog.world.info.last_updated') }}</span>
<span class="block truncate text-xs">{{
formatDateFilter(currentInstanceWorld.lastUpdated, 'long')
formatDateFilter(
currentInstanceWorld.fileAnalysis.standalonewindows?.created_at,
'long'
)
}}</span>
</div>
</div>