Use proper way of detecting when a user hovers for games/installs page

This commit is contained in:
2026-01-07 19:01:58 -07:00
parent a3e9067ba0
commit 3dc24ab3d7
3 changed files with 18 additions and 34 deletions

View File

@@ -11,3 +11,13 @@
.downloads-entry { .downloads-entry {
@apply flex justify-between items-center m-2 p-2 rounded-lg text-gray-200 text-lg transition-colors bg-(--col2) hover:bg-(--col3) border border-(--col4) hover:border-(--col5); @apply flex justify-between items-center m-2 p-2 rounded-lg text-gray-200 text-lg transition-colors bg-(--col2) hover:bg-(--col3) border border-(--col4) hover:border-(--col5);
} }
.downloads-entry .entry-info-item,
.downloads-entry .button {
@apply bg-(--col3) border-(--col5) hover:bg-(--col5) hover:border-(--col7) disabled:text-gray-300 disabled:bg-(--col2) disabled:border-(--col6) disabled:hover:text-gray-100 disabled:hover:bg-(--col3) disabled:hover:border-(--col7);
}
.downloads-entry:hover .entry-info-item,
.downloads-entry:hover .button {
@apply bg-(--col4) border-(--col6) hover:bg-(--col6) hover:border-(--col8) disabled:text-gray-300 disabled:bg-(--col2) disabled:border-(--col7) disabled:hover:text-gray-100 disabled:hover:bg-(--col4) disabled:hover:border-(--col8);
}

View File

@@ -24,7 +24,6 @@ export default function Installs () {
} = useGlobal() } = useGlobal()
const params = useSearchParams() const params = useSearchParams()
const [hoveredIds, setHoveredIds] = useState<string[]>([])
useEffect(() => { useEffect(() => {
if (!showPopup) return if (!showPopup) return
@@ -106,10 +105,6 @@ export default function Installs () {
setShowPopup(true) setShowPopup(true)
setFadeOut(false) setFadeOut(false)
}} }}
onMouseEnter={() => setHoveredIds(prev => [...prev, entry])}
onMouseLeave={() =>
setHoveredIds(prev => prev.filter(i => i !== i))
}
> >
<div className='h-18 w-screen relative'> <div className='h-18 w-screen relative'>
<p className='text-2xl'> <p className='text-2xl'>
@@ -118,9 +113,7 @@ export default function Installs () {
</p> </p>
<div <div
className={`entry-info-item absolute left-0 bottom-0 ${ className='entry-info-item absolute left-0 bottom-0'
hoveredIds.includes(entry) ? 'btntheme3' : 'btntheme2'
}`}
title='The date the game was installed in MM/dd/yyyy format' title='The date the game was installed in MM/dd/yyyy format'
> >
<p> <p>
@@ -134,9 +127,7 @@ export default function Installs () {
<div className='flex gap-2 absolute right-0 bottom-0'> <div className='flex gap-2 absolute right-0 bottom-0'>
<button <button
className={`button ${ className='button'
hoveredIds.includes(entry) ? 'btntheme3' : 'btntheme2'
}`}
onClick={e => { onClick={e => {
e.stopPropagation() e.stopPropagation()
setManagingVersion(entry) setManagingVersion(entry)
@@ -149,9 +140,7 @@ export default function Installs () {
View Info View Info
</button> </button>
<button <button
className={`button ${ className='button'
hoveredIds.includes(entry) ? 'btntheme3' : 'btntheme2'
}`}
hidden={ hidden={
!normalConfig?.settings.useLegacyInteractButtons !normalConfig?.settings.useLegacyInteractButtons
} }
@@ -167,9 +156,7 @@ export default function Installs () {
Manage Manage
</button> </button>
<button <button
className={`button ${ className='button'
hoveredIds.includes(entry) ? 'btntheme3' : 'btntheme2'
}`}
onClick={e => { onClick={e => {
e.stopPropagation() e.stopPropagation()
const verInfo = getVersionInfo(entry) const verInfo = getVersionInfo(entry)

View File

@@ -28,7 +28,6 @@ export default function Installs () {
} = useGlobal() } = useGlobal()
const router = useRouter() const router = useRouter()
const [hoveredIds, setHoveredIds] = useState<number[]>([])
useEffect(() => { useEffect(() => {
if (!showPopup) return if (!showPopup) return
@@ -82,19 +81,13 @@ export default function Installs () {
if (normalConfig?.settings.useLegacyInteractButtons) return if (normalConfig?.settings.useLegacyInteractButtons) return
router.push('/game?id=' + i.id) router.push('/game?id=' + i.id)
}} }}
onMouseEnter={() => setHoveredIds(prev => [...prev, i.id])}
onMouseLeave={() =>
setHoveredIds(prev => prev.filter(e => e !== i.id))
}
> >
<div className='h-18 w-screen relative'> <div className='h-18 w-screen relative'>
<p className='text-2xl'>{i.name}</p> <p className='text-2xl'>{i.name}</p>
<div className='flex gap-2 absolute left-0 bottom-0'> <div className='flex gap-2 absolute left-0 bottom-0'>
<div <div
className={`entry-info-item ${ className='entry-info-item'
hoveredIds.includes(i.id) ? 'btntheme3' : 'btntheme2'
}`}
title='The amount of versions installed of this game in installed/installable format.' title='The amount of versions installed of this game in installed/installable format.'
> >
<p> <p>
@@ -107,9 +100,7 @@ export default function Installs () {
</p> </p>
</div> </div>
<div <div
className={`entry-info-item ${ className='entry-info-item'
hoveredIds.includes(i.id) ? 'btntheme3' : 'btntheme2'
}`}
hidden={!i.official} hidden={!i.official}
title='This game is official.' title='This game is official.'
> >
@@ -117,9 +108,7 @@ export default function Installs () {
<p>Official</p> <p>Official</p>
</div> </div>
<div <div
className={`entry-info-item ${ className='entry-info-item'
hoveredIds.includes(i.id) ? 'btntheme3' : 'btntheme2'
}`}
hidden={i.official} hidden={i.official}
title={ title={
i.verified i.verified
@@ -136,9 +125,7 @@ export default function Installs () {
</div> </div>
<Link <Link
className={`button absolute right-0 bottom-0 ${ className='button absolute right-0 bottom-0'
hoveredIds.includes(i.id) ? 'btntheme3' : 'btntheme2'
}`}
href={'/game?id=' + i.id} href={'/game?id=' + i.id}
hidden={!normalConfig?.settings.useLegacyInteractButtons} hidden={!normalConfig?.settings.useLegacyInteractButtons}
title='Click to view game installs' title='Click to view game installs'