Skip to content

Commit

Permalink
feat(frontend): some prettier motions
Browse files Browse the repository at this point in the history
  • Loading branch information
xikxp1 committed Dec 1, 2024
1 parent 7247da4 commit a5a9d5d
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 9 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"license": "GPL-3.0-only",
"dependencies": {
"@number-flow/svelte": "^0.2.1",
"@tauri-apps/api": "2.1.1",
"@tauri-apps/plugin-autostart": "2.0.0",
"@tauri-apps/plugin-log": "2.0.0",
Expand Down
21 changes: 21 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "iracehud"
version = "0.3.8"
version = "0.3.9"
description = "iRacing HUD overlay built in Tauri"
authors = ["Ivan Kachalkin<[email protected]>"]
edition = "2021"
Expand Down
10 changes: 7 additions & 3 deletions src/components/Main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
speed,
} from "$lib/telemetry/telemetry.svelte";
import type { Rpm } from "$lib/types/telemetry";
import NumberFlow from "@number-flow/svelte";
import { onMount } from "svelte";
let gear_indicator: HTMLDivElement;
Expand Down Expand Up @@ -92,15 +93,17 @@
<div class="flex flex-row items-center justify-evenly">
<div class="flex flex-col items-center justify-evenly">
<div class="text-primary">
{$lap}{#if $lapsTotal > 0}/{$lapsTotal}{/if}
<NumberFlow value={$lap} continuous={true}
></NumberFlow>{#if $lapsTotal > 0}/{$lapsTotal}{/if}
</div>
<div class="text-secondary text-xs">lap</div>
</div>
<div class="divider divider-horizontal divider-primary"></div>
<div class="flex flex-col items-center justify-evenly">
<div class="text-primary">
{#if $position > 0}
{$position}{#if $positionsTotal > 0}/{$positionsTotal}{/if}
<NumberFlow value={$position} continuous={true}
></NumberFlow>{#if $positionsTotal > 0}/{$positionsTotal}{/if}
{:else}
-
{/if}
Expand All @@ -110,7 +113,8 @@
<div class="divider divider-horizontal divider-primary"></div>
<div class="flex flex-col items-center justify-evenly">
<div class="text-primary">
{$incidents}{#if $incidentLimit > 0}/{$incidentLimit}{/if}
<NumberFlow value={$incidents} continuous={true}
></NumberFlow>{#if $incidentLimit > 0}/{$incidentLimit}{/if}x
</div>
<div class="text-secondary text-xs">inc</div>
</div>
Expand Down
13 changes: 9 additions & 4 deletions src/components/Standings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
let show_best_lap = false;
let interval: NodeJS.Timeout;
function on_standings (value: StandingsDriver[]) {
function on_standings(value: StandingsDriver[]) {
let new_standings: LocalStandings[] = [];
value.forEach((st) => {
let new_value: LocalStandings = {
Expand All @@ -33,8 +33,7 @@
(old_st) => old_st.car_id === new_value.car_id,
);
new_value.position_change =
new_value.position -
(old_st?.position ?? new_value.position);
new_value.position - (old_st?.position ?? new_value.position);
new_standings.push(new_value);
});
current_standings = new_standings;
Expand Down Expand Up @@ -125,7 +124,13 @@
/>
{/if}
</td>
<td class="text text-sm text-right pr-1 w-[40px]">
<td
class="text text-sm text-right {st?.is_leader &&
$raceLaps > 0 &&
!st?.is_player
? 'text-secondary'
: ''} pr-1 w-[35px]"
>
{#if st?.is_leader && $raceLaps > 0}
L{$raceLaps}
{:else}
Expand Down

0 comments on commit a5a9d5d

Please sign in to comment.