From dd774b439d03f271ea03f252eff99725e4cfec16 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Thu, 12 Jan 2023 15:38:23 -0800 Subject: [PATCH] add stats box --- src/components/Hero.jsx | 12 ++++++++- src/components/Panels.jsx | 56 +++++++++++++++++++++++++++++++++++++++ src/styles/hero.css | 31 +++++++++++++++++++++- 3 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 src/components/Panels.jsx diff --git a/src/components/Hero.jsx b/src/components/Hero.jsx index f901bc1..76620d7 100644 --- a/src/components/Hero.jsx +++ b/src/components/Hero.jsx @@ -1,12 +1,13 @@ import React, { useEffect, useState } from 'react'; - import { ethers, BigNumber } from 'ethers'; import { useAccount, useContractReads, useContractRead, usePrepareContractWrite, useContractWrite, useWaitForTransaction, erc721ABI } from 'wagmi'; import { NotificationContainer, NotificationManager } from 'react-notifications'; import debounce from 'lodash'; +import { StatsPanel } from './Panels'; import MainABI from '../abi/main.json'; import '../styles/hero.css'; +import 'react-notifications/lib/notifications.css'; import Unaboomer from '../img/unaboomer.png'; import Mailbomb from '../img/mailbomb.png'; import Explosion from '../img/explosion.png'; @@ -226,6 +227,7 @@ export function Hero(props) { return (
+

the web3 revolution & its consequences have been a disaster for the human race.

Technology is advancing at an exponential rate and boomers are being left behind. A.I., Bitcoin, @@ -347,6 +349,14 @@ export function Hero(props) { )}

+ ) } diff --git a/src/components/Panels.jsx b/src/components/Panels.jsx new file mode 100644 index 0000000..0902ef5 --- /dev/null +++ b/src/components/Panels.jsx @@ -0,0 +1,56 @@ +import React from 'react'; + +import Unaboomer from '../img/unaboomer.png'; + +export class StatsPanel extends React.Component { + constructor(props) { + super(props); + this.state = {showStats: false} + } + + shorten(s) { + return s.slice(0, 6) + '...' + s.slice(-4) + } + + render() { + return ( + <> +
+ {this.state.showStats && ( +
+ +

+ Kill Leader:
+ {this.props.leaderKillCount > 0 && ( + + {this.shorten(this.props.leaderAddress)} + + ) || "?"} + +

+ {this.props.leaderKillCount > 0 && ( +

+ {this.props.leaderKillCount} kills +

+ )} + +
+

+ Active Unaboomers: {this.props.unaboomersRadicalized - this.props.unaboomersKilled}
+ Dead Unaboomers: {this.props.unaboomersKilled}
+ Active Bombs: {this.props.bombsAssembled - this.props.bombsExploded}
+ Exploded Bombs: {this.props.bombsExploded}
+ Dud Bombs: {this.props.bombsExploded - this.props.unaboomersKilled}
+

+
+ )} + +
+ + ) + } +} \ No newline at end of file diff --git a/src/styles/hero.css b/src/styles/hero.css index 1b633c6..4328f66 100644 --- a/src/styles/hero.css +++ b/src/styles/hero.css @@ -58,10 +58,39 @@ button.doThing:disabled { display: flex; flex-direction: row; flex-wrap: wrap; - /* justify-content: center; */ } .ownedToken { height: 100%; flex: 0 10%; +} + +.nopad { + padding: 0; + margin: 0; +} + +.nopad a { + color: #ff00ea; +} + +.m2 { + margin: 10px; +} +#statsbox { + position: fixed; + bottom: 0; + left: 0; + background-color: #231f20; + text-align: left; + width: 30%; + margin: 0; + max-height: 400px; + overflow-y: auto; + word-wrap: break-word; + display: flex; + flex-direction: column; + min-width: 300px; + border-right: 4px solid #f9f9f9; + border-top: 4px solid #f9f9f9; } \ No newline at end of file