From 61770ea7174f97cf9d4e4162216a13461d716e25 Mon Sep 17 00:00:00 2001 From: Snarling <84951833+Snarling@users.noreply.github.com> Date: Mon, 18 Oct 2021 03:14:33 -0400 Subject: [PATCH] Character Overview Overhaul * Moved hardcoded styles from the hardcoded container div into a class, and assigned that class to a Mui component. * Otherwise removed excess layered components * Visibility toggle area no longer occupies the whole width of the overview area. This was blocking input near the top right (noticeable in corp). --- src/ui/React/CharacterOverview.tsx | 289 ++++++++++++++--------------- src/ui/React/Overview.tsx | 37 ++-- 2 files changed, 160 insertions(+), 166 deletions(-) diff --git a/src/ui/React/CharacterOverview.tsx b/src/ui/React/CharacterOverview.tsx index 94e6204b0..7ac51d71c 100644 --- a/src/ui/React/CharacterOverview.tsx +++ b/src/ui/React/CharacterOverview.tsx @@ -8,11 +8,8 @@ import { numeralWrapper } from "../../ui/numeralFormat"; import { Reputation } from "./Reputation"; import Table from "@mui/material/Table"; -import TableBody from "@mui/material/TableBody"; import TableCell from "@mui/material/TableCell"; import TableRow from "@mui/material/TableRow"; -import Paper from "@mui/material/Paper"; -import Box from "@mui/material/Box"; import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; import IconButton from "@mui/material/IconButton"; @@ -150,162 +147,150 @@ export function CharacterOverview({ save }: IProps): React.ReactElement { const classes = useStyles(); return ( - - - - - - - HP  - - - - {numeralWrapper.formatHp(player.hp)} / {numeralWrapper.formatHp(player.max_hp)} - - - - - {/*Hook for player scripts*/} - - - +
+ + + HP  + + + + {numeralWrapper.formatHp(player.hp)} / {numeralWrapper.formatHp(player.max_hp)} + + + + + {/*Hook for player scripts*/} + + + - - - Money  - - - - {numeralWrapper.formatMoney(player.money.toNumber())} - - - - - {/*Hook for player scripts*/} - - - + + + Money  + + + + {numeralWrapper.formatMoney(player.money.toNumber())} + + + + + {/*Hook for player scripts*/} + + + - - - Hack  - - - - {numeralWrapper.formatSkill(player.hacking_skill)} - - - - - {/*Hook for player scripts*/} - - - + + + Hack  + + + {numeralWrapper.formatSkill(player.hacking_skill)} + + + + {/*Hook for player scripts*/} + + + - - - Str  - - - - {numeralWrapper.formatSkill(player.strength)} - - - - - {/*Hook for player scripts*/} - - - + + + Str  + + + {numeralWrapper.formatSkill(player.strength)} + + + + {/*Hook for player scripts*/} + + + - - - Def  - - - {numeralWrapper.formatSkill(player.defense)} - - - - {/*Hook for player scripts*/} - - - + + + Def  + + + {numeralWrapper.formatSkill(player.defense)} + + + + {/*Hook for player scripts*/} + + + - - - Dex  - - - - {numeralWrapper.formatSkill(player.dexterity)} - - - - - {/*Hook for player scripts*/} - - - - - - Agi  - - - {numeralWrapper.formatSkill(player.agility)} - - - - {/*Hook for player scripts*/} - - - + + + Dex  + + + {numeralWrapper.formatSkill(player.dexterity)} + + + + {/*Hook for player scripts*/} + + + + + + Agi  + + + {numeralWrapper.formatSkill(player.agility)} + + + + {/*Hook for player scripts*/} + + + - - - Cha  - - - {numeralWrapper.formatSkill(player.charisma)} - - - - {/*Hook for player scripts*/} - - - - + + + Cha  + + + {numeralWrapper.formatSkill(player.charisma)} + + + + {/*Hook for player scripts*/} + + + + - - - - {/*Hook for player scripts*/} - - - - - {/*Hook for player scripts*/} - - - - - {/*Hook for player scripts*/} - - - - - + + + + {/*Hook for player scripts*/} + + + + + {/*Hook for player scripts*/} + + + + + {/*Hook for player scripts*/} + + + + + - - - - - - - - -
-
-
+ + + + + + + + ); } diff --git a/src/ui/React/Overview.tsx b/src/ui/React/Overview.tsx index 3b0dc71bb..e3c44b407 100644 --- a/src/ui/React/Overview.tsx +++ b/src/ui/React/Overview.tsx @@ -1,17 +1,29 @@ import React, { useState } from "react"; import makeStyles from "@mui/styles/makeStyles"; -import Box from "@mui/material/Box"; import Collapse from "@mui/material/Collapse"; import Fab from "@mui/material/Fab"; +import Paper from "@mui/material/Paper"; import VisibilityOffIcon from "@mui/icons-material/VisibilityOff"; import VisibilityIcon from "@mui/icons-material/Visibility"; import { use } from "../Context"; import { Page } from "../Router"; const useStyles = makeStyles({ - nobackground: { - backgroundColor: "#0000", + visibilityToggle: { + backgroundColor: "transparent", + position: "absolute", + top: "100%", + right: 0, + }, + overviewContainer: { + position: "fixed", + top: 0, + right: 0, + zIndex: 1500, + display: "flex", + justifyContent: "flex-end", + flexDirection: "column", }, }); @@ -30,16 +42,13 @@ export function Overview({ children }: IProps): React.ReactElement { } else { icon = ; } + return ( -
- - {children} - - setOpen((old) => !old)}> - {icon} - - - -
+ + {children} + setOpen((old) => !old)}> + {icon} + + ); -} +} \ No newline at end of file