feat: Friend tab

This commit is contained in:
pa
2025-10-30 22:41:39 +09:00
committed by Natsumi
parent b68399ca8a
commit cfd2f22b2c
14 changed files with 761 additions and 67 deletions
+46
View File
@@ -23,6 +23,7 @@ import { useFavoriteStore } from './favorite';
import { useFeedStore } from './feed';
import { useGeneralSettingsStore } from './settings/general';
import { useGroupStore } from './group';
import { useLocationStore } from './location';
import { useNotificationStore } from './notification';
import { useSharedFeedStore } from './sharedFeed';
import { useUiStore } from './ui';
@@ -45,6 +46,7 @@ export const useFriendStore = defineStore('Friend', () => {
const sharedFeedStore = useSharedFeedStore();
const updateLoopStore = useUpdateLoopStore();
const authStore = useAuthStore();
const locationStore = useLocationStore();
const { t } = useI18n();
const state = reactive({
@@ -135,6 +137,49 @@ export const useFriendStore = defineStore('Friend', () => {
);
});
const friendsInSameInstance = computed(() => {
const friendsList = {};
const allFriends = [...vipFriends.value, ...onlineFriends.value];
allFriends.forEach((friend) => {
if (!friend.ref?.$location) {
return;
}
let locationTag = friend.ref.$location.tag;
if (
!friend.ref.$location.isRealInstance &&
locationStore.lastLocation.friendList.has(friend.id)
) {
locationTag = locationStore.lastLocation.location;
}
const isReal = isRealInstance(locationTag);
if (!isReal) {
return;
}
if (!friendsList[locationTag]) {
friendsList[locationTag] = [];
}
friendsList[locationTag].push(friend);
});
const sortedFriendsList = [];
for (const group of Object.values(friendsList)) {
if (group.length > 1) {
sortedFriendsList.push(
group.sort(
getFriendsSortFunction(
appearanceSettingsStore.sidebarSortMethods
)
)
);
}
}
return sortedFriendsList.sort((a, b) => b.length - a.length);
});
watch(
() => watchState.isLoggedIn,
(isLoggedIn) => {
@@ -1570,6 +1615,7 @@ export const useFriendStore = defineStore('Friend', () => {
onlineFriends,
activeFriends,
offlineFriends,
friendsInSameInstance,
localFavoriteFriends,
isRefreshFriendsLoading,