Skip to content

Commit

Permalink
Merge pull request #52 from MichlF/master
Browse files Browse the repository at this point in the history
Several minor UI improvements
  • Loading branch information
petrvecera committed Jun 1, 2023
2 parents f2a3e40 + ec13f90 commit 697b94f
Show file tree
Hide file tree
Showing 5 changed files with 320 additions and 27 deletions.
2 changes: 0 additions & 2 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
)]

extern crate machine_uid;
use tauri_plugin_single_instance;
use tauri_plugin_fs_watch;
use std::path::Path;
use tauri::Manager;
use window_shadows::set_shadow;
Expand Down
13 changes: 6 additions & 7 deletions src-tauri/src/parse_log_file.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use serde::{Deserialize, Serialize};
use nom;
use std::io::BufReader;
use std::io::BufRead;
use std::fs::File;
use log::{info};
use log::info;

#[derive(Serialize, Deserialize, Clone)]
pub enum GameState {
Expand Down Expand Up @@ -252,9 +251,9 @@ pub fn parse_log_file_reverse(path: String) -> LogFileData {
win_condition,
left: left_team,
right: right_team,
player_name: player_name,
player_steam_id: player_steam_id,
language_code: language_code
player_name,
player_steam_id,
language_code
}
}

Expand Down Expand Up @@ -313,9 +312,9 @@ fn get_team_data(players: Vec<PlayerData>) -> TeamData {
}
}
if mixed {
return TeamData { players: players, side: TeamSide::Mixed }
return TeamData { players, side: TeamSide::Mixed }
}
TeamData { players: players, side: last }
TeamData { players, side: last }
}

// look for blocks like this:
Expand Down
30 changes: 18 additions & 12 deletions src/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ export const Settings: React.FC = () => {
<div>
<Group spacing="xs">
<Group spacing={3}>
<Input readOnly value={logFilePath ? logFilePath : ""} />
<Input
value={logFilePath ? logFilePath : ""}
style={{ width: 500 }}
readOnly
/>
<Button variant="default" onClick={openDialog}>
Select
</Button>
Expand Down Expand Up @@ -146,14 +150,16 @@ export const Settings: React.FC = () => {
events.settings_changed("play_sound_volume", value)
}}
/>
<ActionIcon
radius="xl"
variant="filled"
color="blue"
onClick={playSoundFunc}
>
<IconPlayerPlay size="1.125rem" />
</ActionIcon>
<Tooltip label="Play sound">
<ActionIcon
radius="xl"
variant="filled"
color="blue"
onClick={playSoundFunc}
>
<IconPlayerPlay size="1.125rem" />
</ActionIcon>
</Tooltip>
</Group>
</div>
</Group>
Expand Down Expand Up @@ -201,20 +207,20 @@ export const Settings: React.FC = () => {
</Group>
<div>
<Text weight={700}>
Follow the Setup instructions{" "}
Follow the{" "}
<Anchor
onClick={() =>
openLink(
"https://github.com/cohstats/coh3-stats-desktop-app#setup-obs-streamer-overlay"
)
}
>
Here
Setup instructions
</Anchor>
</Text>
<Group pt="md">
<Text>Path to streamerOverlay.html:</Text>
<Input value={appDataPath} style={{ width: 300 }} readOnly />
<Input value={appDataPath} style={{ width: 500 }} readOnly />
<Tooltip label="Copy">
<ActionIcon
onClick={() => {
Expand Down
18 changes: 12 additions & 6 deletions src/components/PlayerCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { PlayerStreak } from "./PlayerStreak"
import { PlayerWinRatio } from "./PlayerWinRatio"
import { PlayerWins } from "./PlayerWins"
import { open } from "@tauri-apps/api/shell"
import { getFactionName, getCountryName } from "../utils/renameLabels"

export interface PlayerCardProps extends FullPlayerData {}

Expand All @@ -37,12 +38,15 @@ export const PlayerCard: React.FC<PlayerCardProps> = ({
ai,
self,
}) => {
const factionName = getFactionName(faction)
const countryName = country ? getCountryName(country) : ""

return (
<>
<Paper shadow="xs" withBorder p="xs" mb={"xs"}>
<Grid>
<Col span="content">
<Tooltip label={faction}>
<Tooltip label={factionName}>
<Image
src={"/factions/" + faction + ".webp"}
alt={faction}
Expand All @@ -54,11 +58,13 @@ export const PlayerCard: React.FC<PlayerCardProps> = ({
<Stack align="stretch">
<Group>
{!ai ? (
<Image
src={"/flags/4x3/" + country + ".svg"}
alt={country}
width={35}
/>
<Tooltip label={countryName}>
<Image
src={"/flags/4x3/" + country + ".svg"}
alt={country}
width={35}
/>
</Tooltip>
) : null}

<Title
Expand Down
Loading

0 comments on commit 697b94f

Please sign in to comment.