Skip to content

Commit

Permalink
Fix broken admin medals panel (#5764)
Browse files Browse the repository at this point in the history
# About the pull request

This PR is a follow up to #5493 fixing the Medals Panel. Some reason
Fragment is busted if you don't use a key?

# Explain why it's good for the game

Fixes 

![image](https://github.com/cmss13-devs/cmss13/assets/76988376/c811b7ef-c9b5-45e3-b95b-bad416e8ab7a)

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>


![image](https://github.com/cmss13-devs/cmss13/assets/76988376/41a05979-eda5-4a1f-ae7d-1f8ddaf50129)

</details>


# Changelog
:cl: Drathek
ui: Fix broken admin Medals Panel
/:cl:

fixes #5768
  • Loading branch information
Drulikar authored Feb 21, 2024
1 parent 1112b02 commit fb55417
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions tgui/packages/tgui/interfaces/MedalsPanel.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { useBackend, useLocalState } from '../backend';
import { Tabs, Section, Button, Fragment, Stack, Flex } from '../components';
import { Tabs, Section, Button, Stack, Flex } from '../components';
import { Window } from '../layouts';

const PAGES = [
{
title: 'USCM',
component: () => MedalsPage,
color: 'blue',
icon: 'medal',
},
{
title: 'Hive',
component: () => MedalsPage,
color: 'purple',
icon: 'star',
},
Expand All @@ -23,8 +21,6 @@ export const MedalsPanel = (props) => {

const [pageIndex, setPageIndex] = useLocalState('pageIndex', 1);

const PageComponent = PAGES[pageIndex].component();

return (
<Window
width={600}
Expand Down Expand Up @@ -54,7 +50,7 @@ export const MedalsPanel = (props) => {
</Tabs>
</Stack.Item>
<Stack.Item mx={0}>
<PageComponent
<MedalsPage
awards={pageIndex === 0 ? uscm_awards : xeno_awards}
ckeys={pageIndex === 0 ? uscm_award_ckeys : xeno_award_ckeys}
isMarineMedal={pageIndex === 0}
Expand All @@ -77,7 +73,7 @@ const MedalsPage = (props) => {
<Section
title={isMarineMedal ? 'Medal Awards' : 'Royal Jellies'}
buttons={
<Fragment>
<>
<Button
icon="clock"
content="Refresh"
Expand All @@ -93,9 +89,9 @@ const MedalsPage = (props) => {
ml={0.5}
onClick={() => act(isMarineMedal ? 'add_medal' : 'add_jelly')}
/>
</Fragment>
</>
}>
<Fragment>
<>
{Object.keys(awards).map((recipient_name, recipient_index) => (
<Section
title={recipient_name + ckeys[recipient_name]}
Expand Down Expand Up @@ -132,7 +128,7 @@ const MedalsPage = (props) => {
))}
</Section>
))}
</Fragment>
</>
</Section>
);
};

0 comments on commit fb55417

Please sign in to comment.