feat: adding link to game running

This commit is contained in:
Chubby Granny Chaser 2024-06-21 01:51:24 +01:00
parent 8afb3c27dc
commit 2f4d1396a9
No known key found for this signature in database
3 changed files with 26 additions and 19 deletions

View file

@ -4,8 +4,8 @@ import { dataSource } from "@main/data-source";
import { DownloadQueue, Game, UserAuth } from "@main/entity"; import { DownloadQueue, Game, UserAuth } from "@main/entity";
const signOut = async (_event: Electron.IpcMainInvokeEvent) => { const signOut = async (_event: Electron.IpcMainInvokeEvent) => {
const databaseOperations = dataSource.transaction( const databaseOperations = dataSource
async (transactionalEntityManager) => { .transaction(async (transactionalEntityManager) => {
await transactionalEntityManager.getRepository(DownloadQueue).delete({}); await transactionalEntityManager.getRepository(DownloadQueue).delete({});
await transactionalEntityManager.getRepository(Game).delete({}); await transactionalEntityManager.getRepository(Game).delete({});
@ -13,11 +13,11 @@ const signOut = async (_event: Electron.IpcMainInvokeEvent) => {
await transactionalEntityManager await transactionalEntityManager
.getRepository(UserAuth) .getRepository(UserAuth)
.delete({ id: 1 }); .delete({ id: 1 });
} })
); .then(() => {
/* Removes all games being played */
/* Removes all games being played */ gamesPlaytime.clear();
gamesPlaytime.clear(); });
/* Disconnects aria2 */ /* Disconnects aria2 */
DownloadManager.disconnect(); DownloadManager.disconnect();

View file

@ -15,7 +15,7 @@ import {
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { buildGameDetailsPath, steamUrlBuilder } from "@renderer/helpers"; import { buildGameDetailsPath, steamUrlBuilder } from "@renderer/helpers";
import { PersonIcon, TelescopeIcon } from "@primer/octicons-react"; import { PersonIcon, TelescopeIcon } from "@primer/octicons-react";
import { Button } from "@renderer/components"; import { Button, Link } from "@renderer/components";
import { UserEditProfileModal } from "./user-edit-modal"; import { UserEditProfileModal } from "./user-edit-modal";
import { UserSignOutModal } from "./user-signout-modal"; import { UserSignOutModal } from "./user-signout-modal";
@ -114,16 +114,11 @@ export function UserContent({
}} }}
> >
{gameRunning && isMe && ( {gameRunning && isMe && (
<div <img
style={{ src={steamUrlBuilder.libraryHero(gameRunning.objectID)}
backgroundImage: `url(${steamUrlBuilder.libraryHero(gameRunning.objectID)})`, alt={gameRunning.title}
backgroundPosition: "top", className={styles.profileBackground}
position: "absolute", />
inset: 0,
backgroundSize: "cover",
borderRadius: "4px",
}}
></div>
)} )}
<div <div
@ -165,7 +160,9 @@ export function UserContent({
alignItems: "center", alignItems: "center",
}} }}
> >
<p>{gameRunning.title}</p> <Link to={buildGameDetailsPath(gameRunning)}>
{gameRunning.title}
</Link>
</div> </div>
<small> <small>
{t("playing_for", { {t("playing_for", {

View file

@ -205,3 +205,13 @@ export const signOutModalButtonsContainer = style({
gap: `${SPACING_UNIT}px`, gap: `${SPACING_UNIT}px`,
paddingTop: `${SPACING_UNIT}px`, paddingTop: `${SPACING_UNIT}px`,
}); });
export const profileBackground = style({
width: "100%",
height: "100%",
position: "absolute",
objectFit: "cover",
left: "0",
top: "0",
borderRadius: "4px",
});