refactor: remove quick add and page navigation sections from editor toolbar

This commit is contained in:
2025-12-06 01:00:30 +01:00
parent f48813c199
commit 4c72030687

View File

@@ -1385,25 +1385,7 @@ export default function EditorToolbar({
sx={{ mx: 0.5, height: 32, alignSelf: "center" }}
/>
{/* Quick Add Toolbar */}
<ToolbarSection label={isSmallScreen ? undefined : "INSERISCI"}>
{ELEMENT_TYPES.map(({ type, icon: Icon, label, color }) => (
<StyledIconButton
key={type}
tooltip={`${label} (${ELEMENT_TYPES.find((e) => e.type === type)?.shortcut})`}
onClick={() => onAddElement(type)}
color={color}
>
<Icon fontSize="small" />
</StyledIconButton>
))}
</ToolbarSection>
<Divider
orientation="vertical"
flexItem
sx={{ mx: 0.5, height: 32, alignSelf: "center" }}
/>
{/* Selection Actions */}
<ToolbarSection label={isSmallScreen ? undefined : "MODIFICA"}>
@@ -1715,93 +1697,10 @@ export default function EditorToolbar({
</Box>
</Popover>
<Divider
orientation="vertical"
flexItem
sx={{ mx: 0.5, height: 32, alignSelf: "center" }}
/>
{/* Page Navigation */}
<ToolbarSection label={isSmallScreen ? undefined : "PAGINA"}>
<StyledIconButton
tooltip="Pagina precedente (PgUp)"
onClick={onPrevPage}
disabled={currentPageIndex <= 0}
>
<PrevPageIcon fontSize="small" />
</StyledIconButton>
<Button
size="small"
onClick={(e) => setPageMenuAnchor(e.currentTarget)}
endIcon={<DropdownIcon />}
sx={{
px: 1.5,
borderRadius: 1.5,
textTransform: "none",
bgcolor: "action.hover",
"&:hover": { bgcolor: "action.selected" },
}}
>
<PageIcon
fontSize="small"
sx={{ mr: 0.5, color: "primary.main" }}
/>
<Typography variant="body2" fontFamily="monospace" fontWeight={600}>
{currentPageIndex + 1} / {totalPages}
</Typography>
</Button>
<StyledIconButton
tooltip="Pagina successiva (PgDn)"
onClick={onNextPage}
disabled={currentPageIndex >= totalPages - 1}
>
<NextPageIcon fontSize="small" />
</StyledIconButton>
</ToolbarSection>
{/* Page Menu */}
<Menu
anchorEl={pageMenuAnchor}
open={Boolean(pageMenuAnchor)}
onClose={() => setPageMenuAnchor(null)}
PaperProps={{ sx: { borderRadius: 2, minWidth: 200 } }}
>
<Box sx={{ px: 2, py: 1.5 }}>
<Typography variant="overline" color="text.secondary">
Pagina corrente
</Typography>
<Typography variant="subtitle1" fontWeight={600}>
{currentPageName}
</Typography>
</Box>
<Divider />
<MenuItem
onClick={() => {
onPrevPage();
setPageMenuAnchor(null);
}}
disabled={currentPageIndex <= 0}
>
<ListItemIcon>
<PrevPageIcon />
</ListItemIcon>
<ListItemText primary="Pagina precedente" secondary="PgUp" />
</MenuItem>
<MenuItem
onClick={() => {
onNextPage();
setPageMenuAnchor(null);
}}
disabled={currentPageIndex >= totalPages - 1}
>
<ListItemIcon>
<NextPageIcon />
</ListItemIcon>
<ListItemText primary="Pagina successiva" secondary="PgDn" />
</MenuItem>
</Menu>
<Box flex={1} />