Skip to content

Commit

Permalink
Small improvements (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
petrvecera authored Sep 20, 2024
1 parent 0e8e4d1 commit 99d2565
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 17 deletions.
2 changes: 1 addition & 1 deletion config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const getEdgioEnvName = (): string | null => {
};

// This controls the default patch selector in the stats page // this needs to be key statsPatchSelector object
const defaultStatsPatchSelector = "1.7.3";
const defaultStatsPatchSelector = "1.8.0";

// This controls the patch selector in the stats page
const statsPatchSelector: Record<
Expand Down
18 changes: 18 additions & 0 deletions screens/players/tabs/recent-matches-tab/matches-table.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.row-indicator {
position: absolute; /* Ensure the parent element has a positioning context */
width: 40px; /* We need to be big, so we can nice radius */
height: 65px;
left: -34px;
z-index: 1;
border-radius: 10%;
/*This is magic constant, I don't know why this makes it int he middle*/
margin-top: -23px;
}

.win-indicator {
background-color: var(--mantine-color-blue-filled); /* Background color of the rectangle */
}

.loss-indicator {
background-color: var(--mantine-color-red-filled); /* Background color of the rectangle */
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import { useLocalStorage } from "@mantine/hooks";
import RenderPlayers from "./matches-table/render-players";
import RenderMap from "./matches-table/render-map";

import classes from "./matches-table.module.css";

/**
* Timeago is causing issues with SSR, move to client side
*/
Expand Down Expand Up @@ -184,6 +186,9 @@ const PlayerRecentMatchesTab = ({
records={sortedData}
// define columns
sortStatus={sortStatus}
// rowClassName={(record)=>{
// return classes["row-custom-styles"]
// }}
onSortStatusChange={setSortStatus}
columns={[
{
Expand Down Expand Up @@ -231,16 +236,26 @@ const PlayerRecentMatchesTab = ({

if (isPlayerVictorious(record as unknown as ProcessedMatch, profileID)) {
return (
<Badge color={"blue"} variant="filled" w={"16ch"}>
VICTORY +{ratingChange}
</Badge>
<div>
<div
className={`${classes["row-indicator"]} ${classes["win-indicator"]}`}
></div>
<Badge color={"blue"} variant="filled" w={"16ch"}>
VICTORY +{ratingChange}
</Badge>
</div>
);
} else {
if (playerResult?.resulttype === 0) {
return (
<Badge color={"red"} variant="filled" w={"16ch"}>
DEFEAT {ratingChange}
</Badge>
<>
<div
className={`${classes["row-indicator"]} ${classes["loss-indicator"]}`}
></div>
<Badge color={"red"} variant="filled" w={"16ch"}>
DEFEAT {ratingChange}
</Badge>
</>
);
} else if (playerResult?.resulttype === 4) {
return (
Expand Down
6 changes: 5 additions & 1 deletion screens/players/tabs/standings-tab/faction-summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ const PlayerStandingsFactionInfo = ({
return (
<>
<Card
padding="lg"
padding="md"
pb="xs"
radius="md"
withBorder
style={{
Expand Down Expand Up @@ -152,6 +153,9 @@ const PlayerStandingsFactionInfo = ({
</div>
</Stack>
</Text>
<Text size={"xs"} c="dimmed" ta={"center"}>
Current player standings
</Text>
</Card>
</>
);
Expand Down
19 changes: 17 additions & 2 deletions screens/players/tabs/standings-tab/player-standings-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Link from "next/link";
import { getLeaderBoardRoute } from "../../../../src/routes";
import DynamicTimeAgo from "../../../../components/other/dynamic-timeago";
import RankIcon from "../../../../components/rank-icon";
import HelperIcon from "../../../../components/icon/helper";

const PlayerStandingsTable = ({
faction,
Expand Down Expand Up @@ -80,12 +81,19 @@ const PlayerStandingsTable = ({
{rankElement}
{highestrank > 0 && (
<Text size={"xs"} c="dimmed">
Top {highestrank}
Best {highestrank}
</Text>
)}
</Stack>
);
},
footer: (
<>
<Text size={"xs"} c="dimmed">
<HelperIcon text={"Best Rank Achieved. The best Rank the player ever had."} />
</Text>
</>
),
},
{
title: "ELO",
Expand All @@ -101,12 +109,19 @@ const PlayerStandingsTable = ({
<span>{rating}</span>
{highestrating > 0 && (
<Text size={"xs"} c="dimmed">
Top {highestrating}
Best {highestrating}
</Text>
)}
</Stack>
);
},
footer: (
<>
<Text size={"xs"} c="dimmed">
<HelperIcon text={"Best ELO Achieved. The best ELO the player ever had."} />
</Text>
</>
),
},
{
title: "Tier",
Expand Down
10 changes: 4 additions & 6 deletions screens/players/tabs/standings-tab/widgets/nemesis-widget.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ProcessedCOHPlayerStats } from "../../../../../src/coh3/coh3-types";
import { Anchor, Card, Group, Title, Tooltip, Flex, Text } from "@mantine/core";
import { Anchor, Card, Group, Title, Flex, Text } from "@mantine/core";
import React from "react";
import { DataTable } from "mantine-datatable";
import Link from "next/link";
Expand Down Expand Up @@ -51,11 +51,9 @@ const NemesisWidget = ({
component={Link}
href={`/players/${profile_id}`}
>
<Tooltip label={alias}>
<Text span size="sm">
<EllipsisText text={alias} noWrap={false} maxWidth={"12ch"} />
</Text>
</Tooltip>
<Text span size="sm">
<EllipsisText text={alias} noWrap={false} maxWidth={"12ch"} />
</Text>
</Anchor>
);
},
Expand Down
2 changes: 1 addition & 1 deletion screens/stats/stats-container-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ const StatsContainerSelector = ({ statsType }: { statsType: "gameStats" | "mapSt
label="Pick dates range"
value={valueDatePicker}
onChange={setValueDatePicker}
w={295}
w={305}
// mx={10}
// mx="auto"

Expand Down

0 comments on commit 99d2565

Please sign in to comment.