mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-04 06:18:48 +00:00
Panel tab click fix (#7867)
* Prevent double-loading of panels * Remove commented code
This commit is contained in:
parent
a37d21856e
commit
b0a864a618
@ -21,6 +21,7 @@ import {
|
|||||||
} from 'react-router-dom';
|
} from 'react-router-dom';
|
||||||
|
|
||||||
import { identifierString } from '../../functions/conversion';
|
import { identifierString } from '../../functions/conversion';
|
||||||
|
import { cancelEvent } from '../../functions/events';
|
||||||
import { navigateToLink } from '../../functions/navigation';
|
import { navigateToLink } from '../../functions/navigation';
|
||||||
import { useLocalState } from '../../states/LocalState';
|
import { useLocalState } from '../../states/LocalState';
|
||||||
import { Boundary } from '../Boundary';
|
import { Boundary } from '../Boundary';
|
||||||
@ -78,12 +79,12 @@ function BasePanelGroup({
|
|||||||
const handlePanelChange = useCallback(
|
const handlePanelChange = useCallback(
|
||||||
(panel: string | null, event?: any) => {
|
(panel: string | null, event?: any) => {
|
||||||
if (activePanels.findIndex((p) => p.name === panel) === -1) {
|
if (activePanels.findIndex((p) => p.name === panel) === -1) {
|
||||||
setLastUsedPanel('');
|
panel = '';
|
||||||
return navigate('../');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event && (event?.ctrlKey || event?.shiftKey)) {
|
if (event && (event?.ctrlKey || event?.shiftKey)) {
|
||||||
const url = `${location.pathname}/../${panel}`;
|
const url = `${location.pathname}/../${panel}`;
|
||||||
|
cancelEvent(event);
|
||||||
navigateToLink(url, navigate, event);
|
navigateToLink(url, navigate, event);
|
||||||
} else {
|
} else {
|
||||||
navigate(`../${panel}`);
|
navigate(`../${panel}`);
|
||||||
@ -117,12 +118,7 @@ function BasePanelGroup({
|
|||||||
return (
|
return (
|
||||||
<Boundary label={`PanelGroup-${pageKey}`}>
|
<Boundary label={`PanelGroup-${pageKey}`}>
|
||||||
<Paper p="sm" radius="xs" shadow="xs">
|
<Paper p="sm" radius="xs" shadow="xs">
|
||||||
<Tabs
|
<Tabs value={panel} orientation="vertical" keepMounted={false}>
|
||||||
value={panel}
|
|
||||||
orientation="vertical"
|
|
||||||
onChange={handlePanelChange}
|
|
||||||
keepMounted={false}
|
|
||||||
>
|
|
||||||
<Tabs.List justify="left">
|
<Tabs.List justify="left">
|
||||||
{panels.map(
|
{panels.map(
|
||||||
(panel) =>
|
(panel) =>
|
||||||
@ -136,7 +132,6 @@ function BasePanelGroup({
|
|||||||
<Tabs.Tab
|
<Tabs.Tab
|
||||||
p="xs"
|
p="xs"
|
||||||
value={panel.name}
|
value={panel.name}
|
||||||
// icon={(<InvenTreeIcon icon={panel.name}/>)} // Enable when implementing Icon manager everywhere
|
|
||||||
leftSection={panel.icon}
|
leftSection={panel.icon}
|
||||||
hidden={panel.hidden}
|
hidden={panel.hidden}
|
||||||
disabled={panel.disabled}
|
disabled={panel.disabled}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user