@neo4j-ndl/react
Version:
React implementation of Neo4j Design System
41 lines • 3.92 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
/**
*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { GraphLabel, Typography } from '@neo4j-ndl/react';
import { useGraphVisualizationContext } from '../graph-visualization-context';
import { GraphVisualizationSidepanel } from '../graph-visualization-sidepanel';
import { ShowAll } from './show-all';
const OVERVIEW_STEP_SIZE = 25;
export const OverviewPanel = () => {
const { nvlGraph } = useGraphVisualizationContext();
return (_jsxs(_Fragment, { children: [_jsx(GraphVisualizationSidepanel.Title, { children: _jsx(Typography, { variant: "h6", children: "Results overview" }) }), _jsx(GraphVisualizationSidepanel.Content, { children: _jsxs("div", { className: "ndl-graph-visualization-overview-panel", children: [nvlGraph.dataLookupTable.labels.length > 0 && (_jsxs("div", { className: "ndl-overview-section", children: [_jsx("div", { className: "ndl-overview-header", children: _jsxs("span", { children: ["Nodes", ` (${nvlGraph.nodes.length.toLocaleString()})`] }) }), _jsx("div", { className: "ndl-overview-items", tabIndex: 0, children: _jsx(ShowAll, { initiallyShown: OVERVIEW_STEP_SIZE, isButtonGroup: true, children: nvlGraph.dataLookupTable.labels.map((label) => function GraphLabelWrapper() {
var _a, _b, _c, _d;
return (_jsxs(GraphLabel, { type: "node", htmlAttributes: {
tabIndex: -1,
}, color: (_b = (_a = nvlGraph.dataLookupTable.labelMetaData[label]) === null || _a === void 0 ? void 0 : _a.mostCommonColor) !== null && _b !== void 0 ? _b : '', as: "span", children: [label, " (", (_d = (_c = nvlGraph.dataLookupTable.labelMetaData[label]) === null || _c === void 0 ? void 0 : _c.totalCount) !== null && _d !== void 0 ? _d : 0, ")"] }, label));
}) }) })] })), nvlGraph.dataLookupTable.types.length > 0 && (_jsxs("div", { className: "ndl-overview-relationships-section", children: [_jsxs("span", { className: "ndl-overview-relationships-title", children: ["Relationships", ` (${nvlGraph.rels.length.toLocaleString()})`] }), _jsx("div", { className: "ndl-overview-items", children: _jsx(ShowAll, { initiallyShown: OVERVIEW_STEP_SIZE, isButtonGroup: true, children: nvlGraph.dataLookupTable.types.map((type) => {
var _a, _b, _c, _d;
return (_jsxs(GraphLabel, { type: "relationship", htmlAttributes: {
tabIndex: -1,
}, color: (_b = (_a = nvlGraph.dataLookupTable.typeMetaData[type]) === null || _a === void 0 ? void 0 : _a.mostCommonColor) !== null && _b !== void 0 ? _b : '', as: "span", children: [type, " (", (_d = (_c = nvlGraph.dataLookupTable.typeMetaData[type]) === null || _c === void 0 ? void 0 : _c.totalCount) !== null && _d !== void 0 ? _d : 0, ")"] }, type));
}) }) })] }))] }) })] }));
};
//# sourceMappingURL=overview-panel.js.map