From 826c405d4b15edd8f4e68d6ea94487795bf756a6 Mon Sep 17 00:00:00 2001 From: Calli Date: Mon, 3 Jul 2023 22:28:22 +0300 Subject: [PATCH] change compat mode to change the grid --- src/app/components/Account/AccountCard.tsx | 6 ++++- src/app/components/MainGrid.tsx | 27 ++++++++++------------ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/app/components/Account/AccountCard.tsx b/src/app/components/Account/AccountCard.tsx index 54733cf..f7786b6 100644 --- a/src/app/components/Account/AccountCard.tsx +++ b/src/app/components/Account/AccountCard.tsx @@ -2,6 +2,8 @@ import { AccessToken } from "@/types"; import { Box, Stack, Typography } from "@mui/material"; import { CharacterRow } from "../Characters/CharacterRow"; import { PlanetaryInteractionRow } from "../PlanetaryInteraction/PlanetaryInteractionRow"; +import { useContext } from "react"; +import { SessionContext } from "@/app/context/Context"; export const AccountCard = ({ characters, @@ -10,11 +12,13 @@ export const AccountCard = ({ characters: AccessToken[]; sessionReady: boolean; }) => { + const { compactMode } = useContext(SessionContext); return ( diff --git a/src/app/components/MainGrid.tsx b/src/app/components/MainGrid.tsx index 9e7fcab..ec4cf56 100644 --- a/src/app/components/MainGrid.tsx +++ b/src/app/components/MainGrid.tsx @@ -1,4 +1,4 @@ -import { useContext, useEffect, useState } from "react"; +import { useContext, useEffect } from "react"; import { Box, CssBaseline, @@ -23,7 +23,6 @@ const darkTheme = createTheme({ export const MainGrid = ({ sessionReady }: { sessionReady: boolean }) => { const { characters } = useContext(CharacterContext); - const { compactMode } = useContext(SessionContext); const groupByAccount = characters.reduce((group, character) => { const { account } = character; group[account ?? ""] = group[account ?? ""] ?? []; @@ -31,25 +30,23 @@ export const MainGrid = ({ sessionReady }: { sessionReady: boolean }) => { return group; }, {}); + const { compactMode } = useContext(SessionContext); + return ( - - {Object.values(groupByAccount).map((g, id) => ( - - ))} - + {Object.values(groupByAccount).map((g, id) => ( + + + + ))}