MCPcopy Create free account
hub / github.com/allocnode/oh-my-sage / SessionPanel

Function SessionPanel

src/components/SessionPanel.tsx:49–201  ·  view source on GitHub ↗
({
                                         sessions, activeSessionId, loading = false,
                                         onSelectSession, onDeleteSession, onNewSession, onRefresh,
                                     }: SessionPanelProps)

Source from the content-addressed store, hash-verified

47}
48
49export default function SessionPanel({
50 sessions, activeSessionId, loading = false,
51 onSelectSession, onDeleteSession, onNewSession, onRefresh,
52 }: SessionPanelProps) {
53 return (
54 <div style={{height: '100%', minHeight: 0, display: 'flex', flexDirection: 'column'}}>
55 {/* 头部 */}
56 <div style={{
57 padding: '16px 16px 12px',
58 borderBottom: '1px solid var(--border-subtle)',
59 }}>
60 <div style={{display: 'flex', justifyContent: 'space-between', alignItems: 'center'}}>
61 <Space size={8}>
62 <HistoryOutlined style={{color: '#818cf8', fontSize: 15}}/>
63 <Text strong style={{color: 'var(--text-bright)', fontSize: 14}}>对话历史</Text>
64 </Space>
65 <Space size={6}>
66 <Button
67 type="primary"
68 icon={<PlusOutlined/>}
69 size="small"
70 onClick={onNewSession}
71 style={{borderRadius: 'var(--radius-full)', fontSize: 12, height: 28}}
72 >
73 新对话
74 </Button>
75 <Button
76 icon={<SyncOutlined/>}
77 size="small"
78 onClick={onRefresh}
79 loading={loading}
80 style={{
81 borderRadius: 'var(--radius-full)',
82 background: 'var(--bg-surface)',
83 borderColor: 'var(--border-default)',
84 color: 'var(--text-secondary)',
85 width: 28, height: 28,
86 }}
87 />
88 </Space>
89 </div>
90 </div>
91
92 {/* Session 列表 */}
93 <div style={{flex: 1, minHeight: 0, overflow: 'auto', padding: '8px'}}>
94 {loading ? (
95 <div style={{textAlign: 'center', padding: 40}}>
96 <Spin indicator={<SyncOutlined style={{fontSize: 20, color: '#818cf8'}} spin/>}/>
97 </div>
98 ) : sessions.length === 0 ? (
99 <div style={{textAlign: 'center', padding: '40px 20px'}}>
100 <MessageOutlined style={{fontSize: 28, color: 'var(--text-muted)', marginBottom: 12}}/>
101 <Text style={{display: 'block', color: 'var(--text-muted)', fontSize: 13}}>暂无对话历史</Text>
102 </div>
103 ) : (
104 sessions.map(session => {
105 const isActive = session.id === activeSessionId;
106 return (

Callers

nothing calls this directly

Calls 1

formatTimeFunction · 0.70

Tested by

no test coverage detected