Skip to content

Commit

Permalink
Show the map name in the map performance metrics dialog.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 6ba3e6973e184dbc6c80813f24a1078f8f0ac97f
  • Loading branch information
cpojer committed Nov 5, 2024
1 parent 3de67d1 commit 58876b4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hera/GameMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1738,6 +1738,7 @@ export default class GameMap extends Component<Props, State> {
editor,
fogStyle,
gameId,
mapName,
margin,
playerAchievement,
scale,
Expand Down Expand Up @@ -2000,6 +2001,7 @@ export default class GameMap extends Component<Props, State> {
<MapPerformanceMetrics
key="performance-metrics"
map={map}
mapName={mapName}
player={currentViewer}
playerAchievement={playerAchievement}
scrollIntoView={this._scrollIntoView}
Expand Down
1 change: 1 addition & 0 deletions hera/editor/MapEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,7 @@ export default function MapEditor({
key="play-test-map"
lastActionResponse={game?.lastAction || undefined}
map={game?.state || map}
mapName={mapName}
mutateAction={
actAsEveryPlayer ? ActionResponseMutator.actAsEveryPlayer : undefined
}
Expand Down
12 changes: 12 additions & 0 deletions hera/ui/MapPerformanceMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import UnknownTypeError from '@deities/hephaestus/UnknownTypeError.tsx';
import Box from '@deities/ui/Box.tsx';
import Breakpoints from '@deities/ui/Breakpoints.tsx';
import { applyVar, CSSVariables } from '@deities/ui/cssVar.tsx';
import getColor from '@deities/ui/getColor.tsx';
import Icon from '@deities/ui/Icon.tsx';
import InlineLink from '@deities/ui/InlineLink.tsx';
import getTagColor from '@deities/ui/lib/getTagColor.tsx';
import pixelBorder from '@deities/ui/pixelBorder.tsx';
import Portal from '@deities/ui/Portal.tsx';
import Stack from '@deities/ui/Stack.tsx';
Expand All @@ -23,6 +25,7 @@ import Close from '@iconify-icons/pixelarticons/close.js';
import { AnimatePresence, motion } from 'framer-motion';
import { ReactNode, useCallback, useEffect, useMemo, useState } from 'react';
import usePerformanceResult from '../hooks/usePerformanceResult.tsx';
import getMapName from '../i18n/getMapName.tsx';
import getTranslatedPerformanceStyleTypeName from '../lib/getTranslatedPerformanceStyleTypeName.tsx';
import getTranslatedPerformanceTypeName from '../lib/getTranslatedPerformanceTypeName.tsx';
import { PlayerAchievement } from '../Types.tsx';
Expand Down Expand Up @@ -247,11 +250,13 @@ const SummaryCard = ({

export default function MapPerformanceMetrics({
map,
mapName,
player,
playerAchievement,
scrollIntoView,
}: {
map: MapData;
mapName: string | undefined;
player: PlayerID;
playerAchievement: PlayerAchievement | null;
scrollIntoView: (vectors: ReadonlyArray<Vector>) => void;
Expand Down Expand Up @@ -333,6 +338,13 @@ export default function MapPerformanceMetrics({
}}
>
<Box className={cx(fullStyle, mapPerformanceStyle)} vertical>
{mapName && (
<Stack center>
<h2 style={{ color: getColor(getTagColor(mapName)) }}>
{getMapName(mapName)}
</h2>
</Stack>
)}
{hide ? (
<>
<Stack alignCenter center className={fadeStyle}>
Expand Down

0 comments on commit 58876b4

Please sign in to comment.