Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions client/src/app/GameWindowPanes/EnergyDexPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Planet, PlanetResource } from '../../_types/global/GlobalTypes';
import UIEmitter, { UIEmitterEvent } from '../../utils/UIEmitter';
import { Sub, Space } from '../../components/Text';
import {
getPlayerShortHash,
getPlanetShortHash,
formatNumber,
getPlanetRank,
Expand All @@ -20,6 +21,9 @@ import dfstyles from '../../styles/dfstyles.bs.js';
import { getPlanetName, getPlanetCosmetic } from '../../utils/ProcgenUtils';
import { SelectedContext } from '../GameWindow';
import { SilverIcon, RankIcon } from '../Icons';
import {
emptyAddress,
} from '../../utils/CheckedTypeUtils';

const DexWrapper = styled.div`
height: 12.2em; // exact size so a row is cut off
Expand Down Expand Up @@ -48,26 +52,31 @@ const DexRow = styled.div`
&:nth-child(2) {
margin-right: 0.5em;
}
// planet name
// player owner
&:nth-child(3) {
// short hash
margin-right: 0.5em;
}
// planet name
&:nth-child(4) {
flex-grow: 1;
}
// planet level
&:nth-child(4) {
&:nth-child(5) {
width: 3em;
text-align: center;
}
// rank
&:nth-child(5) {
&:nth-child(6) {
width: 3em;
text-align: center;
}
// energy
&:nth-child(6) {
&:nth-child(7) {
width: 6.5em;
}
// silver
&:nth-child(7) {
&:nth-child(8) {
width: 6.5em;
}
}
Expand Down Expand Up @@ -247,8 +256,14 @@ export function EnergyDexPane({ hook }: { hook: ModalHook; }): JSX.Element {

for (const [i, planet] of planets.sort(levelSort).entries()) {

let owner = ' ';
if (planet.owner !== emptyAddress) {
owner = getPlayerShortHash(planet.owner);
};

dexes.push(<DexEntry
key={i}
owner={owner}
planet={planet}
className={
selected?.locationId === planet.locationId ? 'selected' : ''
Expand Down Expand Up @@ -293,6 +308,9 @@ export function EnergyDexPane({ hook }: { hook: ModalHook; }): JSX.Element {
<span>
<Space length={5} />
</span>{' '}
<span>
Owner
</span>
<span>
Planet Name
</span>
Expand Down
10 changes: 8 additions & 2 deletions client/src/app/GameWindowPanes/PlanetDexPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const DexRow = styled.div`
height: 30px; // 5 + 3 * 7 + 4px

& > span {
// planet ranking
&:nth-child(1) {
width: 2em;
}
Expand All @@ -57,10 +58,12 @@ const DexRow = styled.div`
width: 3em;
position: relative; // for planetcircle
}
// planet owner
&:nth-child(3) {
// short hash
margin-right: 0.5em;
}
// planet name
&:nth-child(4) {
flex-grow: 1;
}
Expand All @@ -69,7 +72,7 @@ const DexRow = styled.div`
width: 3em;
text-align: center;
}
// rank
// planet rank
&:nth-child(6) {
width: 3em;
text-align: center;
Expand Down Expand Up @@ -517,7 +520,10 @@ export function PlanetDexPane({ hook }: { hook: ModalHook; }): JSX.Element {
</ButtonRow>
<DexWrapper>
<DexRow className='title-row'>
<span>#</span>
<span
className={sortBy === Columns.Points ? 'selected' : ''}
onClick={() => setSortBy(Columns.Points)}
>#</span>
<span></span> {/* empty icon cell */}
<span>
<Space length={5} />
Expand Down