feat: resizeable sidebar
This commit is contained in:
@@ -84,6 +84,8 @@ export const TabBar: React.FC = () => {
|
||||
posts,
|
||||
media,
|
||||
dirtyPosts,
|
||||
sidebarVisible,
|
||||
toggleSidebar,
|
||||
setActiveTab,
|
||||
closeTab,
|
||||
pinTab,
|
||||
@@ -138,7 +140,7 @@ export const TabBar: React.FC = () => {
|
||||
}
|
||||
}, [activeTabId]);
|
||||
|
||||
// Keyboard shortcut handler (Ctrl+W to close active tab)
|
||||
// Keyboard shortcut handler (Ctrl+W to close active tab, Ctrl+B to toggle sidebar)
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 'w') {
|
||||
@@ -147,11 +149,15 @@ export const TabBar: React.FC = () => {
|
||||
closeTab(activeTabId);
|
||||
}
|
||||
}
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 'b') {
|
||||
e.preventDefault();
|
||||
toggleSidebar();
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('keydown', handleKeyDown);
|
||||
return () => window.removeEventListener('keydown', handleKeyDown);
|
||||
}, [activeTabId, closeTab]);
|
||||
}, [activeTabId, closeTab, toggleSidebar]);
|
||||
|
||||
if (tabs.length === 0) {
|
||||
return null;
|
||||
@@ -197,6 +203,18 @@ export const TabBar: React.FC = () => {
|
||||
|
||||
return (
|
||||
<div className="tab-bar">
|
||||
<button
|
||||
className="tab-bar-toggle-sidebar"
|
||||
onClick={toggleSidebar}
|
||||
title={`${sidebarVisible ? 'Hide' : 'Show'} Sidebar (Ctrl+B)`}
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
||||
<path d="M0 1h16v14H0V1zm1 1v12h4V2H1zm5 0v12h9V2H6z"/>
|
||||
{!sidebarVisible && <path d="M2 4h2v1H2V4zm0 2h2v1H2V6zm0 2h2v1H2V8z" opacity="0.5"/>}
|
||||
{sidebarVisible && <path d="M2 4h2v1H2V4zm0 2h2v1H2V6zm0 2h2v1H2V8z"/>}
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
{showLeftArrow && (
|
||||
<button
|
||||
className="tab-scroll-button tab-scroll-left"
|
||||
|
||||
Reference in New Issue
Block a user