Skip to content

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

toggle search input

AykutSarac7282bfd2af59
diff --git a/src/constants/data.ts b/src/constants/data.ts
index 71accf74..849f46a1 100644
--- a/src/constants/data.ts
+++ b/src/constants/data.ts
@@ -38,6 +38,7 @@ export const defaultConfig: StorageConfig = {
expand: true,
autoformat: true,
hideEditor: false,
+ showSearch: false,
zoomScale: 0.8,
transform: 0,
searchNode: "",
diff --git a/src/reducer/reducer.ts b/src/reducer/reducer.ts
index 89ee146b..0e9a172b 100644
--- a/src/reducer/reducer.ts
+++ b/src/reducer/reducer.ts
@@ -8,6 +8,7 @@ export enum ConfigActionType {
TOGGLE_EXPAND,
TOGGLE_AUTOFORMAT,
TOGGLE_DOCK,
+ TOGGLE_SEARCH,
ZOOM_IN,
ZOOM_OUT,
CENTER_VIEW,
@@ -28,6 +29,16 @@ export const useConfigReducer: React.Reducer<AppConfig, ReducerAction> = (
case ConfigActionType.SET_CONFIG:
return { ...state, settings: action.payload };
+ case ConfigActionType.TOGGLE_SEARCH:
+ return {
+ ...state,
+ settings: {
+ ...state.settings,
+ showSearch: !state.settings.showSearch,
+ ...(state.settings.showSearch && { searchNode: "" }),
+ },
+ };
+
case ConfigActionType.SET_SEARCH_NODE:
return {
...state,
diff --git a/src/typings/global.ts b/src/typings/global.ts
index 4ab7f84e..bb88d493 100644
--- a/src/typings/global.ts
+++ b/src/typings/global.ts
@@ -5,6 +5,7 @@ export interface StorageConfig {
expand: boolean;
autoformat: boolean;
hideEditor: boolean;
+ showSearch: boolean;
zoomScale: number;
transform: number;
searchNode: string;