Skip to content

Commit

Permalink
show more info on old method
Browse files Browse the repository at this point in the history
  • Loading branch information
zefanjajobse committed Nov 17, 2023
1 parent ecedebb commit b2c40e2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
30 changes: 18 additions & 12 deletions src/api/marneApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export interface ModListReturn {
export interface RotationReturn {
map: string;
mode: string;
mapLongName?: string;
modeLongName?: string;
}

export interface ServerInfoReturn {
Expand Down Expand Up @@ -348,18 +350,22 @@ export class ApiProvider extends JsonClient {
description: result?.description,
rotation: result?.rotation?.map(
(current: RotationReturn, index: number) => {
const internalMapName: string =
current?.map?.split("/").slice(-1)[0] || "";
return {
index,
mapname:
maps[internalMapName] ||
capitalizeFirstLetter(current?.map || ""),
mode:
modes[current?.mode] ||
capitalizeFirstLetter(current?.mode || ""),
image: map_image[internalMapName] || "",
};
if (current !== null) {
const internalMapName: string =
current?.mapLongName?.split("/").slice(-1)[0] ||
current?.map?.split("/").slice(-1)[0] ||
"";
return {
index,
mapname:
maps[internalMapName] ||
capitalizeFirstLetter(current?.map || ""),
mode:
modes[current?.mode] ||
capitalizeFirstLetter(current?.mode || ""),
image: map_image[internalMapName] || "",
};
}
},
),
players:
Expand Down
15 changes: 8 additions & 7 deletions src/components/routes/Servers/Detailed/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,14 @@ export function Results(props: Views): React.ReactElement {
/>
))
: stats?.rotation?.map(
(key: ServerRotation, index: number) => (
<MapRotationItem
key={index}
index={index}
stats={key}
/>
),
(key: ServerRotation, index: number) =>
key && (
<MapRotationItem
key={index}
stats={key}
index={index}
/>
),
)}
</Align>
</>
Expand Down

0 comments on commit b2c40e2

Please sign in to comment.