mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 22:06:17 +00:00
Feat: added warning to the hero-panel-playtime
This commit is contained in:
@@ -205,6 +205,7 @@
|
||||
"update_playtime_error": "Failed to update playtime",
|
||||
"update_game_playtime": "Update game playtime",
|
||||
"manual_playtime_warning": "Your hours will be marked as manually updated, and this cannot be undone.",
|
||||
"manual_playtime_tooltip": "This playtime has been manually updated",
|
||||
"download_error_not_cached_on_torbox": "This download is not available on TorBox and polling download status from TorBox is not yet available.",
|
||||
"download_error_not_cached_on_hydra": "This download is not available on Nimbus.",
|
||||
"game_removed_from_favorites": "Game removed from favorites",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { HydraApi } from "@main/services";
|
||||
import { registerEvent } from "../register-event";
|
||||
import { GameShop } from "@types";
|
||||
import { gamesSublevel , levelKeys } from "@main/level";
|
||||
import { gamesSublevel, levelKeys } from "@main/level";
|
||||
|
||||
const changeGamePlaytime = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
|
||||
@@ -12,4 +12,15 @@
|
||||
color: globals.$body-color;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
&__play-time {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
&__manual-warning {
|
||||
color: #f59e0b; // Warning amber color
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,14 @@ import { useDate, useDownload, useFormat } from "@renderer/hooks";
|
||||
import { Link } from "@renderer/components";
|
||||
import { gameDetailsContext } from "@renderer/context";
|
||||
import { MAX_MINUTES_TO_SHOW_IN_PLAYTIME } from "@renderer/constants";
|
||||
import { AlertFillIcon } from "@primer/octicons-react";
|
||||
import { Tooltip } from "react-tooltip";
|
||||
import "./hero-panel-playtime.scss";
|
||||
|
||||
export function HeroPanelPlaytime() {
|
||||
const [lastTimePlayed, setLastTimePlayed] = useState("");
|
||||
|
||||
|
||||
const { game, isGameRunning } = useContext(gameDetailsContext);
|
||||
const { t } = useTranslation("game_details");
|
||||
const { numberFormatter } = useFormat();
|
||||
@@ -85,7 +89,22 @@ export function HeroPanelPlaytime() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<p>
|
||||
<p
|
||||
className="hero-panel-playtime__play-time"
|
||||
data-tooltip-place="top"
|
||||
data-tooltip-content={
|
||||
game.hasManuallyUpdatedPlaytime
|
||||
? t("manual_playtime_tooltip")
|
||||
: undefined
|
||||
}
|
||||
data-tooltip-id={game.hasManuallyUpdatedPlaytime ? "manual-playtime-warning" : undefined}
|
||||
>
|
||||
{game.hasManuallyUpdatedPlaytime && (
|
||||
<AlertFillIcon
|
||||
size={16}
|
||||
className="hero-panel-playtime__manual-warning"
|
||||
/>
|
||||
)}
|
||||
{t("play_time", {
|
||||
amount: formattedPlayTime,
|
||||
})}
|
||||
@@ -100,6 +119,17 @@ export function HeroPanelPlaytime() {
|
||||
})}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{game.hasManuallyUpdatedPlaytime && (
|
||||
<Tooltip
|
||||
id="manual-playtime-warning"
|
||||
style={{
|
||||
zIndex: 9999,
|
||||
}}
|
||||
openOnClick={false}
|
||||
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user