Skip to content

Commit cbe97ac

Browse files
committed
expander working, statecontainer not working yet
1 parent c1a5f64 commit cbe97ac

File tree

6 files changed

+82
-24
lines changed

6 files changed

+82
-24
lines changed

src/app/components/SwitchApp.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Select from 'react-select';
33
import { useStoreContext } from '../store';
44
import { setTab } from '../actions/actions';
55

6+
67
const SwitchAppDropdown = () => {
78
const [{ currentTab, tabs }, dispatch] = useStoreContext();
89

src/app/containers/ActionContainer.tsx

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ const resetSlider = () => {
1414
}
1515
};
1616

17-
function ActionContainer() {
17+
function ActionContainer(props) {
1818
const [{ tabs, currentTab }, dispatch] = useStoreContext();
1919
const { hierarchy, sliderIndex, viewIndex } = tabs[currentTab];
2020
let actionsArr = [];
2121
const hierarchyArr: any[] = [];
22+
const { seeActionContainer } = props;
2223

2324
// function to traverse state from hiararchy and also getting information on display name and component name
2425
const displayArray = (obj: {
@@ -112,25 +113,36 @@ function ActionContainer() {
112113
}
113114
);
114115

115-
return (
116-
<div className="action-container">
117-
<SwitchAppDropdown />
118-
<div className="action-component exclude">
119-
<button
120-
className="empty-button"
121-
onClick={() => {
122-
dispatch(emptySnapshots());
123-
// set slider back to zero
124-
resetSlider();
125-
}}
126-
type="button"
127-
>
128-
Empty
129-
</button>
116+
if (!seeActionContainer) {
117+
return (
118+
<div></div>
119+
)
120+
}
121+
else {
122+
console.log("ActionContainer can see prop updates");
123+
//this is not logging; the prop is not being udpdated...
124+
return (
125+
<div className="action-container">
126+
<SwitchAppDropdown />
127+
<div className="action-component exclude">
128+
<button
129+
className="empty-button"
130+
onClick={() => {
131+
dispatch(emptySnapshots());
132+
// set slider back to zero
133+
resetSlider();
134+
}}
135+
type="button"
136+
>
137+
Empty
138+
</button>
139+
</div>
140+
<div>{actionsArr}</div>
130141
</div>
131-
<div>{actionsArr}</div>
132-
</div>
133-
);
142+
);
143+
144+
}
145+
134146
}
135147

136148
export default ActionContainer;

src/app/containers/MainContainer.tsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,25 @@ import {
1313
} from '../actions/actions';
1414
import { useStoreContext } from '../store';
1515
import MPID from '../user_id/user_id';
16+
import useForceUpdate from '../components/useForceUpdate'
17+
18+
//logic for toggling on the action container sidebar
19+
let seeActionContainer: boolean = false;
20+
21+
function toggleActionContainer(): void {
22+
seeActionContainer = !seeActionContainer;
23+
const bodyContainer = document.getElementById("bodyContainer");
24+
25+
if (seeActionContainer) {
26+
bodyContainer.classList.remove("body-container1");
27+
bodyContainer.classList.add("body-container2");
28+
}
29+
else {
30+
bodyContainer.classList.remove("body-container2");
31+
bodyContainer.classList.add("body-container1");
32+
}
33+
}
34+
1635

1736
const mixpanel = require('mixpanel').init('12fa2800ccbf44a5c36c37bc9776e4c0', {
1837
debug: false,
@@ -177,11 +196,12 @@ function MainContainer(): any {
177196
const hierarchyDisplay = statelessCleaning(hierarchy);
178197
return (
179198
<div className="main-container">
180-
<HeadContainer />
181-
<div className="body-container">
182-
<ActionContainer />
199+
{/* <HeadContainer /> */}
200+
<div id="bodyContainer" className="body-container1">
201+
<ActionContainer seeActionContainer={seeActionContainer}/>
183202
{snapshots.length ? (
184203
<StateContainer
204+
toggleActionContainer={toggleActionContainer}
185205
viewIndex={viewIndex}
186206
snapshot={snapshotDisplay}
187207
hierarchy={hierarchyDisplay}

src/app/containers/StateContainer.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,17 @@ interface StateContainerProps {
2323
atomsComponents?: object;
2424
}
2525
>;
26+
toggleActionContainer?: any;
2627
AtomsRelationship?: any[];
2728
hierarchy: Record<string, unknown>;
2829
snapshots: [];
2930
viewIndex: number;
31+
3032
}
3133

3234
// eslint-disable-next-line react/prop-types
3335
const StateContainer = (props: StateContainerProps): JSX.Element => {
34-
const { snapshot, hierarchy, snapshots, viewIndex } = props;
36+
const { snapshot, hierarchy, snapshots, viewIndex, toggleActionContainer } = props;
3537
const [Text, setText] = useState('State');
3638

3739
return (
@@ -40,6 +42,7 @@ const StateContainer = (props: StateContainerProps): JSX.Element => {
4042
<div className="main-navbar-container">
4143
<div className="main-navbar-text">{Text}</div>
4244
<div className="main-navbar">
45+
<button className="toggleAC" onClick={()=> toggleActionContainer()}>View ActionContainer</button>
4346
<NavLink
4447
className="main-router-link"
4548
activeClassName="is-active"

src/app/styles/layout/_bodyContainer.scss

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
.body-container {
1+
.body-container1 {
2+
height: 94%;
3+
overflow: hidden;
4+
display: grid;
5+
grid-template-columns: 1fr 2fr;
6+
grid-template-rows: 8fr 1fr;
7+
grid-template-areas:
8+
'states states'
9+
'travel travel'
10+
'buttons buttons';
11+
}
12+
13+
.body-container2 {
214
height: 94%;
315
overflow: hidden;
416
display: grid;
@@ -10,6 +22,8 @@
1022
'buttons buttons';
1123
}
1224

25+
26+
1327
/* if extension width is less than 500px, stack the body containers */
1428
@media (max-width: 500px) {
1529
.body-container {

src/app/styles/layout/_stateContainer.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
overflow: hidden;
1010
}
1111

12+
.toggleAC {
13+
color: $background-color;
14+
background: $blue-brand;
15+
border-radius: 5px;
16+
border: 1px solid rgba(184, 196, 194, 0.25);
17+
height: 75%;
18+
}
19+
1220
.state-container .navbar {
1321
background-color: $background-color;
1422
display: flex;

0 commit comments

Comments
 (0)