<template>
  <div class="sidebar-view">
    <ProjectSelector
      :selected-project-id="selectedId"
      @project-selected="handleProjectSelected"
    />
  </div>
</template>

<script setup>
import { computed } from 'vue';
import ProjectSelector from '../components/ProjectSelector.vue';
import {
  selectedProjectId,
  setSelectedProject,
} from '../store/projectStore.js';

const selectedId = computed(() => selectedProjectId.value);

// 项目选择事件
const handleProjectSelected = (project) => {
  setSelectedProject(project);
  console.log('选中项目:', project);
  // 这里可以通过事件总线或状态管理工具将选中的项目传递给其他组件
};
</script>

<style scoped>
.sidebar-view {
  height: 100%;
  overflow-y: auto;
}
</style>
