fixed InfoPanel appearing in not avialable places
This commit is contained in:
parent
fac0f14608
commit
ca85150a6d
@ -130,15 +130,17 @@ const StyledCrossIcon = styled(CrossIcon)`
|
||||
|
||||
StyledCrossIcon.defaultProps = { theme: Base };
|
||||
|
||||
const InfoPanel = ({ children, isVisible, setIsVisible, viewAs, isFiles }) => {
|
||||
if (!isVisible) return null;
|
||||
const InfoPanel = ({
|
||||
children,
|
||||
isVisible,
|
||||
setIsVisible,
|
||||
canDisplay,
|
||||
viewAs,
|
||||
}) => {
|
||||
if (!isVisible || !canDisplay) return null;
|
||||
|
||||
const closeInfoPanel = () => setIsVisible(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isFiles) closeInfoPanel();
|
||||
}, [isFiles]);
|
||||
|
||||
useEffect(() => {
|
||||
const onMouseDown = (e) => {
|
||||
if (e.target.id === "InfoPanelWrapper") closeInfoPanel();
|
||||
@ -188,12 +190,13 @@ StyledInfoPanel.defaultProps = { theme: Base };
|
||||
InfoPanel.defaultProps = { theme: Base };
|
||||
|
||||
export default inject(({ auth, filesStore }) => {
|
||||
const { isVisible, setIsVisible } = auth.infoPanelStore;
|
||||
const isFiles = true && filesStore;
|
||||
const { isVisible, setIsVisible, getCanDisplay } = auth.infoPanelStore;
|
||||
|
||||
const canDisplay = getCanDisplay();
|
||||
|
||||
return {
|
||||
isVisible,
|
||||
setIsVisible,
|
||||
isFiles,
|
||||
canDisplay,
|
||||
};
|
||||
})(InfoPanel);
|
||||
|
Loading…
Reference in New Issue
Block a user