diff --git a/src/app/routes/Dashboard.tsx b/src/app/routes/Dashboard.tsx index 5b37776..84ca82a 100644 --- a/src/app/routes/Dashboard.tsx +++ b/src/app/routes/Dashboard.tsx @@ -1,9 +1,7 @@ import React, { useEffect, useState, useMemo } from 'react'; import { styled } from '@mui/system'; import SingleDiamondButton from '../../components/SingleDiamondButton'; -import NumberBoxes from '../../components/NumberBoxes'; -import StatsTable from '../../components/StatsTable'; -import { store } from '../../store'; +import NumberBoxes from '../../features/armor-optimization/NumberBoxes'; import { getDestinyMembershipId } from '../../features/membership/BungieAccount'; import { updateMembership } from '../../store/MembershipReducer'; import { getProfileArmor } from '../../features/profile/DestinyProfile'; @@ -13,7 +11,8 @@ import { updateManifest } from '../../lib/bungie_api/Manifest'; import { separateArmor } from '../../features/armor-optimization/separatedArmor'; import { generatePermutations } from '../../features/armor-optimization/generatePermutations'; import { filterPermutations } from '../../features/armor-optimization/filterPermutations'; -import { DestinyArmor, ArmorByClass } from '../../types'; // Corrected import +import { DestinyArmor, ArmorByClass } from '../../types'; +import StatsTable from '../../features/armor-optimization/StatsTable'; const Container = styled('div')({ display: 'flex', diff --git a/src/components/NumberBoxes.tsx b/src/features/armor-optimization/NumberBoxes.tsx similarity index 100% rename from src/components/NumberBoxes.tsx rename to src/features/armor-optimization/NumberBoxes.tsx diff --git a/src/components/StatsTable.tsx b/src/features/armor-optimization/StatsTable.tsx similarity index 69% rename from src/components/StatsTable.tsx rename to src/features/armor-optimization/StatsTable.tsx index e30dd85..2bc013d 100644 --- a/src/components/StatsTable.tsx +++ b/src/features/armor-optimization/StatsTable.tsx @@ -1,11 +1,11 @@ -import React, { useMemo, useState } from "react"; +import React, { useMemo, useState } from 'react'; import { createColumnHelper, flexRender, getCoreRowModel, useReactTable, -} from "@tanstack/react-table"; -import { DestinyArmor } from "../types"; +} from '@tanstack/react-table'; +import { DestinyArmor } from '../../types'; const columnHelper = createColumnHelper<{ type: string; @@ -18,33 +18,33 @@ const columnHelper = createColumnHelper<{ }>(); const columns: any = [ - columnHelper.accessor("type", { + columnHelper.accessor('type', { cell: (info) => info.getValue(), - header: "Type", + header: 'Type', }), - columnHelper.accessor("mobility", { + columnHelper.accessor('mobility', { cell: (info) => info.getValue(), - header: "Mobility", + header: 'Mobility', }), - columnHelper.accessor("resilience", { + columnHelper.accessor('resilience', { cell: (info) => info.getValue(), - header: "Resilience", + header: 'Resilience', }), - columnHelper.accessor("recovery", { + columnHelper.accessor('recovery', { cell: (info) => info.getValue(), - header: "Recovery", + header: 'Recovery', }), - columnHelper.accessor("discipline", { + columnHelper.accessor('discipline', { cell: (info) => info.getValue(), - header: "Discipline", + header: 'Discipline', }), - columnHelper.accessor("intellect", { + columnHelper.accessor('intellect', { cell: (info) => info.getValue(), - header: "Intellect", + header: 'Intellect', }), - columnHelper.accessor("strength", { + columnHelper.accessor('strength', { cell: (info) => info.getValue(), - header: "Strength", + header: 'Strength', }), ]; @@ -83,41 +83,35 @@ const StatsTable: React.FC = ({ permutations }) => { }); return ( -
-
+
+
{table.getHeaderGroups().map((headerGroup) => headerGroup.headers.map((header) => (
{header.isPlaceholder ? null - : flexRender( - header.column.columnDef.header, - header.getContext() - )} + : flexRender(header.column.columnDef.header, header.getContext())}
)) )}
{table.getRowModel().rows.map((row) => ( -
+
{row.getVisibleCells().map((cell) => (
@@ -129,9 +123,9 @@ const StatsTable: React.FC = ({ permutations }) => {