remove unnecessary props and event emissions in Sidebar components

This commit is contained in:
pa
2026-01-25 15:08:45 +09:00
parent bcee6b5298
commit 2b1d0ff344
4 changed files with 7 additions and 25 deletions

View File

@@ -96,7 +96,7 @@
<template #friends>
<div class="h-full overflow-hidden">
<ScrollArea ref="friendsScrollAreaRef" class="h-full">
<FriendsSidebar @confirm-delete-friend="confirmDeleteFriend" />
<FriendsSidebar />
</ScrollArea>
<BackToTop :target="friendsScrollTarget" :bottom="20" :right="20" :teleport="false" />
</div>
@@ -104,7 +104,7 @@
<template #groups>
<div class="h-full overflow-hidden">
<ScrollArea ref="groupsScrollAreaRef" class="h-full">
<GroupsSidebar :group-order="inGameGroupOrder" />
<GroupsSidebar />
</ScrollArea>
<BackToTop :target="groupsScrollTarget" :bottom="20" :right="20" :teleport="false" />
</div>
@@ -135,10 +135,10 @@
import GroupsSidebar from './components/GroupsSidebar.vue';
const { friends, isRefreshFriendsLoading, onlineFriendCount } = storeToRefs(useFriendStore());
const { refreshFriendsList, confirmDeleteFriend } = useFriendStore();
const { refreshFriendsList } = useFriendStore();
const { quickSearchRemoteMethod, quickSearchChange } = useSearchStore();
const { quickSearchItems } = storeToRefs(useSearchStore());
const { inGameGroupOrder, groupInstances } = storeToRefs(useGroupStore());
const { groupInstances } = storeToRefs(useGroupStore());
const { t } = useI18n();
const sidebarTabs = computed(() => [
{ value: 'friends', label: t('side_panel.friends') },

View File

@@ -43,11 +43,7 @@
</template>
<template v-else-if="!friend.ref && !isRefreshFriendsLoading">
<span>{{ friend.name || friend.id }}</span>
<Button
size="sm"
variant="ghost"
class="mr-1 w-6 h-6 text-xs"
@click.stop="$emit('confirm-delete-friend', friend.id)"
<Button size="sm" variant="ghost" class="mr-1 w-6 h-6 text-xs" @click.stop="confirmDeleteFriend(friend.id)"
><Trash2 class="h-4 w-4" />
</Button>
</template>
@@ -80,10 +76,9 @@
isGroupByInstance: Boolean
});
defineEmits(['confirm-delete-friend']);
const { hideNicknames } = storeToRefs(useAppearanceSettingsStore());
const { isRefreshFriendsLoading } = storeToRefs(useFriendStore());
const { confirmDeleteFriend } = useFriendStore();
const { showUserDialog } = useUserStore();
const { t } = useI18n();

View File

@@ -72,8 +72,7 @@
<friend-item
:friend="item.row.friend"
:style="item.row.itemStyle"
:is-group-by-instance="item.row.isGroupByInstance"
@confirm-delete-friend="confirmDeleteFriend" />
:is-group-by-instance="item.row.isGroupByInstance" />
</template>
</div>
</template>
@@ -105,7 +104,6 @@
import Location from '../../../components/Location.vue';
import configRepository from '../../../service/config';
const emit = defineEmits(['confirm-delete-friend']);
const { t } = useI18n();
const friendStore = useFriendStore();
@@ -479,10 +477,6 @@
saveFriendsGroupStates();
}
function confirmDeleteFriend(friend) {
emit('confirm-delete-friend', friend);
}
onMounted(() => {
scrollViewportRef.value = listRootRef.value?.closest('[data-slot="scroll-area-viewport"]') ?? null;
nextTick(() => {

View File

@@ -64,13 +64,6 @@
const { showGroupDialog, sortGroupInstancesByInGame } = useGroupStore();
const { groupInstances } = storeToRefs(useGroupStore());
defineProps({
groupOrder: {
type: Array,
default: () => []
}
});
const groupInstancesCfg = ref({});
const listRootRef = ref(null);
const scrollViewportRef = ref(null);