Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several minor UI improvements #52

Merged
merged 4 commits into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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