feat: show HeroPanelPlaytime if playTime is not 0

This commit is contained in:
Zamitto 2024-06-05 20:55:05 -03:00
parent e8b28ccf90
commit de178d672e
4 changed files with 18 additions and 4 deletions

View file

@ -22,7 +22,7 @@ export const modal = recipe({
animationDuration: "0.3s", animationDuration: "0.3s",
backgroundColor: vars.color.background, backgroundColor: vars.color.background,
borderRadius: "4px", borderRadius: "4px",
maxWidth: "600px", maxWidth: "800px",
color: vars.color.body, color: vars.color.body,
maxHeight: "100%", maxHeight: "100%",
border: `solid 1px ${vars.color.border}`, border: `solid 1px ${vars.color.border}`,
@ -37,6 +37,12 @@ export const modal = recipe({
opacity: 0, opacity: 0,
}, },
}, },
large: {
true: {
width: "800px",
maxWidth: "800px",
},
},
}, },
}); });

View file

@ -12,6 +12,7 @@ export interface ModalProps {
title: string; title: string;
description?: string; description?: string;
onClose: () => void; onClose: () => void;
large?: boolean;
children: React.ReactNode; children: React.ReactNode;
} }
@ -20,6 +21,7 @@ export function Modal({
title, title,
description, description,
onClose, onClose,
large,
children, children,
}: ModalProps) { }: ModalProps) {
const [isClosing, setIsClosing] = useState(false); const [isClosing, setIsClosing] = useState(false);
@ -88,7 +90,7 @@ export function Modal({
return createPortal( return createPortal(
<Backdrop isClosing={isClosing}> <Backdrop isClosing={isClosing}>
<div <div
className={styles.modal({ closing: isClosing })} className={styles.modal({ closing: isClosing, large })}
role="dialog" role="dialog"
aria-labelledby={title} aria-labelledby={title}
aria-describedby={description} aria-describedby={description}

View file

@ -35,7 +35,8 @@ export function HeroPanel() {
const getInfo = () => { const getInfo = () => {
if (isGameDeleting(game?.id ?? -1)) return <p>{t("deleting")}</p>; if (isGameDeleting(game?.id ?? -1)) return <p>{t("deleting")}</p>;
if (game?.progress === 1) return <HeroPanelPlaytime />; if (game?.progress === 1 || game?.playTimeInMilliseconds)
return <HeroPanelPlaytime />;
if (game?.status === "active") { if (game?.status === "active") {
if (lastPacket?.isDownloadingMetadata && isGameDownloading) { if (lastPacket?.isDownloadingMetadata && isGameDownloading) {

View file

@ -68,7 +68,12 @@ export function GameOptionsModal({
return ( return (
<> <>
<Modal visible={visible} title={game.title} onClose={onClose}> <Modal
visible={visible}
title={game.title}
onClose={onClose}
large={true}
>
<DeleteGameModal <DeleteGameModal
visible={showDeleteModal} visible={showDeleteModal}
onClose={() => setShowDeleteModal(false)} onClose={() => setShowDeleteModal(false)}