Skip to content

Commit

Permalink
Add maps sumary (#131)
Browse files Browse the repository at this point in the history
* Adds all the maps as well as summary of the current match

* WIP Summary cards and maps data

* Finish the code changes

* Remove unnecessary thins

* Remove unnecessary thins

* Rollback typescript

* Update the installation stuff

* Fix the lock file

* Add install timeout also to windows
  • Loading branch information
petrvecera authored Aug 1, 2024
1 parent 1850580 commit a917d76
Show file tree
Hide file tree
Showing 114 changed files with 7,266 additions and 201 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Yarn install
run: yarn --prefer-offline --frozen-lockfile install
run: yarn --prefer-offline --frozen-lockfile --network-timeout 1000000 install
- name: Check JS build
run: yarn build

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
workspaces: './src-tauri -> target'

- name: Yarn install FE dependencies
run: yarn --prefer-offline --frozen-lockfile install
run: yarn --prefer-offline --frozen-lockfile --network-timeout 1000000 install

- name: Build it
run: yarn build
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ jobs:
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Yarn install
run: yarn --prefer-offline --frozen-lockfile install
run: yarn --prefer-offline --frozen-lockfile --network-timeout 1000000 install
- name: Check JS build
run: yarn build
- name: Run prettier
run: |
yarn lint:prettier
test-tauri:
name: Test Tauri build
name: Test Tauri build
runs-on: windows-latest

concurrency:
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
# shell: pwsh
# # See here: https://developer.microsoft.com/en-us/microsoft-edge/webview2/
# # https://github.com/actions/runner-images/issues/9538
# run: |
# run: |
# Invoke-WebRequest -Uri 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' -OutFile 'setup.exe'
# Start-Process -FilePath setup.exe -Verb RunAs -Wait

Expand All @@ -79,7 +79,7 @@ jobs:
workspaces: './src-tauri -> target'

- name: Yarn install FE dependencies
run: yarn --prefer-offline --frozen-lockfile install
run: yarn --prefer-offline --frozen-lockfile --network-timeout 1000000 install

- name: Build tauri App
uses: tauri-apps/tauri-action@v0
Expand Down
27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"tauri": "tauri",
"prepare": "husky",
"test:e2e": "wdio run wdio.conf.cjs",
"test:be": "cd src-tauri && cargo test --package coh3-stats-desktop-app --lib"
"test:be": "cd src-tauri && cargo test --package coh3-stats-desktop-app --lib",
"reinstall": "rm -rf node_modules && rm -fr dist && rm -fr src-tauri/target && yarn install"
},
"lint-staged": {
"*.{js,ts,jsx,tsx,yml,css}": [
Expand All @@ -31,27 +32,27 @@
},
"dependencies": {
"@emotion/react": "11.11.4",
"@mantine/core": "7.8.0",
"@mantine/hooks": "7.8.0",
"@mantine/notifications": "7.8.0",
"@mantine/core": "7.11.2",
"@mantine/hooks": "7.11.2",
"@mantine/notifications": "7.11.2",
"@sentry/react": "7.118.0",
"@tabler/icons-react": "3.10.0",
"@tabler/icons-react": "3.11.0",
"@tauri-apps/api": "1.5.6",
"axios": "1.6.8",
"axios": "1.7.2",
"coh-stats-components": "github:cohstats/coh-stats-components#0.0.7",
"coh3-data-types-library": "github:cohstats/coh3-data-types-library#0.0.2",
"mixpanel-browser": "2.49.0",
"mixpanel-browser": "2.54.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "6.23.0",
"react-router-dom": "6.26.0",
"tauri-plugin-fs-watch-api": "https://github.com/tauri-apps/tauri-plugin-fs-watch",
"tauri-plugin-log-api": "https://github.com/tauri-apps/tauri-plugin-log",
"tauri-plugin-store-api": "https://github.com/tauri-apps/tauri-plugin-store"
},
"devDependencies": {
"@tauri-apps/cli": "1.5.14",
"@types/mixpanel-browser": "2.49.0",
"@types/node": "^20.11.30",
"@types/node": "^20.14.13",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@vitejs/plugin-react": "4.2.1",
Expand All @@ -61,11 +62,11 @@
"@wdio/spec-reporter": "^7",
"husky": "9.0.11",
"lint-staged": "15.2.7",
"postcss": "8.4.38",
"postcss-preset-mantine": "1.14.4",
"postcss": "8.4.40",
"postcss-preset-mantine": "1.17.0",
"postcss-simple-vars": "7.0.1",
"prettier": "3.2.5",
"typescript": "5.4.5",
"prettier": "3.3.3",
"typescript": "5.5.4",
"vite": "5.2.11"
}
}
Binary file removed public/icons/maps-marked/benghazi_6p.colored.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/benghazi_6p.tm.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/benghazi_6p.webp
Binary file not shown.
Binary file not shown.
Binary file removed public/icons/maps-marked/catania_crossing_6p.tm.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/catania_crossing_6p.webp
Binary file not shown.
Binary file not shown.
Binary file removed public/icons/maps-marked/cliff_crossing_2p.tm.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/cliff_crossing_2p.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/day_101_4p.colored.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/day_101_4p.tm.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/day_101_4p.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed public/icons/maps-marked/gardens_2p.colored.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/gardens_2p.tm.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/gardens_2p.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed public/icons/maps-marked/monte_cavo_8p.colored.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/monte_cavo_8p.tm.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/monte_cavo_8p.webp
Binary file not shown.
Binary file not shown.
Binary file removed public/icons/maps-marked/mountain_ruins_6p.tm.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/mountain_ruins_6p.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed public/icons/maps-marked/mountain_ruins_8p_mkii.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/pachino_2p.colored.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/pachino_2p.tm.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/pachino_2p.webp
Binary file not shown.
Binary file not shown.
Binary file removed public/icons/maps-marked/rails_and_sand_4p.tm.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/rails_and_sand_4p.webp
Binary file not shown.
Binary file not shown.
Binary file removed public/icons/maps-marked/rural_castle_4p.tm.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/rural_castle_4p.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/rural_town_4p.colored.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/rural_town_4p.tm.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/rural_town_4p.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed public/icons/maps-marked/sousse_wetlands_8p.webp
Binary file not shown.
Binary file not shown.
Binary file removed public/icons/maps-marked/torrente_4p_mkiii.tm.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/torrente_4p_mkiii.webp
Binary file not shown.
Binary file not shown.
Binary file removed public/icons/maps-marked/twin_beach_2p_mkii.tm.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/twin_beach_2p_mkii.webp
Binary file not shown.
Binary file not shown.
Binary file removed public/icons/maps-marked/villa_fiore_2p_mkii.tm.webp
Binary file not shown.
Binary file removed public/icons/maps-marked/villa_fiore_2p_mkii.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed public/icons/maps-marked/winter_line_8p_mkii.webp
Binary file not shown.
Binary file removed public/icons/maps/benghazi_6p.webp
Binary file not shown.
Binary file removed public/icons/maps/catania_crossing_6p.webp
Binary file not shown.
Binary file removed public/icons/maps/cliff_crossing_2p.webp
Binary file not shown.
Binary file removed public/icons/maps/day_101_4p.webp
Binary file not shown.
Binary file removed public/icons/maps/desert_airfield_6p_mkii.webp
Binary file not shown.
Binary file removed public/icons/maps/desert_village_2p_mkiii.webp
Binary file not shown.
Binary file removed public/icons/maps/elst_outskirts_4p.webp
Binary file not shown.
Binary file removed public/icons/maps/faymonville.webp
Binary file not shown.
Binary file removed public/icons/maps/gardens_2p.webp
Binary file not shown.
Binary file removed public/icons/maps/industrial_railyard_6p_mkii.webp
Binary file not shown.
Binary file removed public/icons/maps/monte_cavo_8p.webp
Binary file not shown.
Binary file removed public/icons/maps/montherme_6p.webp
Binary file not shown.
Binary file removed public/icons/maps/mountain_ruins_6p.webp
Binary file not shown.
Binary file removed public/icons/maps/mountain_ruins_8p_mkii.webp
Binary file not shown.
Binary file removed public/icons/maps/pachino_2p.webp
Binary file not shown.
Binary file removed public/icons/maps/rails_and_sand_4p.webp
Binary file not shown.
Binary file removed public/icons/maps/rural_castle_4p.webp
Binary file not shown.
Binary file removed public/icons/maps/rural_town_4p.webp
Binary file not shown.
Binary file removed public/icons/maps/sangro_river_crossing_6p.webp
Binary file not shown.
Binary file removed public/icons/maps/semois_2p.webp
Binary file not shown.
Binary file removed public/icons/maps/sousse_stronghold_8p.webp
Binary file not shown.
Binary file removed public/icons/maps/sousse_wetlands_8p.webp
Binary file not shown.
Binary file removed public/icons/maps/steppe_8p.webp
Binary file not shown.
Binary file removed public/icons/maps/torrente_4p_mkiii.webp
Binary file not shown.
Binary file removed public/icons/maps/twin_beach_2p_mkii.webp
Binary file not shown.
Binary file removed public/icons/maps/villa_fiore_2p_mkii.webp
Binary file not shown.
Binary file removed public/icons/maps/winter_line_8p_mkii.webp
Binary file not shown.
3 changes: 2 additions & 1 deletion src-tauri/src/parse_log_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ fn get_team_data(players: Vec<PlayerData>) -> TeamData {
let mut mixed = false;
let mut last = TeamSide::Mixed;
for player in &players {
if player.faction == "german" || player.faction == "west_german" {
// For some reason the logs now produce faction as germans instead of german
if player.faction == "germans" || player.faction == "german" || player.faction == "west_german" {
if last == TeamSide::Allies {
mixed = true;
break;
Expand Down
6,627 changes: 6,627 additions & 0 deletions src-tauri/test_assets/warnings-2v2-july2024.log

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/Providers.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { MantineProvider, localStorageColorSchemeManager } from "@mantine/core"
import { GameDataProvider } from "./game-data-provider/GameDataProvider"
import { Notifications } from "@mantine/notifications"
import { MapStatsProvider } from "./map-stats-provider"

interface ProvidersProps {
children?: React.ReactNode
Expand All @@ -21,7 +22,9 @@ export const Providers: React.FC<ProvidersProps> = ({ children }) => {
// withNormalizeCSS
>
<Notifications />
<GameDataProvider>{children}</GameDataProvider>
<MapStatsProvider>
<GameDataProvider>{children}</GameDataProvider>
</MapStatsProvider>
</MantineProvider>
</>
)
Expand Down
48 changes: 25 additions & 23 deletions src/components/MapCard.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { Card, Title, Image, Space, Center, Flex } from "@mantine/core"
import { getMapName, getMapUrl } from "../utils/utils"
import { GameData, MapViewSettings } from "../game-data-provider/GameData"
import { Card, Title, Image, Paper } from "@mantine/core"
import { getMapName, getMapsUrlOnCDN } from "../utils/utils"
import {
GameDataTypes,
MapViewSettings,
} from "../game-data-provider/GameData-types"
import { useMapViewSettings } from "../game-data-provider/configValues"

interface MapCardProps {
gameData: GameData
gameData: GameDataTypes
}

const MapCard: React.FC<MapCardProps> = ({ gameData }) => {
Expand All @@ -13,25 +16,24 @@ const MapCard: React.FC<MapCardProps> = ({ gameData }) => {
if (!gameData) return null

return (
<Card padding={"md"} w="300" h="320" withBorder shadow="xs">
<Title order={4}>Map - {getMapName(gameData.gameData.map)}</Title>
<Card.Section w="280" h="280" p="xs">
<Image
p="xs"
w="auto"
h="100%"
fit="contain"
fallbackSrc={
getMapUrl(gameData.gameData.map, "none") || "icons/placeholder.svg"
}
src={getMapUrl(
gameData.gameData.map,
mapViewSettings as MapViewSettings
)}
alt="Map"
/>
</Card.Section>
</Card>
<Paper pl={"xs"} w="auto" h="320">
<Title order={3}>Map - {getMapName(gameData.gameData.map)}</Title>
<Image
p="xs"
w="auto"
h="270"
// fit="contain"
fallbackSrc={
getMapsUrlOnCDN(gameData.gameData.map, "none") ||
"icons/placeholder.svg"
}
src={getMapsUrlOnCDN(
gameData.gameData.map,
mapViewSettings as MapViewSettings
)}
alt={gameData.gameData.map}
/>
</Paper>
)
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/PlayerCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Grid,
} from "@mantine/core"
import React from "react"
import { FullPlayerData } from "../game-data-provider/GameData"
import { FullPlayerData } from "../game-data-provider/GameData-types"
import { PlayerELO } from "./PlayerELO"
import { PlayerLosses } from "./PlayerLosses"
import { PlayerRank } from "./PlayerRank"
Expand Down Expand Up @@ -54,15 +54,15 @@ export const PlayerCard: React.FC<PlayerCardProps> = ({
</Tooltip>
</Grid.Col>
<Grid.Col span="auto">
<Stack align="stretch">
<Stack align="stretch" gap={"xs"}>
<Group justify={"space-between"}>
<Group>
{!ai ? (
<Tooltip label={countryName}>
<Image
src={"/flags/4x3/" + country + ".svg"}
alt={country}
w={35}
w={30}
/>
</Tooltip>
) : null}
Expand Down
Loading

0 comments on commit a917d76

Please sign in to comment.