fix: 开发者工具按钮仅在开发环境显示

This commit is contained in:
Linkon
2026-01-20 01:16:37 +08:00
parent 70bba94135
commit 5afa02ee52
+17 -15
View File
@@ -96,7 +96,7 @@ export const GlobalSidebar: React.FC = () => {
<div <div
style={{ style={{
height: '100vh', height: '100vh',
width: `${84 * zoom}px`, width: `84px`,
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
justifyContent: 'flex-end', justifyContent: 'flex-end',
@@ -110,8 +110,8 @@ export const GlobalSidebar: React.FC = () => {
className={`global-sidebar-toggle ${!showToggle ? 'hidden' : ''}`} className={`global-sidebar-toggle ${!showToggle ? 'hidden' : ''}`}
style={{ style={{
willChange: 'opacity, transform', willChange: 'opacity, transform',
width: `${24 * zoom}px`, width: `24px`,
height: `${60 * zoom}px` height: `60px`
}} }}
> >
<ChevronLeftIcon /> <ChevronLeftIcon />
@@ -124,9 +124,9 @@ export const GlobalSidebar: React.FC = () => {
backgroundColor: 'var(--ss-card-bg)', backgroundColor: 'var(--ss-card-bg)',
height: 'fit-content', height: 'fit-content',
willChange: 'opacity, transform', willChange: 'opacity, transform',
width: `${60 * zoom}px`, width: `60px`,
padding: `${12 * zoom}px ${8 * zoom}px`, padding: `12px 8px`,
gap: `${12 * zoom}px` gap: `12px`
}} }}
> >
{/* 顶部的关闭/收起按钮 */} {/* 顶部的关闭/收起按钮 */}
@@ -171,15 +171,17 @@ export const GlobalSidebar: React.FC = () => {
</Button> </Button>
</Tooltip> </Tooltip>
<Tooltip content="开发者工具" placement="top"> {import.meta.env.DEV && (
<Button <Tooltip content="开发者工具" placement="top">
shape="circle" <Button
variant="text" shape="circle"
onClick={() => (window as any).api?.toggleDevTools()} variant="text"
> onClick={() => (window as any).api?.toggleDevTools()}
<CodeIcon size="24px" /> >
</Button> <CodeIcon size="24px" />
</Tooltip> </Button>
</Tooltip>
)}
</div> </div>
</div> </div>
) )