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";
const signOut = async (_event: Electron.IpcMainInvokeEvent) => {
const databaseOperations = dataSource.transaction(
async (transactionalEntityManager) => {
const databaseOperations = dataSource
.transaction(async (transactionalEntityManager) => {
await transactionalEntityManager.getRepository(DownloadQueue).delete({});
await transactionalEntityManager.getRepository(Game).delete({});
@ -13,11 +13,11 @@ const signOut = async (_event: Electron.IpcMainInvokeEvent) => {
await transactionalEntityManager
.getRepository(UserAuth)
.delete({ id: 1 });
}
);
/* Removes all games being played */
gamesPlaytime.clear();
})
.then(() => {
/* Removes all games being played */
gamesPlaytime.clear();
});
/* Disconnects aria2 */
DownloadManager.disconnect();

View file

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

View file

@ -205,3 +205,13 @@ export const signOutModalButtonsContainer = style({
gap: `${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",
});