Add vrcPlusWorld groups

This commit is contained in:
Natsumi
2026-01-13 12:09:33 +13:00
parent d2387c5419
commit 4a64559a79
5 changed files with 45 additions and 18 deletions

View File

@@ -145,7 +145,7 @@
loading.value = true;
favoriteRequest
.addFavorite({
type: D.type,
type: group.type,
favoriteId: D.objectId,
tags: group.name
})

View File

@@ -52,11 +52,13 @@ export const useFavoriteStore = defineStore('Favorite', () => {
maxFavoriteGroups: {
avatar: 6,
friend: 3,
vrcPlusWorld: 4,
world: 4
},
maxFavoritesPerGroup: {
avatar: 50,
friend: 150,
vrcPlusWorld: 100,
world: 100
}
});
@@ -373,11 +375,12 @@ export const useFavoriteStore = defineStore('Favorite', () => {
if (avatarDialog.visible && avatarDialog.id === ref.favoriteId) {
avatarDialog.isFavorite = false;
}
countFavoriteGroups();
}
/**
*
* @param {'friend' | 'world' | 'avatar'} type
* @param {'friend' | 'world' | 'vrcPlusWorld' | 'avatar'} type
* @param {string} objectId
* @returns {Promise<void>}
*/
@@ -409,7 +412,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
ctx.ref = ref;
ctx.name = ref.displayName;
}
} else if (type === 'world') {
} else if (type === 'world' || type === 'vrcPlusWorld') {
ref = worldStore.cachedWorlds.get(objectId);
if (typeof ref !== 'undefined') {
ctx.ref = ref;
@@ -430,7 +433,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
isTypeChanged = true;
if (type === 'friend') {
removeFromArray(state.favoriteFriends_, ctx);
} else if (type === 'world') {
} else if (type === 'world' || type === 'vrcPlusWorld') {
removeFromArray(state.favoriteWorlds_, ctx);
} else if (type === 'avatar') {
removeFromArray(state.favoriteAvatars_, ctx);
@@ -447,7 +450,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
}
}
// else too bad
} else if (type === 'world') {
} else if (type === 'world' || type === 'vrcPlusWorld') {
ref = worldStore.cachedWorlds.get(objectId);
if (typeof ref !== 'undefined') {
if (ctx.ref !== ref) {
@@ -501,7 +504,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
if (isTypeChanged) {
if (type === 'friend') {
state.favoriteFriends_.push(ctx);
} else if (type === 'world') {
} else if (type === 'world' || type === 'vrcPlusWorld') {
state.favoriteWorlds_.push(ctx);
} else if (type === 'avatar') {
state.favoriteAvatars_.push(ctx);
@@ -544,7 +547,6 @@ export const useFavoriteStore = defineStore('Favorite', () => {
function buildFavoriteGroups() {
let group;
let groups;
let ref;
let i;
// 450 = ['group_0', 'group_1', 'group_2'] x 150
favoriteFriendGroups.value = [];
@@ -574,6 +576,24 @@ export const useFavoriteStore = defineStore('Favorite', () => {
visibility: 'private'
});
}
// 400 = ['vrcPlusWorlds1', 'vrcPlusWorlds2', 'vrcPlusWorlds3', 'vrcPlusWorlds4'] x 100
for (
i = 0;
i < favoriteLimits.value.maxFavoriteGroups.vrcPlusWorld;
++i
) {
favoriteWorldGroups.value.push({
assign: false,
key: `vrcPlusWorld:vrcPlusWorlds${i + 1}`,
type: 'vrcPlusWorld',
name: `vrcPlusWorlds${i + 1}`,
displayName: `VRC+ Group ${i + 1}`,
capacity:
favoriteLimits.value.maxFavoritesPerGroup.vrcPlusWorld,
count: 0,
visibility: 'private'
});
}
// 350 = ['avatars1', ...] x 50
// Favorite Avatars (0/50)
// VRC+ Group 1..5 (0/50)
@@ -593,6 +613,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
const types = {
friend: favoriteFriendGroups.value,
world: favoriteWorldGroups.value,
vrcPlusWorld: favoriteWorldGroups.value,
avatar: favoriteAvatarGroups.value
};
const assigns = new Set();
@@ -636,10 +657,16 @@ export const useFavoriteStore = defineStore('Favorite', () => {
}
}
}
// update favorites
countFavoriteGroups();
}
for (ref of cachedFavorites.values()) {
group = getCachedFavoriteGroupsByTypeName()[ref.$groupKey];
function countFavoriteGroups() {
const cachedFavoriteGroups = getCachedFavoriteGroupsByTypeName();
for (const key in cachedFavoriteGroups) {
cachedFavoriteGroups[key].count = 0;
}
for (let ref of cachedFavorites.values()) {
let group = cachedFavoriteGroups[ref.$groupKey];
if (typeof group === 'undefined') {
continue;
}

View File

@@ -426,8 +426,8 @@
import { computed, nextTick, onBeforeMount, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { MoreFilled, Plus, Refresh } from '@element-plus/icons-vue';
import { Ellipsis, RefreshCcw } from 'lucide-vue-next';
import { Button } from '@/components/ui/button';
import { InputGroupField, InputGroupSearch } from '@/components/ui/input-group';
import { Button } from '@/components/ui/button';
import { ElMessageBox } from 'element-plus';
import { Spinner } from '@/components/ui/spinner';
import { storeToRefs } from 'pinia';
@@ -1023,10 +1023,10 @@
getLocalWorldFavorites();
}
function changeWorldGroupVisibility(name, visibility, menuKey = null) {
function changeWorldGroupVisibility(group, visibility, menuKey = null) {
const params = {
type: 'world',
group: name,
type: group.type,
group: group.name,
visibility
};
favoriteRequest.saveFavoriteGroup(params).then((args) => {
@@ -1120,7 +1120,7 @@
function handleVisibilitySelection(group, visibility) {
const menuKey = remoteGroupMenuKey(group.key);
changeWorldGroupVisibility(group.name, visibility, menuKey);
changeWorldGroupVisibility(group, visibility, menuKey);
}
function handleRemoteRename(group) {
@@ -1164,7 +1164,7 @@
}
favoriteRequest
.saveFavoriteGroup({
type: 'world',
type: group.type,
group: group.name,
displayName: newName
})

View File

@@ -112,7 +112,7 @@
function addFavoriteWorld(groupAPI) {
return favoriteRequest
.addFavorite({
type: 'world',
type: groupAPI.type,
favoriteId: props.currentFavorite.id,
tags: groupAPI.name
})

View File

@@ -359,7 +359,7 @@
function addFavoriteWorld(ref, group, message) {
return favoriteRequest
.addFavorite({
type: 'world',
type: group.type,
favoriteId: ref.id,
tags: group.name
})