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

View File

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

View File

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

View File

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