import React from 'react';
import { MessageSquare, Book, Users } from 'lucide-react';
import { useNavigate } from 'react-router-dom';
import { Tabs } from 'antd';
import PersonalKnowledgeBase from '../components/knowledgebase/PersonalKnowledgeBase';
import SharedKnowledgeBase from '../components/knowledgebase/SharedKnowledgeBase';
import './KnowledgeBasePage.css';

const { TabPane } = Tabs;

const KnowledgeBasePage = ({ user }) => {
  const navigate = useNavigate();

  const handleLogoClick = () => {
    navigate('/dashboard');
  };

  return (
    <div className="kb-management-page">
      <header className="kb-header">
        <div className="header-content">
          <div className="logo" onClick={handleLogoClick} style={{ cursor: 'pointer' }}>
            <MessageSquare className="logo-icon" />
            <span className="logo-text">iMeeting</span>
          </div>
          <h1>知识库管理</h1>
        </div>
      </header>
      <div className="kb-content">
        <div className="kb-wrapper">
          <Tabs defaultActiveKey="personal" className="kb-tabs">
            <TabPane 
              tab={<span><Book size={16} /> 个人知识库</span>} 
              key="personal"
            >
              <PersonalKnowledgeBase user={user} />
            </TabPane>
            <TabPane 
              tab={<span><Users size={16} /> 共享知识库</span>} 
              key="shared"
            >
              <SharedKnowledgeBase />
            </TabPane>
          </Tabs>
        </div>
      </div>
    </div>
  );
};

export default KnowledgeBasePage;