Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
birm committed Oct 10, 2024
1 parent 44cf484 commit be0369e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
8 changes: 5 additions & 3 deletions source/components/Layout/VisGridView/VisGridSplitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import VisGridView from './VisGridView';
import { ConfigContext } from '../../../contexts/ConfigContext';
import './VisGridSplitter.css';

const VisGridSplitter = ({ layout, size, fullVisScreenHandler, fullScreened }) => {
function VisGridSplitter({
layout, size, fullVisScreenHandler, fullScreened,
}) {
const { config } = useContext(ConfigContext);

const renderSingleView = () => (
Expand Down Expand Up @@ -45,7 +47,7 @@ const VisGridSplitter = ({ layout, size, fullVisScreenHandler, fullScreened }) =
default:
return renderSingleView();
}
};
}

VisGridSplitter.propTypes = {
layout: PropTypes.oneOf(['default', 'left', 'right', 'top']).isRequired,
Expand All @@ -54,4 +56,4 @@ VisGridSplitter.propTypes = {
fullScreened: PropTypes.bool.isRequired,
};

export default VisGridSplitter;
export default VisGridSplitter;
15 changes: 7 additions & 8 deletions source/components/Layout/VisGridView/VisGridView.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function VisGridView({ fullVisScreenHandler, fullScreened, designation }) {
const draggableHandle = config.GRAGGABLE ? '.draggable' : '';
const isDraggable = config.DRAGGABLE || false;
const isResizable = config.RESIZABLE || false;

const [isResizing, SetIsResizing] = useState(false);
const [resizingItemId, SetResizingItemId] = useState(null);
const [appLayout, setAppLayout] = useState({
Expand All @@ -30,12 +30,11 @@ function VisGridView({ fullVisScreenHandler, fullScreened, designation }) {
const self = useRef();

const visConfig = useMemo(() => {
console.log("designation", designation)
if (designation == "*"){
return AllVisConfig // for * don't filter, just show all
} else {
return AllVisConfig.filter((x) => x.designation === designation || (!x.designation && designation === "default"));
console.log('designation', designation);
if (designation == '*') {
return AllVisConfig; // for * don't filter, just show all
}
return AllVisConfig.filter((x) => x.designation === designation || (!x.designation && designation === 'default'));
}, [AllVisConfig, designation]);

const updateViewSize = () => {
Expand Down Expand Up @@ -145,5 +144,5 @@ VisGridView.propTypes = {
};

VisGridView.defaultProps = {
designation: "*",
};
designation: '*',
};

0 comments on commit be0369e

Please sign in to comment.