Skip to content

Commit 689a616

Browse files
committed
[gephi-lite] WIP on making filters liter
1 parent 6739172 commit 689a616

File tree

18 files changed

+423
-652
lines changed

18 files changed

+423
-652
lines changed

packages/gephi-lite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"license": "gpl-3.0",
66
"scripts": {
7-
"start": "vite",
7+
"start": "vite --host",
88
"build": "vite build && npm run generate-json-schema",
99
"serve": "vite preview",
1010
"test": "vitest run src",

packages/gephi-lite/src/components/GraphFilters/FilterCreator.tsx

Lines changed: 0 additions & 219 deletions
This file was deleted.
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
import { useReadAtom } from "@ouestware/atoms";
2+
import { isNil } from "lodash";
23
import { FC } from "react";
34
import { useTranslation } from "react-i18next";
45

6+
import { useFilters, useGraphDataset, usePreferences } from "../../core/context/dataContexts";
57
import { filteredGraphsAtom } from "../../core/graph";
68

7-
export const FilteredGraphSummary: FC<{ filterIndex: number }> = ({ filterIndex }) => {
9+
export const FilteredGraphSummary: FC<{ filterIndex?: number }> = ({ filterIndex }) => {
810
const { t } = useTranslation();
11+
const { locale } = usePreferences();
12+
const { fullGraph } = useGraphDataset();
13+
const { filters } = useFilters();
914
const filteredGraphs = useReadAtom(filteredGraphsAtom);
10-
const relatedGraph = filteredGraphs[filterIndex]?.graph;
15+
const relatedGraph = !isNil(filterIndex) ? filteredGraphs[filterIndex]?.graph : fullGraph;
1116

1217
return (
13-
<div>
14-
{relatedGraph.order} {t("graph.model.nodes", { count: relatedGraph.order })}, {relatedGraph.size}{" "}
15-
{t("graph.model.edges", { count: relatedGraph.size })}
16-
</div>
18+
<section className="filter-graph">
19+
{isNil(filterIndex) && <div>{t("filters.full_graph")}</div>}
20+
{filterIndex === filters.length - 1 && <div>{t("filters.visible_graph")}</div>}
21+
<div>
22+
{relatedGraph.order.toLocaleString(locale)} {t("graph.model.nodes", { count: relatedGraph.order })},{" "}
23+
{relatedGraph.size.toLocaleString(locale)} {t("graph.model.edges", { count: relatedGraph.size })}
24+
</div>
25+
</section>
1726
);
1827
};

0 commit comments

Comments
 (0)