-
Notifications
You must be signed in to change notification settings - Fork 18
fix: 优化右侧面板 UI #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: 优化右侧面板 UI #80
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ import { ExportLogsModal } from './settings/ExportLogsModal'; | |
|
|
||
| export function LogsPanel() { | ||
| const { t } = useTranslation(); | ||
| const logsEndRef = useRef<HTMLDivElement>(null); | ||
| const logsContainerRef = useRef<HTMLDivElement>(null); | ||
| const { sidePanelExpanded, toggleSidePanelExpanded, activeInstanceId, instanceLogs, clearLogs } = | ||
| useAppStore(); | ||
| const { state: menuState, show: showMenu, hide: hideMenu } = useContextMenu(); | ||
|
|
@@ -20,8 +20,9 @@ export function LogsPanel() { | |
| const logs = activeInstanceId ? instanceLogs[activeInstanceId] || [] : []; | ||
|
|
||
| useEffect(() => { | ||
| if (logsEndRef.current) { | ||
| logsEndRef.current.scrollIntoView({ behavior: 'smooth' }); | ||
| const el = logsContainerRef.current; | ||
| if (el) { | ||
| el.scrollTo({ top: el.scrollHeight, behavior: 'smooth' }); | ||
| } | ||
| }, [logs]); | ||
|
|
||
|
|
@@ -121,7 +122,7 @@ export function LogsPanel() { | |
| }; | ||
|
|
||
| return ( | ||
| <div className="flex-1 flex flex-col bg-bg-secondary rounded-lg border border-border overflow-hidden"> | ||
| <div className="flex-1 flex flex-col bg-bg-secondary rounded-lg ring-1 ring-inset ring-border overflow-hidden min-h-50"> | ||
| {/* 标题栏(可点击展开/折叠上方面板) */} | ||
| <div | ||
| role="button" | ||
|
Comment on lines
127
to
128
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): 可点击的标题 由于缺少 Original comment in Englishissue (bug_risk): The clickable header Because it lacks |
||
|
|
@@ -133,7 +134,7 @@ export function LogsPanel() { | |
| toggleSidePanelExpanded(); | ||
| } | ||
| }} | ||
| className="flex items-center justify-between px-3 py-2 border-b border-border hover:bg-bg-hover transition-colors cursor-pointer" | ||
| className="flex items-center justify-between px-3 py-2 border-b border-border hover:bg-bg-hover transition-colors cursor-pointer shrink-0 rounded-t-lg focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/50 outline-none" | ||
| > | ||
| <span className="text-sm font-medium text-text-primary">{t('logs.title')}</span> | ||
| <div className="flex items-center gap-2"> | ||
|
|
@@ -190,7 +191,8 @@ export function LogsPanel() { | |
|
|
||
| {/* 日志内容 */} | ||
| <div | ||
| className="flex-1 overflow-y-auto p-2 font-mono text-xs bg-bg-tertiary" | ||
| ref={logsContainerRef} | ||
| className="flex-1 min-h-0 overflow-y-auto p-2 font-mono text-xs bg-bg-tertiary" | ||
| onContextMenu={handleContextMenu} | ||
| > | ||
| {logs.length === 0 ? ( | ||
|
|
@@ -223,7 +225,6 @@ export function LogsPanel() { | |
| </div> | ||
| ), | ||
| )} | ||
| <div ref={logsEndRef} /> | ||
| </> | ||
| )} | ||
| </div> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -504,7 +504,7 @@ export function ScreenshotPanel() { | |
| ]); | ||
|
|
||
| return ( | ||
| <div className="bg-bg-secondary rounded-lg border border-border"> | ||
| <div className="bg-bg-secondary rounded-lg ring-1 ring-inset ring-border overflow-hidden"> | ||
| {/* 标题栏(可点击折叠) */} | ||
| <div | ||
| role="button" | ||
|
Comment on lines
509
to
510
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): 截图面板的标题 这个标题同时使用了 Original comment in Englishissue (bug_risk): The screenshot panel header This header uses |
||
|
|
@@ -513,13 +513,16 @@ export function ScreenshotPanel() { | |
| onKeyDown={(e) => { | ||
| if (e.key === 'Enter' || e.key === ' ') { | ||
| e.preventDefault(); | ||
| setScreenshotPanelExpanded(!screenshotPanelExpanded); | ||
| (e.currentTarget as HTMLElement).click(); | ||
| } | ||
| }} | ||
| className={clsx( | ||
| 'w-full flex items-center justify-between px-3 py-2 hover:bg-bg-hover transition-colors cursor-pointer', | ||
| 'w-full flex items-center justify-between px-3 py-2 hover:bg-bg-hover cursor-pointer focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/50 outline-none', | ||
| screenshotPanelExpanded ? 'rounded-t-lg' : 'rounded-lg', | ||
| )} | ||
| style={{ | ||
| transition: `background-color 150ms, border-radius 0s${screenshotPanelExpanded ? '' : ' 150ms'}`, | ||
| }} | ||
| > | ||
| <div className="flex items-center gap-2"> | ||
| <Monitor className="w-4 h-4 text-text-secondary" /> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class
min-h-50translates tomin-height: 12.5rem(200px) in Tailwind CSS. This is likely too large for a minimum height constraint on a logs panel that should be flexible. Consider using a smaller value likemin-h-32(128px) ormin-h-24(96px) to better match typical UI requirements while still preventing excessive compression in small windows.