diff --git a/yunkes/src/components/ChatSidebar.vue b/yunkes/src/components/ChatSidebar.vue index 3eb1af7..e109e1c 100644 --- a/yunkes/src/components/ChatSidebar.vue +++ b/yunkes/src/components/ChatSidebar.vue @@ -15,7 +15,7 @@ const emit = defineEmits<{ select: [ChatSession] }>() const sessions = ref([]) const loading = ref(false) const errorMsg = ref(null) -const filter = ref<'all' | 'friend' | 'group'>('all') +const filter = ref<'all' | 'friend' | 'group'>('friend') const keyword = ref('') async function load() { @@ -41,6 +41,9 @@ function sessionDisplayName(name: string | null | undefined): string { return name } +const friendCount = computed(() => sessions.value.filter(s => s.type === 'friend').length) +const groupCount = computed(() => sessions.value.filter(s => s.type === 'group').length) + const filtered = computed(() => sessions.value .filter((s) => (filter.value === 'all' ? true : s.type === filter.value)) @@ -61,11 +64,18 @@ watch(() => [props.ownerId, props.channel] as const, load, { immediate: true })