Skip to content

Commit 6942e5c

Browse files
committed
filtering works/ fixed lowering threshold bug
no longer limits higher available values if we traverse down smaller value subtree
1 parent 8d2eae3 commit 6942e5c

File tree

4 files changed

+161
-149
lines changed

4 files changed

+161
-149
lines changed

package-lock.json

Lines changed: 35 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13-
"@emotion/react": "^11.11.4",
14-
"@emotion/styled": "^11.11.5",
15-
"@mui/material": "^5.15.20",
13+
"@emotion/react": "^11.13.0",
14+
"@emotion/styled": "^11.13.0",
15+
"@mui/material": "^5.16.4",
1616
"@mui/system": "^5.15.20",
1717
"@reduxjs/toolkit": "^2.2.6",
1818
"@tanstack/react-table": "^8.17.3",
@@ -24,12 +24,14 @@
2424
"react-dom": "^18.2.0",
2525
"react-redux": "^9.1.2",
2626
"react-router-dom": "^6.23.1",
27+
"react-window": "^1.8.10",
2728
"redux": "^5.0.1"
2829
},
2930
"devDependencies": {
3031
"@types/node": "^20.14.8",
3132
"@types/react": "^18.3.3",
3233
"@types/react-dom": "^18.3.0",
34+
"@types/react-window": "^1.8.8",
3335
"@vitejs/plugin-react": "^4.2.1",
3436
"eslint": "^8.57.0",
3537
"eslint-plugin-react": "^7.34.1",

src/app/routes/Dashboard.tsx

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import React, { useEffect, useState, useMemo } from "react";
12
import { styled } from "@mui/system";
23
import SingleDiamondButton from "../../components/SingleDiamondButton";
34
import NumberBoxes from "../../components/NumberBoxes";
45
import StatsTable from "../../components/StatsTable";
5-
import { useEffect, useState } from "react";
66
import { store } from "../../store";
77
import { getDestinyMembershipId } from "../../features/membership/BungieAccount";
88
import { updateMembership } from "../../store/MembershipReducer";
@@ -13,7 +13,7 @@ import { updateManifest } from "../../lib/bungie_api/Manifest";
1313
import { separateArmor } from "../../features/armor-optimization/separatedArmor";
1414
import { generatePermutations } from "../../features/armor-optimization/generatePermutations";
1515
import { filterPermutations } from "../../features/armor-optimization/filterPermutations";
16-
import { DestinyArmor, ArmorByClass } from "../../types";
16+
import { DestinyArmor, ArmorByClass } from "../../types"; // Corrected import
1717

1818
const Container = styled("div")({
1919
display: "flex",
@@ -27,8 +27,8 @@ const HeaderContainer = styled("div")({
2727
display: "flex",
2828
justifyContent: "center",
2929
alignItems: "center",
30-
marginBottom: "10px", // Further reduced margin to bring items closer
31-
gap: "20px", // Add gap to ensure proper spacing
30+
marginBottom: "10px",
31+
gap: "20px",
3232
});
3333

3434
const ContentContainer = styled("div")({
@@ -37,11 +37,11 @@ const ContentContainer = styled("div")({
3737
justifyContent: "center",
3838
alignItems: "flex-start",
3939
width: "100%",
40-
padding: "10px", // Further reduced padding to bring items closer
40+
padding: "10px",
4141
});
4242

4343
const LeftPane = styled("div")({
44-
marginRight: "10px", // Reduced margin
44+
marginRight: "10px",
4545
});
4646

4747
const RightPane = styled("div")({
@@ -65,30 +65,15 @@ export const Dashboard = () => {
6565

6666
useEffect(() => {
6767
const updateProfile = async () => {
68-
// update / get manifest
6968
await updateManifest();
70-
71-
console.log("Manifest updated");
72-
73-
// store membership details into store
7469
const destinyMembership = await getDestinyMembershipId();
75-
7670
dispatch(updateMembership(destinyMembership));
77-
78-
// store profile armor array into store
7971
const armor = await getProfileArmor();
80-
8172
dispatch(updateProfileArmor(armor));
82-
83-
console.log(store.getState().profile.armor);
8473
const separated = separateArmor(armor);
85-
86-
console.log(separated);
8774
const warlockPermutations = generatePermutations(separated.warlock);
8875
setPermutations(warlockPermutations);
8976
setFilteredPermutations(warlockPermutations);
90-
91-
console.log("Warlock Armor Permutations:", warlockPermutations);
9277
};
9378

9479
updateProfile().catch(console.error);
@@ -98,13 +83,11 @@ export const Dashboard = () => {
9883
if (permutations) {
9984
const filtered = filterPermutations(permutations, selectedValues);
10085
setFilteredPermutations(filtered);
101-
console.log("Filtered permutations:", filtered);
10286
}
10387
}, [selectedValues, permutations]);
10488

10589
const handleThresholdChange = (thresholds: { [key: string]: number }) => {
10690
setSelectedValues(thresholds);
107-
console.log("Selected thresholds:", thresholds);
10891
};
10992

11093
return (
@@ -118,7 +101,11 @@ export const Dashboard = () => {
118101
</LeftPane>
119102
<RightPane>
120103
<h1 style={{ fontSize: "16px" }}>Armour Combinations</h1>
121-
{filteredPermutations ? <StatsTable /> : <p>Loading...</p>}
104+
{filteredPermutations ? (
105+
<StatsTable permutations={filteredPermutations} />
106+
) : (
107+
<p>Loading...</p>
108+
)}
122109
</RightPane>
123110
</ContentContainer>
124111
</Container>

0 commit comments

Comments
 (0)