Skip to content

Commit

Permalink
refactor(utils): put in folder
Browse files Browse the repository at this point in the history
  • Loading branch information
moklick committed Oct 6, 2019
1 parent cc2775d commit 3bb6e89
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Plugins/MiniMap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useStoreState } from 'easy-peasy';
import classnames from 'classnames';

import { isFunction } from '../../utils'
import { getNodesInside } from '../../graph-utils';
import { getNodesInside } from '../../utils/graph';

const baseStyle = {
position: 'absolute',
Expand Down
2 changes: 1 addition & 1 deletion src/actions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { action } from 'easy-peasy';
import isEqual from 'fast-deep-equal';

import { getBoundingBox, getNodesInside, getConnectedEdges } from './graph-utils';
import { getBoundingBox, getNodesInside, getConnectedEdges } from './utils/graph';

export default {
setOnConnect: action((state, onConnect) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/NodesSelection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, memo } from 'react';
import ReactDraggable from 'react-draggable';
import { useStoreState, useStoreActions } from 'easy-peasy';

import { isNode } from '../../graph-utils';
import { isNode } from '../../utils/graph';

function getStartPositions(elements) {
return elements
Expand Down
2 changes: 1 addition & 1 deletion src/container/EdgeRenderer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { memo } from 'react';
import { useStoreState } from 'easy-peasy';

import ConnectionLine from '../../components/ConnectionLine';
import { isEdge } from '../../graph-utils';
import { isEdge } from '../../utils/graph';

function getHandlePosition(position, node, handle = null) {
if (!handle) {
Expand Down
2 changes: 1 addition & 1 deletion src/container/GraphView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import useD3Zoom from '../../hooks/useD3Zoom';
import useGlobalKeyHandler from '../../hooks/useGlobalKeyHandler';
import useElementUpdater from '../../hooks/useElementUpdater'
import { getDimensions } from '../../utils';
import { fitView, zoomIn, zoomOut } from '../../graph-utils';
import { fitView, zoomIn, zoomOut } from '../../utils/graph';

const GraphView = memo(({
nodeTypes, edgeTypes, onMove, onLoad,
Expand Down
2 changes: 1 addition & 1 deletion src/container/NodeRenderer/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { memo } from 'react';
import { useStoreState } from 'easy-peasy';

import { isNode } from '../../graph-utils';
import { isNode } from '../../utils/graph';

function renderNode(d, props, state) {
const nodeType = d.type || 'default';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useElementUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect } from 'react';
import { useStoreState, useStoreActions } from 'easy-peasy';
import isEqual from 'fast-deep-equal';

import { parseElement, isNode, isEdge } from '../graph-utils';
import { parseElement, isNode, isEdge } from '../utils/graph';

const useElementUpdater = ({ elements }) => {
const state = useStoreState(s => ({
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useGlobalKeyHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect } from 'react';
import { useStoreState, useStoreActions } from 'easy-peasy';

import useKeyPress from './useKeyPress';
import { isEdge, getConnectedEdges } from '../graph-utils';
import { isEdge, getConnectedEdges } from '../utils/graph';

export default ({ deleteKeyCode, onElementsRemove }) => {
const state = useStoreState(s => ({ selectedElements: s.selectedElements, edges: s.edges }))
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export {
isEdge,
removeElements,
getOutgoers
} from './graph-utils';
} from './utils/graph';
2 changes: 1 addition & 1 deletion src/graph-utils.js → src/utils/graph.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { zoomIdentity } from 'd3-zoom';
import store from './store';
import store from '../store';

export const isEdge = element => element.source && element.target;

Expand Down
File renamed without changes.

0 comments on commit 3bb6e89

Please sign in to comment.