Skip to content

Commit d78b5e1

Browse files
fix
1 parent d66b0bf commit d78b5e1

File tree

2 files changed

+28
-16
lines changed

2 files changed

+28
-16
lines changed

src/pages/IndependentPanel/App.jsx

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function App() {
2727
const [currentSession, setCurrentSession] = useState(null)
2828
const [searchQuery, setSearchQuery] = useState('')
2929
const [debouncedQuery, setDebouncedQuery] = useState('')
30+
const [forceExpand, setForceExpand] = useState(false)
3031
const currentPort = useRef(null)
3132
const searchInputRef = useRef(null)
3233

@@ -134,19 +135,12 @@ function App() {
134135
return () => clearTimeout(id)
135136
}, [searchQuery])
136137

137-
// Keyboard shortcuts: Ctrl/Cmd+F and '/' to focus search
138+
// Keyboard shortcuts: Ctrl/Cmd+F and '/' to focus search (不改釘選狀態)
138139
useEffect(() => {
139140
const focusSearch = () => {
140-
if (collapsed) {
141-
setCollapsed(false)
142-
setUserConfig({ independentPanelCollapsed: false })
143-
setTimeout(() => {
144-
if (searchInputRef.current) {
145-
searchInputRef.current.focus()
146-
searchInputRef.current.select()
147-
}
148-
}, 0)
149-
} else if (searchInputRef.current) {
141+
if (searchInputRef.current) {
142+
// Ensure the sidebar temporarily expands when using shortcuts
143+
setForceExpand(true)
150144
searchInputRef.current.focus()
151145
searchInputRef.current.select()
152146
}
@@ -157,7 +151,7 @@ function App() {
157151
target &&
158152
(target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable)
159153

160-
// Always override browser find to route to panel search
154+
// Always override browser find to route to panel search(不自動釘選)
161155
if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === 'f') {
162156
e.preventDefault()
163157
focusSearch()
@@ -171,7 +165,7 @@ function App() {
171165
}
172166
window.addEventListener('keydown', onKeyDown)
173167
return () => window.removeEventListener('keydown', onKeyDown)
174-
}, [collapsed])
168+
}, [])
175169

176170
// Utility function to safely convert any value to a string
177171
const toSafeString = (value) =>
@@ -218,7 +212,7 @@ function App() {
218212
return (
219213
<div className="IndependentPanel">
220214
<div className="chat-container">
221-
<div className={`chat-sidebar ${collapsed ? 'collapsed' : ''}`}>
215+
<div className={`chat-sidebar ${collapsed && !forceExpand ? 'collapsed' : ''}`}>
222216
<div className="chat-sidebar-button-group">
223217
<button
224218
type="button"
@@ -242,6 +236,8 @@ function App() {
242236
placeholder={t('Search conversations...')}
243237
value={searchQuery}
244238
onChange={handleSearchChange}
239+
onFocus={() => setForceExpand(true)}
240+
onBlur={() => setForceExpand(false)}
245241
className="search-input"
246242
aria-label={t('Search')}
247243
aria-controls="chat-list"

src/pages/IndependentPanel/styles.scss

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@
136136
display: flex;
137137
flex-direction: column;
138138
flex-grow: 1;
139-
padding: 0 2px 0 0;
139+
// Add right padding to keep actions clear of the vertical scrollbar
140+
padding: 0 12px 0 0;
140141
background-color: var(--theme-color);
141142
overflow-y: auto;
142143
overflow-x: hidden;
@@ -167,6 +168,7 @@
167168

168169
// Ensure title shrinks and ellipsizes, keeping util group visible
169170
.chat-list-title {
171+
// Grow to use remaining space but allow shrinking with ellipsis
170172
flex: 1 1 auto;
171173
min-width: 0;
172174
overflow: hidden;
@@ -179,9 +181,11 @@
179181
display: flex;
180182
gap: 15px;
181183
align-items: center;
182-
flex: 0 0 auto;
184+
flex: 0 0 auto; // 工具區不縮小,確保可見
183185
}
184186

187+
// 保持工具區在收合時仍可見,符合 3768a06 行為
188+
185189
.normal-button {
186190
width: 100%;
187191
min-height: 40px;
@@ -197,6 +201,18 @@
197201
overflow: hidden;
198202
}
199203

204+
// Avoid inner utility confirm button stretching across the entire row
205+
.gpt-util-group .normal-button {
206+
width: auto;
207+
min-height: unset;
208+
padding: 2px 8px;
209+
}
210+
211+
// Keep list rows within sidebar bounds
212+
.normal-button.chat-list-item {
213+
overflow: hidden;
214+
}
215+
200216
.normal-button:focus-visible {
201217
outline: 2px solid var(--font-active-color);
202218
outline-offset: 2px;

0 commit comments

Comments
 (0)