From b1a9995767d8356ef8f9b227a40ea11405da474a Mon Sep 17 00:00:00 2001 From: congsh Date: Fri, 17 Apr 2026 16:27:30 +0800 Subject: [PATCH] feat: add missing components - notification store, notification panel, game select dialog, invite button Co-Authored-By: Claude Opus 4.7 --- .../components/common/NotificationPanel.vue | 56 ++++++ .../src/components/team/GameSelectDialog.vue | 180 ++++++++++++++++++ frontend/src/components/team/InviteButton.vue | 78 ++++++++ frontend/src/stores/notification.ts | 41 ++++ 4 files changed, 355 insertions(+) create mode 100644 frontend/src/components/common/NotificationPanel.vue create mode 100644 frontend/src/components/team/GameSelectDialog.vue create mode 100644 frontend/src/components/team/InviteButton.vue create mode 100644 frontend/src/stores/notification.ts diff --git a/frontend/src/components/common/NotificationPanel.vue b/frontend/src/components/common/NotificationPanel.vue new file mode 100644 index 0000000..8112601 --- /dev/null +++ b/frontend/src/components/common/NotificationPanel.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/frontend/src/components/team/GameSelectDialog.vue b/frontend/src/components/team/GameSelectDialog.vue new file mode 100644 index 0000000..9bf8b02 --- /dev/null +++ b/frontend/src/components/team/GameSelectDialog.vue @@ -0,0 +1,180 @@ + + + + + diff --git a/frontend/src/components/team/InviteButton.vue b/frontend/src/components/team/InviteButton.vue new file mode 100644 index 0000000..599a537 --- /dev/null +++ b/frontend/src/components/team/InviteButton.vue @@ -0,0 +1,78 @@ + + + diff --git a/frontend/src/stores/notification.ts b/frontend/src/stores/notification.ts new file mode 100644 index 0000000..4674ea3 --- /dev/null +++ b/frontend/src/stores/notification.ts @@ -0,0 +1,41 @@ +import { defineStore } from 'pinia' +import { ref, computed } from 'vue' +import type { Invitation } from '@/types' +import { getPendingInvitations } from '@/api/invitations' + +export const useNotificationStore = defineStore('notification', () => { + const pendingInvitations = ref([]) + const loading = ref(false) + const showPanel = ref(false) + + const unreadCount = computed(() => pendingInvitations.value.length) + + async function loadPendingInvitations() { + try { + loading.value = true + pendingInvitations.value = await getPendingInvitations() + } catch (error) { + console.error('加载待处理邀请失败:', error) + } finally { + loading.value = false + } + } + + function removeInvitation(invitationId: string) { + pendingInvitations.value = pendingInvitations.value.filter(i => i.id !== invitationId) + } + + function togglePanel() { + showPanel.value = !showPanel.value + } + + return { + pendingInvitations, + loading, + showPanel, + unreadCount, + loadPendingInvitations, + removeInvitation, + togglePanel + } +})