Skip to content

Commit 52d1b97

Browse files
committed
adjusted positioning of bar graph and ax tree
1 parent 7b8b70c commit 52d1b97

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

src/app/components/StateRoute/AxMap/Ax.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import { toggleExpanded, setCurrentTabInApp } from '../../../slices/mainSlice';
1313

1414
const defaultMargin = {
1515
top: 30,
16-
left: 30,
17-
right: 55,
18-
bottom: 70,
16+
left: 20,
17+
right: 50,
18+
bottom: 20,
1919
};
2020

2121
const nodeCoords: object = {};

src/app/components/StateRoute/PerformanceVisx/BarGraph.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const BarGraph = (props: BarGraphProps): JSX.Element => {
111111
// setting max dimensions and scale ranges
112112
const xMax = width - margin.left - margin.right;
113113
snapshotIdScale.rangeRound([0, xMax]);
114-
const yMax = height - margin.top - 150;
114+
const yMax = height - margin.top - 100;
115115
renderingScale.range([yMax, 0]);
116116

117117
const toStorage = {

src/app/containers/MainContainer.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,17 @@ function MainContainer(): JSX.Element {
4646
}) => {
4747
let maxTab: number;
4848

49+
// Add validation check
4950
if (!sourceTab && action !== 'keepAlive') {
50-
// if the sourceTab doesn't exist or is 0 and it is not a 'keepAlive' action
51-
const tabsArray: Array<string> = Object.keys(payload); // we create a tabsArray of strings composed of keys from our payload object
52-
const numTabsArray: number[] = tabsArray.map((tab) => Number(tab)); // we then map out our tabsArray where we convert each string into a number
53-
54-
maxTab = Math.max(...numTabsArray); // we then get the largest tab number value
51+
// Ensure payload exists and is an object
52+
if (payload && typeof payload === 'object') {
53+
const tabsArray = Object.keys(payload);
54+
const numTabsArray = tabsArray.map((tab) => Number(tab));
55+
maxTab = numTabsArray.length > 0 ? Math.max(...numTabsArray) : 0;
56+
} else {
57+
console.warn('Invalid payload received:', payload);
58+
maxTab = 0;
59+
}
5560
}
5661

5762
switch (action) {
@@ -73,7 +78,6 @@ function MainContainer(): JSX.Element {
7378
}
7479
case 'sendSnapshots': {
7580
dispatch(setTab(payload));
76-
// set state with the information received from the background script
7781
dispatch(addNewSnapshots(payload));
7882
break;
7983
}

0 commit comments

Comments
 (0)