M0-M11 狩夜人笔记初始实现:11里程碑+86测试

This commit is contained in:
hunter-dev
2026-08-24 20:35:22 +08:00
commit 3ebd33536b
106 changed files with 10490 additions and 0 deletions
@@ -0,0 +1,35 @@
import { useTabs } from './tab-store';
import { useStore } from '../../store';
import { useEffect } from 'react';
export function TabBar() {
const { tabs, activeId, setActive, closeTab, togglePin } = useTabs();
const { openDoc, currentPath } = useStore();
// 当 activeId 变化,加载对应标签的文档
useEffect(() => {
const tab = tabs.find(t => t.id === activeId);
if (tab && tab.path !== currentPath) openDoc(tab.path);
}, [activeId]);
if (tabs.length === 0) return null;
return (
<div style={{ display: 'flex', borderBottom: '1px solid #2a2a3a', background: '#161620', overflowX: 'auto' }}>
{tabs.map(t => (
<div key={t.id} onClick={() => setActive(t.id)}
style={{ display: 'flex', alignItems: 'center', gap: 6, padding: '4px 10px', cursor: 'pointer',
borderBottom: activeId === t.id ? '2px solid #4a9eff' : '2px solid transparent',
background: activeId === t.id ? '#1a1a28' : 'transparent', fontSize: 12, color: activeId === t.id ? '#ddd' : '#888', whiteSpace: 'nowrap' }}>
{t.pinned && <span style={{ color: '#ffd54a' }}>★</span>}
<span>{t.path.split('/').pop()?.replace(/\.md$/, '')}</span>
{t.pinned ? (
<span style={{ color: '#888', fontSize: 10 }}>📌</span>
) : (
<span onClick={e => { e.stopPropagation(); closeTab(t.id); }} style={{ color: '#888', cursor: 'pointer', fontSize: 12 }} onMouseEnter={e => (e.currentTarget.style.color = '#f88')} onMouseLeave={e => (e.currentTarget.style.color = '#888')}>×</span>
)}
<span onClick={e => { e.stopPropagation(); togglePin(t.id); }} style={{ color: t.pinned ? '#ffd54a' : '#666', cursor: 'pointer', fontSize: 10 }} title={t.pinned ? '取消固定' : '固定'}>●</span>
</div>
))}
</div>
);
}