Finish info popup
This commit is contained in:
@@ -34,6 +34,7 @@ type GlobalCtxType = {
|
|||||||
installed: number
|
installed: number
|
||||||
total: number
|
total: number
|
||||||
} | null
|
} | null
|
||||||
|
viewingInfoFromDownloads: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const GlobalCtx = createContext<GlobalCtxType | null>(null)
|
const GlobalCtx = createContext<GlobalCtxType | null>(null)
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.entry-info-item {
|
.entry-info-item {
|
||||||
@apply flex flex-row items-center gap-1 bg-(--col1) border border-(--col3) text-gray-300 py-1 px-2 rounded-lg w-fit text-[16px] transition-colors;
|
@apply flex flex-row items-center gap-1 bg-(--col1) border border-(--col3) text-gray-300 py-1 px-2 rounded-lg w-fit text-[16px] transition-colors cursor-pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.downloads-entry:hover .entry-info-item {
|
.downloads-entry:hover .entry-info-item {
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ export default function VersionInfo () {
|
|||||||
getVersionGame,
|
getVersionGame,
|
||||||
getVersionInfo,
|
getVersionInfo,
|
||||||
managingVersion,
|
managingVersion,
|
||||||
downloadedVersionsConfig
|
downloadedVersionsConfig,
|
||||||
|
viewingInfoFromDownloads
|
||||||
} = useGlobal()
|
} = useGlobal()
|
||||||
if (!managingVersion || !downloadedVersionsConfig) return <></>
|
if (!managingVersion || !downloadedVersionsConfig) return <></>
|
||||||
|
|
||||||
@@ -43,11 +44,13 @@ export default function VersionInfo () {
|
|||||||
{getVersionInfo(managingVersion)?.versionName}
|
{getVersionInfo(managingVersion)?.versionName}
|
||||||
</p>
|
</p>
|
||||||
<div className='popup-content flex flex-col items-center justify-center gap-2 h-full'>
|
<div className='popup-content flex flex-col items-center justify-center gap-2 h-full'>
|
||||||
<div className='entry-info-item'>
|
<div className='entry-info-item' hidden={viewingInfoFromDownloads}>
|
||||||
<p>
|
<p>
|
||||||
Installed{' '}
|
Installed{' '}
|
||||||
{format(
|
{format(
|
||||||
new Date(downloadedVersionsConfig.timestamps[managingVersion]),
|
new Date(
|
||||||
|
downloadedVersionsConfig.timestamps[managingVersion] ?? 0
|
||||||
|
),
|
||||||
'MM/dd/yyyy'
|
'MM/dd/yyyy'
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
@@ -66,22 +69,25 @@ export default function VersionInfo () {
|
|||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className='entry-info-item'>
|
<div className='entry-info-item' hidden={!gameInfo?.official}>
|
||||||
<FontAwesomeIcon icon={faCheck} color='#19c84b' />
|
<FontAwesomeIcon icon={faCheck} color='#19c84b' />
|
||||||
<p>Official</p>
|
<p>Official</p>
|
||||||
</div>
|
</div>
|
||||||
<div className='entry-info-item'>
|
<div className='entry-info-item' hidden={gameInfo?.official}>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={gameInfo?.verified ? faShieldHalved : faWarning}
|
icon={gameInfo?.verified ? faShieldHalved : faWarning}
|
||||||
color={gameInfo?.verified ? '#19c84b' : '#ffc800'}
|
color={gameInfo?.verified ? '#19c84b' : '#ffc800'}
|
||||||
/>
|
/>
|
||||||
<p>{gameInfo?.verified ? 'Verified' : 'Unverified'}</p>
|
<p>{gameInfo?.verified ? 'Verified' : 'Unverified'}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className='entry-info-item'>
|
<div className='entry-info-item' hidden={gameInfo?.official}>
|
||||||
<FontAwesomeIcon icon={faCode} color='lightgray' />
|
<FontAwesomeIcon icon={faCode} color='lightgray' />
|
||||||
<p>Developer: {gameInfo?.developer}</p>
|
<p>Developer: {gameInfo?.developer}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className='entry-info-item' hidden={versionSize === null}>
|
<div
|
||||||
|
className='entry-info-item'
|
||||||
|
hidden={viewingInfoFromDownloads || versionSize === null}
|
||||||
|
>
|
||||||
<FontAwesomeIcon icon={faHardDrive} color='lightgray' />
|
<FontAwesomeIcon icon={faHardDrive} color='lightgray' />
|
||||||
<p>
|
<p>
|
||||||
Size on disk:{' '}
|
Size on disk:{' '}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
faChevronLeft,
|
faChevronLeft,
|
||||||
faCode,
|
faCode,
|
||||||
faDownload,
|
faDownload,
|
||||||
|
faInfo,
|
||||||
faRemove,
|
faRemove,
|
||||||
faShieldHalved,
|
faShieldHalved,
|
||||||
faWarning,
|
faWarning,
|
||||||
@@ -41,6 +42,7 @@ import { listen } from '@tauri-apps/api/event'
|
|||||||
import { usePathname } from 'next/navigation'
|
import { usePathname } from 'next/navigation'
|
||||||
import { arch, platform } from '@tauri-apps/plugin-os'
|
import { arch, platform } from '@tauri-apps/plugin-os'
|
||||||
import VersionInfo from './componets/VersionInfo'
|
import VersionInfo from './componets/VersionInfo'
|
||||||
|
import { set } from 'date-fns'
|
||||||
|
|
||||||
const roboto = Roboto({
|
const roboto = Roboto({
|
||||||
subsets: ['latin']
|
subsets: ['latin']
|
||||||
@@ -71,10 +73,18 @@ export default function RootLayout ({
|
|||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
const [managingVersion, setManagingVersion] = useState<string | null>(null)
|
const [managingVersion, setManagingVersion] = useState<string | null>(null)
|
||||||
|
const [viewingInfoFromDownloads, setViewingInfoFromDownloads] =
|
||||||
|
useState<boolean>(false)
|
||||||
const [selectedGame, setSelectedGame] = useState<number | null>(null)
|
const [selectedGame, setSelectedGame] = useState<number | null>(null)
|
||||||
|
|
||||||
function handleOverlayClick (e: React.MouseEvent<HTMLDivElement>) {
|
function handleOverlayClick (e: React.MouseEvent<HTMLDivElement>) {
|
||||||
if (e.target === e.currentTarget) {
|
if (e.target === e.currentTarget) {
|
||||||
|
if (viewingInfoFromDownloads) {
|
||||||
|
setPopupMode(0)
|
||||||
|
setViewingInfoFromDownloads(false)
|
||||||
|
setManagingVersion(null)
|
||||||
|
setSelectedGame(null)
|
||||||
|
}
|
||||||
setFadeOut(true)
|
setFadeOut(true)
|
||||||
setTimeout(() => setShowPopup(false), 200)
|
setTimeout(() => setShowPopup(false), 200)
|
||||||
}
|
}
|
||||||
@@ -402,7 +412,8 @@ export default function RootLayout ({
|
|||||||
getVersionGame,
|
getVersionGame,
|
||||||
getListOfGames,
|
getListOfGames,
|
||||||
setSelectedGame,
|
setSelectedGame,
|
||||||
getVersionsAmountData
|
getVersionsAmountData,
|
||||||
|
viewingInfoFromDownloads
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -412,6 +423,9 @@ export default function RootLayout ({
|
|||||||
if (popupMode == 0 && selectedGame) {
|
if (popupMode == 0 && selectedGame) {
|
||||||
setSelectedGame(null)
|
setSelectedGame(null)
|
||||||
setSelectedVersionList([])
|
setSelectedVersionList([])
|
||||||
|
} else if (viewingInfoFromDownloads) {
|
||||||
|
setViewingInfoFromDownloads(false)
|
||||||
|
setPopupMode(0)
|
||||||
} else {
|
} else {
|
||||||
setFadeOut(true)
|
setFadeOut(true)
|
||||||
setTimeout(() => setShowPopup(false), 200)
|
setTimeout(() => setShowPopup(false), 200)
|
||||||
@@ -445,6 +459,9 @@ export default function RootLayout ({
|
|||||||
) {
|
) {
|
||||||
setSelectedGame(null)
|
setSelectedGame(null)
|
||||||
setSelectedVersionList([])
|
setSelectedVersionList([])
|
||||||
|
} else if (viewingInfoFromDownloads) {
|
||||||
|
setViewingInfoFromDownloads(false)
|
||||||
|
setPopupMode(0)
|
||||||
} else {
|
} else {
|
||||||
setFadeOut(true)
|
setFadeOut(true)
|
||||||
setTimeout(() => setShowPopup(false), 200)
|
setTimeout(() => setShowPopup(false), 200)
|
||||||
@@ -453,7 +470,10 @@ export default function RootLayout ({
|
|||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={
|
icon={
|
||||||
popupMode == 0 && selectedGame && pathname === '/'
|
(popupMode == 0 &&
|
||||||
|
selectedGame &&
|
||||||
|
pathname === '/') ||
|
||||||
|
viewingInfoFromDownloads
|
||||||
? faChevronLeft
|
? faChevronLeft
|
||||||
: faXmark
|
: faXmark
|
||||||
}
|
}
|
||||||
@@ -472,6 +492,16 @@ export default function RootLayout ({
|
|||||||
{getVersionGame(v.game)?.name} v
|
{getVersionGame(v.game)?.name} v
|
||||||
{v.versionName}
|
{v.versionName}
|
||||||
</p>
|
</p>
|
||||||
|
<button
|
||||||
|
className='button right-23 bottom-2'
|
||||||
|
onClick={() => {
|
||||||
|
setManagingVersion(v.id)
|
||||||
|
setViewingInfoFromDownloads(true)
|
||||||
|
setPopupMode(3)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon icon={faInfo} /> Info
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
className='button right-2 bottom-2'
|
className='button right-2 bottom-2'
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user