2025-06-27 18:00:35 +01:00
|
|
|
import React, { useState } from "react";
|
2025-07-21 16:48:24 +01:00
|
|
|
import { ActionIcon, Stack, Tooltip, Divider } from "@mantine/core";
|
|
|
|
import MenuBookIcon from "@mui/icons-material/MenuBookRounded";
|
|
|
|
import AppsIcon from "@mui/icons-material/AppsRounded";
|
|
|
|
import SettingsIcon from "@mui/icons-material/SettingsRounded";
|
|
|
|
import AutoAwesomeIcon from "@mui/icons-material/AutoAwesomeRounded";
|
|
|
|
import FolderIcon from "@mui/icons-material/FolderRounded";
|
2025-07-21 22:10:23 +01:00
|
|
|
import PersonIcon from "@mui/icons-material/PersonRounded";
|
|
|
|
import NotificationsIcon from "@mui/icons-material/NotificationsRounded";
|
2025-06-18 14:16:39 +01:00
|
|
|
import { useRainbowThemeContext } from "./RainbowThemeProvider";
|
2025-06-19 22:41:05 +01:00
|
|
|
import rainbowStyles from '../../styles/rainbow.module.css';
|
2025-06-27 18:00:35 +01:00
|
|
|
import AppConfigModal from './AppConfigModal';
|
2025-07-21 16:48:24 +01:00
|
|
|
import './QuickAccessBar.css';
|
2025-06-18 14:16:39 +01:00
|
|
|
|
|
|
|
interface QuickAccessBarProps {
|
|
|
|
onToolsClick: () => void;
|
|
|
|
onReaderToggle: () => void;
|
|
|
|
selectedToolKey?: string;
|
|
|
|
toolRegistry: any;
|
|
|
|
leftPanelView: 'toolPicker' | 'toolContent';
|
|
|
|
readerMode: boolean;
|
|
|
|
}
|
|
|
|
|
2025-07-21 16:48:24 +01:00
|
|
|
interface ButtonConfig {
|
|
|
|
id: string;
|
|
|
|
name: string;
|
|
|
|
icon: React.ReactNode;
|
|
|
|
tooltip: string;
|
|
|
|
isRound?: boolean;
|
|
|
|
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
|
|
onClick: () => void;
|
|
|
|
}
|
|
|
|
|
2025-07-22 16:48:11 +01:00
|
|
|
const actionIconStyle = {
|
|
|
|
backgroundColor: 'var(--icon-user-bg)',
|
|
|
|
color: 'var(--icon-user-color)',
|
|
|
|
borderRadius: '50%',
|
|
|
|
width: '1.5rem',
|
|
|
|
height: '1.5rem',
|
|
|
|
};
|
|
|
|
|
2025-07-21 22:10:23 +01:00
|
|
|
function NavHeader() {
|
|
|
|
return (
|
|
|
|
<>
|
2025-07-22 16:48:11 +01:00
|
|
|
<div className="flex flex-row items-center justify-center mb-0" style={{ gap: '0.5rem' }}>
|
2025-07-21 22:10:23 +01:00
|
|
|
<Tooltip label="User Profile" position="right">
|
|
|
|
<ActionIcon
|
|
|
|
size="md"
|
|
|
|
variant="subtle"
|
2025-07-22 16:48:11 +01:00
|
|
|
style={actionIconStyle}
|
2025-07-21 22:10:23 +01:00
|
|
|
>
|
2025-07-22 16:48:11 +01:00
|
|
|
<PersonIcon sx={{ fontSize: "1rem" }} />
|
2025-07-21 22:10:23 +01:00
|
|
|
</ActionIcon>
|
|
|
|
</Tooltip>
|
|
|
|
<Tooltip label="Notifications" position="right">
|
|
|
|
<ActionIcon
|
|
|
|
size="md"
|
|
|
|
variant="subtle"
|
2025-07-22 16:48:11 +01:00
|
|
|
style={actionIconStyle}
|
2025-07-21 22:10:23 +01:00
|
|
|
>
|
2025-07-22 16:48:11 +01:00
|
|
|
<NotificationsIcon sx={{ fontSize: "1rem" }} />
|
2025-07-21 22:10:23 +01:00
|
|
|
</ActionIcon>
|
|
|
|
</Tooltip>
|
|
|
|
</div>
|
|
|
|
{/* Divider after top icons */}
|
|
|
|
<Divider
|
|
|
|
size="xs"
|
|
|
|
style={{
|
2025-07-22 16:48:11 +01:00
|
|
|
width: '3.75rem',
|
2025-07-21 22:10:23 +01:00
|
|
|
borderColor: 'var(--color-gray-300)'
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2025-06-19 19:47:44 +01:00
|
|
|
const QuickAccessBar = ({
|
2025-06-18 14:16:39 +01:00
|
|
|
onToolsClick,
|
|
|
|
onReaderToggle,
|
|
|
|
selectedToolKey,
|
|
|
|
toolRegistry,
|
|
|
|
leftPanelView,
|
|
|
|
readerMode,
|
2025-06-19 19:47:44 +01:00
|
|
|
}: QuickAccessBarProps) => {
|
2025-06-18 14:16:39 +01:00
|
|
|
const { isRainbowMode } = useRainbowThemeContext();
|
2025-06-27 18:00:35 +01:00
|
|
|
const [configModalOpen, setConfigModalOpen] = useState(false);
|
2025-07-21 16:48:24 +01:00
|
|
|
const [activeButton, setActiveButton] = useState<string>('tools');
|
|
|
|
|
|
|
|
const buttonConfigs: ButtonConfig[] = [
|
|
|
|
{
|
|
|
|
id: 'tools',
|
|
|
|
name: 'All Tools',
|
2025-07-21 22:10:23 +01:00
|
|
|
icon: <AppsIcon sx={{ fontSize: 26 }} />,
|
2025-07-21 16:48:24 +01:00
|
|
|
tooltip: 'View all available tools',
|
|
|
|
size: 'lg',
|
2025-07-22 16:48:11 +01:00
|
|
|
isRound: false,
|
2025-07-21 16:48:24 +01:00
|
|
|
onClick: () => {
|
|
|
|
setActiveButton('tools');
|
|
|
|
onReaderToggle();
|
|
|
|
onToolsClick();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'read',
|
|
|
|
name: 'Read',
|
|
|
|
icon: <MenuBookIcon sx={{ fontSize: 20 }} />,
|
|
|
|
tooltip: 'Read documents',
|
|
|
|
size: 'lg',
|
2025-07-22 16:48:11 +01:00
|
|
|
isRound: false,
|
2025-07-21 16:48:24 +01:00
|
|
|
onClick: () => {
|
|
|
|
setActiveButton('read');
|
|
|
|
onReaderToggle();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'sign',
|
|
|
|
name: 'Sign',
|
|
|
|
icon:
|
2025-07-22 16:48:11 +01:00
|
|
|
<span className="material-symbols-rounded" style={{ fontSize: 20 }}>
|
2025-07-21 16:48:24 +01:00
|
|
|
signature
|
|
|
|
</span>,
|
|
|
|
tooltip: 'Sign your document',
|
|
|
|
size: 'lg',
|
2025-07-22 16:48:11 +01:00
|
|
|
isRound: false,
|
2025-07-21 16:48:24 +01:00
|
|
|
onClick: () => setActiveButton('sign')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'automate',
|
|
|
|
name: 'Automate',
|
|
|
|
icon: <AutoAwesomeIcon sx={{ fontSize: 20 }} />,
|
|
|
|
tooltip: 'Automate workflows',
|
|
|
|
size: 'lg',
|
2025-07-22 16:48:11 +01:00
|
|
|
isRound: false,
|
2025-07-21 16:48:24 +01:00
|
|
|
onClick: () => setActiveButton('automate')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'files',
|
|
|
|
name: 'Files',
|
|
|
|
icon: <FolderIcon sx={{ fontSize: 20 }} />,
|
|
|
|
tooltip: 'Manage files',
|
|
|
|
isRound: true,
|
|
|
|
size: 'lg',
|
|
|
|
onClick: () => setActiveButton('files')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'activity',
|
|
|
|
name: 'Activity',
|
|
|
|
icon:
|
2025-07-22 16:48:11 +01:00
|
|
|
<span className="material-symbols-rounded" style={{ fontSize: 20 }}>
|
2025-07-21 16:48:24 +01:00
|
|
|
vital_signs
|
|
|
|
</span>,
|
|
|
|
tooltip: 'View activity and analytics',
|
|
|
|
isRound: true,
|
|
|
|
size: 'lg',
|
|
|
|
onClick: () => setActiveButton('activity')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'config',
|
|
|
|
name: 'Config',
|
|
|
|
icon: <SettingsIcon sx={{ fontSize: 16 }} />,
|
|
|
|
tooltip: 'Configure settings',
|
|
|
|
size: 'lg',
|
|
|
|
onClick: () => {
|
|
|
|
setConfigModalOpen(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2025-07-22 16:52:37 +01:00
|
|
|
const CIRCULAR_BORDER_RADIUS = '50%';
|
|
|
|
const ROUND_BORDER_RADIUS = '8px';
|
2025-07-22 16:48:11 +01:00
|
|
|
|
|
|
|
const getBorderRadius = (config: ButtonConfig): string => {
|
2025-07-22 16:52:37 +01:00
|
|
|
return config.isRound ? CIRCULAR_BORDER_RADIUS : ROUND_BORDER_RADIUS;
|
2025-07-22 16:48:11 +01:00
|
|
|
};
|
|
|
|
|
2025-07-21 16:48:24 +01:00
|
|
|
const getButtonStyle = (config: ButtonConfig) => {
|
|
|
|
const isActive = activeButton === config.id;
|
2025-07-21 22:10:23 +01:00
|
|
|
|
|
|
|
if (isActive) {
|
|
|
|
// Active state - use specific icon colors
|
|
|
|
if (config.id === 'tools') {
|
|
|
|
return {
|
|
|
|
backgroundColor: 'var(--icon-tools-bg)',
|
|
|
|
color: 'var(--icon-tools-color)',
|
|
|
|
border: 'none',
|
2025-07-22 16:48:11 +01:00
|
|
|
borderRadius: getBorderRadius(config),
|
2025-07-21 22:10:23 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
if (config.id === 'read') {
|
|
|
|
return {
|
|
|
|
backgroundColor: 'var(--icon-read-bg)',
|
|
|
|
color: 'var(--icon-read-color)',
|
|
|
|
border: 'none',
|
2025-07-22 16:48:11 +01:00
|
|
|
borderRadius: getBorderRadius(config),
|
2025-07-21 22:10:23 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
if (config.id === 'sign') {
|
|
|
|
return {
|
|
|
|
backgroundColor: 'var(--icon-sign-bg)',
|
|
|
|
color: 'var(--icon-sign-color)',
|
|
|
|
border: 'none',
|
2025-07-22 16:48:11 +01:00
|
|
|
borderRadius: getBorderRadius(config),
|
2025-07-21 22:10:23 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
if (config.id === 'automate') {
|
|
|
|
return {
|
|
|
|
backgroundColor: 'var(--icon-automate-bg)',
|
|
|
|
color: 'var(--icon-automate-color)',
|
|
|
|
border: 'none',
|
2025-07-22 16:48:11 +01:00
|
|
|
borderRadius: getBorderRadius(config),
|
2025-07-21 22:10:23 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
if (config.id === 'files') {
|
|
|
|
return {
|
|
|
|
backgroundColor: 'var(--icon-files-bg)',
|
|
|
|
color: 'var(--icon-files-color)',
|
2025-07-22 16:52:37 +01:00
|
|
|
borderRadius: CIRCULAR_BORDER_RADIUS,
|
2025-07-21 22:10:23 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
if (config.id === 'activity') {
|
|
|
|
return {
|
|
|
|
backgroundColor: 'var(--icon-activity-bg)',
|
|
|
|
color: 'var(--icon-activity-color)',
|
2025-07-22 16:52:37 +01:00
|
|
|
borderRadius: CIRCULAR_BORDER_RADIUS,
|
2025-07-21 22:10:23 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
if (config.id === 'config') {
|
|
|
|
return {
|
|
|
|
backgroundColor: 'var(--icon-config-bg)',
|
|
|
|
color: 'var(--icon-config-color)',
|
|
|
|
border: 'none',
|
2025-07-22 16:48:11 +01:00
|
|
|
borderRadius: getBorderRadius(config),
|
2025-07-21 22:10:23 +01:00
|
|
|
};
|
|
|
|
}
|
2025-07-21 16:48:24 +01:00
|
|
|
}
|
2025-07-21 22:10:23 +01:00
|
|
|
|
|
|
|
// Inactive state - use consistent inactive colors
|
2025-07-21 16:48:24 +01:00
|
|
|
return {
|
2025-07-21 22:10:23 +01:00
|
|
|
backgroundColor: 'var(--icon-inactive-bg)',
|
|
|
|
color: 'var(--icon-inactive-color)',
|
2025-07-21 16:48:24 +01:00
|
|
|
border: 'none',
|
2025-07-22 16:48:11 +01:00
|
|
|
borderRadius: getBorderRadius(config),
|
2025-07-21 16:48:24 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const getTextStyle = (config: ButtonConfig) => {
|
|
|
|
const isActive = activeButton === config.id;
|
|
|
|
return {
|
2025-07-22 16:48:11 +01:00
|
|
|
marginTop: '0.75rem',
|
|
|
|
fontSize: '0.75rem',
|
2025-07-21 16:48:24 +01:00
|
|
|
color: isActive ? 'var(--text-primary)' : 'var(--color-gray-700)',
|
|
|
|
fontWeight: isActive ? 'bold' : 'normal',
|
|
|
|
textRendering: 'optimizeLegibility' as const,
|
|
|
|
fontSynthesis: 'none' as const
|
|
|
|
};
|
|
|
|
};
|
2025-06-18 14:16:39 +01:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
2025-07-22 16:48:11 +01:00
|
|
|
className={`h-screen flex flex-col w-20 quick-access-bar ${isRainbowMode ? rainbowStyles.rainbowPaper : ''}`}
|
2025-06-18 14:16:39 +01:00
|
|
|
style={{
|
|
|
|
padding: '1rem 0.5rem',
|
2025-07-21 16:48:24 +01:00
|
|
|
backgroundColor: 'var(--bg-muted)',
|
2025-07-22 16:48:11 +01:00
|
|
|
width: '5rem',
|
|
|
|
minWidth: '5rem',
|
|
|
|
maxWidth: '5rem',
|
|
|
|
position: 'relative',
|
|
|
|
zIndex: 10
|
|
|
|
}}
|
|
|
|
onWheel={(e) => {
|
|
|
|
// Prevent the wheel event from bubbling up to parent containers
|
|
|
|
e.stopPropagation();
|
2025-06-18 14:16:39 +01:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Stack gap="lg" align="center" className="flex-1">
|
2025-07-21 22:10:23 +01:00
|
|
|
<NavHeader />
|
2025-07-21 16:48:24 +01:00
|
|
|
{buttonConfigs.map((config, index) => (
|
|
|
|
<React.Fragment key={config.id}>
|
|
|
|
<Tooltip label={config.tooltip} position="right">
|
|
|
|
<div className="flex flex-col items-center gap-1">
|
|
|
|
<ActionIcon
|
|
|
|
size={config.size || 'xl'}
|
|
|
|
variant="subtle"
|
|
|
|
onClick={config.onClick}
|
|
|
|
style={getButtonStyle(config)}
|
|
|
|
className={activeButton === config.id ? 'activeIconScale' : ''}
|
|
|
|
>
|
|
|
|
<span className="iconContainer">
|
|
|
|
{config.icon}
|
|
|
|
</span>
|
|
|
|
</ActionIcon>
|
|
|
|
<span className="text-xs text-center leading-tight" style={getTextStyle(config)}>
|
|
|
|
{config.name}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</Tooltip>
|
|
|
|
|
|
|
|
{/* Add divider after Automate button (index 3) */}
|
2025-07-21 22:10:23 +01:00
|
|
|
{index === 3 && (
|
|
|
|
<Divider
|
|
|
|
size="xs"
|
|
|
|
style={{
|
2025-07-22 16:48:11 +01:00
|
|
|
width: '3.75rem',
|
2025-07-21 22:10:23 +01:00
|
|
|
borderColor: 'var(--color-gray-300)'
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)}
|
2025-07-21 16:48:24 +01:00
|
|
|
|
|
|
|
{/* Add spacer before Config button (index 7) */}
|
|
|
|
{index === 5 && <div className="flex-1" />}
|
|
|
|
</React.Fragment>
|
|
|
|
))}
|
2025-06-18 14:16:39 +01:00
|
|
|
</Stack>
|
2025-06-27 18:00:35 +01:00
|
|
|
|
|
|
|
<AppConfigModal
|
|
|
|
opened={configModalOpen}
|
|
|
|
onClose={() => setConfigModalOpen(false)}
|
|
|
|
/>
|
2025-06-18 14:16:39 +01:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default QuickAccessBar;
|