mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
Enable adding friends to multiple local favorite groups and update instance activity charts to include all favorite friends.
This commit is contained in:
@@ -32,22 +32,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="favoriteDialog.type === 'friend'" style="margin-top: 20px">
|
<div v-if="favoriteDialog.type === 'friend'" style="margin-top: 20px">
|
||||||
<span style="display: block; text-align: center">{{ t('dialog.favorite.local_favorites') }}</span>
|
<span style="display: block; text-align: center">{{ t('dialog.favorite.local_favorites') }}</span>
|
||||||
<template v-if="currentLocalFriendGroup">
|
<template v-for="group in localFriendFavoriteGroups" :key="group">
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
|
v-if="hasLocalFriendFavorite(favoriteDialog.objectId, group)"
|
||||||
style="width: 100%; white-space: initial"
|
style="width: 100%; white-space: initial"
|
||||||
class="my-1"
|
class="my-1"
|
||||||
@click="removeLocalFriendFavorite(favoriteDialog.objectId, currentLocalFriendGroup)">
|
@click="removeLocalFriendFavorite(favoriteDialog.objectId, group)">
|
||||||
<Check />{{ currentLocalFriendGroup }} ({{
|
<Check />{{ group }} ({{ localFriendFavGroupLength(group) }})
|
||||||
localFriendFavGroupLength(currentLocalFriendGroup)
|
|
||||||
}})
|
|
||||||
</Button>
|
</Button>
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
v-for="group in localFriendFavoriteGroups"
|
v-else
|
||||||
:key="group"
|
|
||||||
style="width: 100%; white-space: initial"
|
style="width: 100%; white-space: initial"
|
||||||
class="my-1"
|
class="my-1"
|
||||||
@click="addLocalFriendFavorite(favoriteDialog.objectId, group)">
|
@click="addLocalFriendFavorite(favoriteDialog.objectId, group)">
|
||||||
@@ -154,16 +150,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const currentLocalFriendGroup = computed(() => {
|
|
||||||
const objectId = favoriteDialog.value.objectId;
|
|
||||||
for (const group of localFriendFavoriteGroups.value) {
|
|
||||||
if (hasLocalFriendFavorite(objectId, group)) {
|
|
||||||
return group;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => favoriteDialog.value.visible,
|
() => favoriteDialog.value.visible,
|
||||||
(value) => {
|
(value) => {
|
||||||
|
|||||||
@@ -538,8 +538,8 @@
|
|||||||
"auto_change_status": "Auto Change Status",
|
"auto_change_status": "Auto Change Status",
|
||||||
"auto_state_change_tooltip": "Automatically change status when there are other people in the instance (Alone / Company)",
|
"auto_state_change_tooltip": "Automatically change status when there are other people in the instance (Alone / Company)",
|
||||||
"alone_condition": "Consider alone when",
|
"alone_condition": "Consider alone when",
|
||||||
"alone": "No other players",
|
"alone": "No other user",
|
||||||
"no_friends": "No friends in instance",
|
"no_friends": "No friend in instance",
|
||||||
"alone_status": "Alone Status",
|
"alone_status": "Alone Status",
|
||||||
"company_status": "Company Status",
|
"company_status": "Company Status",
|
||||||
"allowed_instance_types": "Active in instance types",
|
"allowed_instance_types": "Active in instance types",
|
||||||
|
|||||||
@@ -1536,15 +1536,6 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
|||||||
if (hasLocalFriendFavorite(userId, group)) {
|
if (hasLocalFriendFavorite(userId, group)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const existingGroup in localFriendFavorites) {
|
|
||||||
const members = localFriendFavorites[existingGroup];
|
|
||||||
const idx = members?.indexOf(userId);
|
|
||||||
if (idx !== undefined && idx !== -1) {
|
|
||||||
members.splice(idx, 1);
|
|
||||||
database.removeFriendFromLocalFavorites(userId, existingGroup);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!localFriendFavorites[group]) {
|
if (!localFriendFavorites[group]) {
|
||||||
localFriendFavorites[group] = [];
|
localFriendFavorites[group] = [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,8 +186,8 @@
|
|||||||
import BackToTop from '@/components/BackToTop.vue';
|
import BackToTop from '@/components/BackToTop.vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
import { useAppearanceSettingsStore, useFavoriteStore, useFriendStore, useUserStore } from '../../../stores';
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from '../../../components/ui/popover';
|
import { Popover, PopoverContent, PopoverTrigger } from '../../../components/ui/popover';
|
||||||
import { useAppearanceSettingsStore, useFriendStore, useUserStore } from '../../../stores';
|
|
||||||
import { parseLocation, timeToText } from '../../../shared/utils';
|
import { parseLocation, timeToText } from '../../../shared/utils';
|
||||||
import { Slider } from '../../../components/ui/slider';
|
import { Slider } from '../../../components/ui/slider';
|
||||||
import { Switch } from '../../../components/ui/switch';
|
import { Switch } from '../../../components/ui/switch';
|
||||||
@@ -204,11 +204,32 @@
|
|||||||
|
|
||||||
const appearanceSettingsStore = useAppearanceSettingsStore();
|
const appearanceSettingsStore = useAppearanceSettingsStore();
|
||||||
const friendStore = useFriendStore();
|
const friendStore = useFriendStore();
|
||||||
|
const favoriteStore = useFavoriteStore();
|
||||||
const { isDarkMode, dtHour12 } = storeToRefs(appearanceSettingsStore);
|
const { isDarkMode, dtHour12 } = storeToRefs(appearanceSettingsStore);
|
||||||
const { localFavoriteFriends, friends } = storeToRefs(friendStore);
|
const { friends } = storeToRefs(friendStore);
|
||||||
|
const { cachedFavorites, localFriendFavorites } = storeToRefs(favoriteStore);
|
||||||
const { currentUser } = storeToRefs(useUserStore());
|
const { currentUser } = storeToRefs(useUserStore());
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
// All favorite friends (remote + local)
|
||||||
|
const allFavoriteFriends = computed(() => {
|
||||||
|
const set = new Set();
|
||||||
|
for (const ref of cachedFavorites.value.values()) {
|
||||||
|
if (ref.type === 'friend') {
|
||||||
|
set.add(ref.favoriteId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const group in localFriendFavorites.value) {
|
||||||
|
const userIds = localFriendFavorites.value[group];
|
||||||
|
if (userIds) {
|
||||||
|
for (const id of userIds) {
|
||||||
|
set.add(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return set;
|
||||||
|
});
|
||||||
|
|
||||||
const instanceActivityRef = ref(null);
|
const instanceActivityRef = ref(null);
|
||||||
|
|
||||||
const instanceActivityResizeObserver = new ResizeObserver(() => {
|
const instanceActivityResizeObserver = new ResizeObserver(() => {
|
||||||
@@ -373,7 +394,7 @@
|
|||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
getAllDateOfActivity();
|
getAllDateOfActivity();
|
||||||
await getActivityData(selectedDate, currentUser, friends, localFavoriteFriends, () =>
|
await getActivityData(selectedDate, currentUser, friends, allFavoriteFriends, () =>
|
||||||
handleIntersectionObserver(activityDetailChartRef)
|
handleIntersectionObserver(activityDetailChartRef)
|
||||||
);
|
);
|
||||||
await getWorldNameData();
|
await getWorldNameData();
|
||||||
@@ -398,7 +419,7 @@
|
|||||||
reloadData = async function () {
|
reloadData = async function () {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
try {
|
try {
|
||||||
await getActivityData(selectedDate, currentUser, friends, localFavoriteFriends, () =>
|
await getActivityData(selectedDate, currentUser, friends, allFavoriteFriends, () =>
|
||||||
handleIntersectionObserver(activityDetailChartRef)
|
handleIntersectionObserver(activityDetailChartRef)
|
||||||
);
|
);
|
||||||
await getWorldNameData();
|
await getWorldNameData();
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ export function useInstanceActivityData() {
|
|||||||
isFriend:
|
isFriend:
|
||||||
item.user_id === currentUser.value.id
|
item.user_id === currentUser.value.id
|
||||||
? null
|
? null
|
||||||
: friends.value.has(item.user_id),
|
: friends.value.has(item.user_id) ||
|
||||||
|
localFavoriteFriends.value.has(item.user_id),
|
||||||
isFavorite:
|
isFavorite:
|
||||||
item.user_id === currentUser.value.id
|
item.user_id === currentUser.value.id
|
||||||
? null
|
? null
|
||||||
|
|||||||
Reference in New Issue
Block a user