Skip to content

Commit ddf329d

Browse files
committed
[gephi-lite] adding version in keys for local & session storage
1 parent dc14823 commit ddf329d

File tree

16 files changed

+48
-26
lines changed

16 files changed

+48
-26
lines changed

package-lock.json

Lines changed: 14 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/gephi-lite/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"react-tether": "^3.0.3",
9494
"react-use-konami": "^1.1.0",
9595
"seedrandom": "^3.0.5",
96+
"semver": "^6.3.1",
9697
"sigma": "^3.0.0",
9798
"tlds": "^1.260.0"
9899
},
@@ -114,6 +115,7 @@
114115
"@types/react-linkify": "^1.0.4",
115116
"@types/react-slider": "^1.3.6",
116117
"@types/seedrandom": "^3.0.8",
118+
"@types/semver": "^7.7.1",
117119
"@types/tether": "^1.4.9",
118120
"@vitejs/plugin-react-swc": "^3.7.2",
119121
"http-proxy-middleware": "^3.0.3",

packages/gephi-lite/src/config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import { parse } from "semver";
2+
13
import { version } from "../package.json";
24

35
export const config = {
4-
version,
6+
version: parse(version)!,
57
website_url: "https://github.com/gephi/gephi-lite#readme",
68
notificationTimeoutMs: 3000,
79
github_proxy: import.meta.env.VITE_GITHUB_PROXY || "/_github",

packages/gephi-lite/src/core/Initialize.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import useKonami from "react-use-konami";
55

66
import { WelcomeModal } from "../components/modals/WelcomeModal";
77
import { I18n } from "../locales/provider";
8+
import { sessionStorage } from "../utils/storage";
89
import { extractFilename } from "../utils/url";
910
import { appearanceAtom } from "./appearance";
1011
import { useBroadcast } from "./broadcast/useBroadcast";

packages/gephi-lite/src/core/appearance/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { getEmptyAppearanceState, serializeAppearanceState } from "@gephi/gephi-lite-sdk";
22
import { Producer, atom, producerToAction } from "@ouestware/atoms";
33

4+
import { sessionStorage } from "../../utils/storage";
45
import { ItemType } from "../types";
56
import {
67
AppearanceState,

packages/gephi-lite/src/core/broadcast/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const BROADCAST_METHODS: {
3939
return;
4040
},
4141
getVersion: async () => {
42-
return config.version;
42+
return config.version.toString();
4343
},
4444
importGraph: async (data) => {
4545
if (fileAtom.get().status.type === "loading") throw new Error("A file is already being loaded");

packages/gephi-lite/src/core/file/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { write } from "graphology-gexf";
55
import { isEmpty, isEqual } from "lodash";
66

77
import { config } from "../../config";
8+
import { localStorage } from "../../utils/storage";
89
import { appearanceActions, appearanceAtom } from "../appearance";
910
import { applyVisualProperties, inferAppearanceState } from "../appearance/utils";
1011
import { resetStates } from "../context/dataContexts";
@@ -132,7 +133,7 @@ export const exportAsGephiLite = asyncAction(async (callback: (data: string) =>
132133
try {
133134
const data: GephiLiteFileFormat = {
134135
type: "gephi-lite",
135-
version: config.version,
136+
version: config.version.toString(),
136137
graphDataset: graphDatasetAtom.get(),
137138
filters: filtersAtom.get(),
138139
appearance: appearanceAtom.get(),

packages/gephi-lite/src/core/filters/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Producer, atom, producerToAction } from "@ouestware/atoms";
22
import { dropRight, inRange } from "lodash";
33

4+
import { sessionStorage } from "../../utils/storage";
45
import { FilterType, FiltersState } from "./types";
56
import { getEmptyFiltersState, serializeFiltersState } from "./utils";
67

packages/gephi-lite/src/core/graph/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { clamp, forEach, isNil, isString, keyBy, keys, last, map, mapValues, omi
2323
import { Coordinates } from "sigma/types";
2424

2525
import { getPalette } from "../../components/GraphAppearance/color/utils";
26+
import { sessionStorage } from "../../utils/storage";
2627
import { appearanceAtom } from "../appearance";
2728
import { applyVisualProperties, getAllVisualGetters } from "../appearance/utils";
2829
import { useGraphDataset } from "../context/dataContexts";

packages/gephi-lite/src/core/layouts/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { connectedCloseness } from "graphology-metrics/layout-quality";
33
import { debounce, identity, pick } from "lodash";
44
import seedRandom from "seedrandom";
55

6+
import { localStorage } from "../../utils/storage";
67
import { EVENTS, emitter } from "../context/eventsContext";
78
import { graphDatasetActions, graphDatasetAtom, sigmaGraphAtom } from "../graph";
89
import { dataGraphToFullGraph } from "../graph/utils";

0 commit comments

Comments
 (0)