11import { css } from 'emotion'
2- import { FunctionComponent , createElement , Fragment , useState } from 'react'
2+ import { Fragment , FunctionComponent , createElement , useState } from 'react'
3+ import { FaChevronDown , FaChevronUp } from 'react-icons/fa'
34
45import { useOvermind } from '../../overmind'
56import { Chart , NestedChart } from '../../overmind/types'
67import { nameToColor } from '../../overmind/utils'
78import * as textStyles from '../../styles/text'
89import * as styles from './styles'
9- import { FaChevronDown , FaChevronUp } from 'react-icons/fa'
1010
1111type Props = {
1212 chart : Chart
@@ -23,6 +23,8 @@ const ChartComponent: FunctionComponent<Props> = ({
2323} ) => {
2424 const [ expandedIds , setExpandedIds ] = useState ( [ ] )
2525 const { state, actions } = useOvermind ( )
26+
27+ const delimiter = state . currentApp . delimiter
2628
2729 return (
2830< div className = { styles . outerWrapper } >
@@ -32,7 +34,7 @@ const ChartComponent: FunctionComponent<Props> = ({
3234 return chart . states . reduce ( ( aggr , state ) => {
3335 if ( aggr ) return true
3436
35- return state . join ( '.' ) . startsWith ( statePath . concat ( chartId , key ) . join ( '.' ) )
37+ return state . join ( delimiter ) . startsWith ( statePath . concat ( chartId , key ) . join ( delimiter ) )
3638 } , false )
3739 } )
3840
@@ -47,7 +49,7 @@ const ChartComponent: FunctionComponent<Props> = ({
4749 const isActiveState = chart . states . reduce ( ( aggr , state ) => {
4850 if ( aggr ) return true
4951
50- return state . join ( '.' ) . startsWith ( statePath . concat ( chartId , key ) . join ( '.' ) )
52+ return state . join ( delimiter ) . startsWith ( statePath . concat ( chartId , key ) . join ( delimiter ) )
5153 } , false )
5254
5355 return (
@@ -57,7 +59,7 @@ const ChartComponent: FunctionComponent<Props> = ({
5759 className = { styles . stateName }
5860 style = { {
5961 backgroundColor : isActiveState
60- ? nameToColor ( chart . path . join ( '.' ) )
62+ ? nameToColor ( chart . path . join ( delimiter ) )
6163 : null ,
6264 } }
6365 >
@@ -69,7 +71,7 @@ const ChartComponent: FunctionComponent<Props> = ({
6971 className = { styles . selectedLine }
7072 style = { {
7173 backgroundColor : isActiveState
72- ? nameToColor ( chart . path . join ( '.' ) )
74+ ? nameToColor ( chart . path . join ( delimiter ) )
7375 : null ,
7476 } }
7577 />
@@ -80,7 +82,7 @@ const ChartComponent: FunctionComponent<Props> = ({
8082 className = { styles . stateAction }
8183 style = { {
8284 borderColor : isActiveState
83- ? nameToColor ( chart . path . join ( '.' ) )
85+ ? nameToColor ( chart . path . join ( delimiter ) )
8486 : null ,
8587 } }
8688 >
@@ -95,7 +97,7 @@ const ChartComponent: FunctionComponent<Props> = ({
9597 className = { styles . selectedLine }
9698 style = { {
9799 backgroundColor : isActiveState
98- ? nameToColor ( chart . path . join ( '.' ) )
100+ ? nameToColor ( chart . path . join ( delimiter ) )
99101 : null ,
100102 } }
101103 />
@@ -106,7 +108,7 @@ const ChartComponent: FunctionComponent<Props> = ({
106108 className = { styles . selectedLine }
107109 style = { {
108110 backgroundColor : isActiveState
109- ? nameToColor ( chart . path . join ( '.' ) )
111+ ? nameToColor ( chart . path . join ( delimiter ) )
110112 : null ,
111113 } }
112114 />
@@ -115,7 +117,7 @@ const ChartComponent: FunctionComponent<Props> = ({
115117 className = { styles . onCell }
116118 style = { {
117119 borderColor : isActiveState
118- ? nameToColor ( chart . path . join ( '.' ) )
120+ ? nameToColor ( chart . path . join ( delimiter ) )
119121 : null ,
120122 } }
121123 >
@@ -139,15 +141,15 @@ const ChartComponent: FunctionComponent<Props> = ({
139141 chart . actions [ onKey ]
140142 ? ( ) =>
141143 actions . selectQueryAction (
142- chart . path . concat ( onKey ) . join ( '.' )
144+ chart . path . concat ( onKey ) . join ( delimiter )
143145 )
144146 : null
145147 }
146148 className = { css (
147149 styles . stateNameCell ,
148150 styles . onName ,
149151 chart . actions [ onKey ] && styles . activeAction ,
150- chart . path . concat ( onKey ) . join ( '.' ) ===
152+ chart . path . concat ( onKey ) . join ( delimiter ) ===
151153 state . currentApp . selectedActionQuery &&
152154 styles . selectedAction
153155 ) }
@@ -184,7 +186,7 @@ const ChartComponent: FunctionComponent<Props> = ({
184186 className = { styles . selectedLine }
185187 style = { {
186188 backgroundColor : isActiveState
187- ? nameToColor ( chart . path . join ( '.' ) )
189+ ? nameToColor ( chart . path . join ( delimiter ) )
188190 : null ,
189191 } }
190192 />
@@ -198,7 +200,7 @@ const ChartComponent: FunctionComponent<Props> = ({
198200 className = { styles . stateAction }
199201 style = { {
200202 borderColor : isActiveState
201- ? nameToColor ( chart . path . join ( '.' ) )
203+ ? nameToColor ( chart . path . join ( delimiter ) )
202204 : null ,
203205 } }
204206 >
0 commit comments