Rename this to make more sense
This commit is contained in:
@@ -28,7 +28,7 @@ type GlobalCtxType = {
|
||||
setManagingVersion: (v: string | null) => void
|
||||
setSelectedGame: (v: number | null) => void
|
||||
getVersionInfo: (id: string | undefined) => GameVersion | undefined
|
||||
getVersionGame: (id: number | undefined) => Game | undefined
|
||||
getGameInfo: (id: number | undefined) => Game | undefined
|
||||
getListOfGames: () => Game[]
|
||||
getVersionsAmountData: (gameId: number) => {
|
||||
installed: number
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useGlobal } from '../GlobalProvider'
|
||||
|
||||
export default function VersionChangelog () {
|
||||
const {
|
||||
getVersionGame,
|
||||
getGameInfo,
|
||||
getVersionInfo,
|
||||
managingVersion,
|
||||
downloadedVersionsConfig
|
||||
@@ -12,7 +12,7 @@ export default function VersionChangelog () {
|
||||
if (!managingVersion || !downloadedVersionsConfig) return <></>
|
||||
|
||||
const versionInfo = getVersionInfo(managingVersion)
|
||||
const gameInfo = getVersionGame(versionInfo?.game)
|
||||
const gameInfo = getGameInfo(versionInfo?.game)
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -17,7 +17,7 @@ import prettyBytes from 'pretty-bytes'
|
||||
|
||||
export default function VersionInfo () {
|
||||
const {
|
||||
getVersionGame,
|
||||
getGameInfo,
|
||||
getVersionInfo,
|
||||
managingVersion,
|
||||
downloadedVersionsConfig,
|
||||
@@ -27,7 +27,7 @@ export default function VersionInfo () {
|
||||
if (!managingVersion || !downloadedVersionsConfig) return <></>
|
||||
|
||||
const versionInfo = getVersionInfo(managingVersion)
|
||||
const gameInfo = getVersionGame(versionInfo?.game)
|
||||
const gameInfo = getGameInfo(versionInfo?.game)
|
||||
const [versionSize, setVersionSize] = useState<number | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -19,7 +19,7 @@ export default function Installs () {
|
||||
normalConfig,
|
||||
setManagingVersion,
|
||||
getVersionInfo,
|
||||
getVersionGame,
|
||||
getGameInfo,
|
||||
setSelectedGame
|
||||
} = useGlobal()
|
||||
|
||||
@@ -103,7 +103,7 @@ export default function Installs () {
|
||||
>
|
||||
<div className='h-18 w-screen relative'>
|
||||
<p className='text-2xl'>
|
||||
{getVersionGame(getVersionInfo(entry)?.game)?.name} v
|
||||
{getGameInfo(getVersionInfo(entry)?.game)?.name} v
|
||||
{getVersionInfo(entry)?.versionName}
|
||||
</p>
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ export default function RootLayout ({
|
||||
return serverVersionList?.versions.find(v => v.id === id)
|
||||
}
|
||||
|
||||
function getVersionGame (game: number | undefined): Game | undefined {
|
||||
function getGameInfo (game: number | undefined): Game | undefined {
|
||||
if (!game) return undefined
|
||||
return serverVersionList?.games.find(g => g.id === game)
|
||||
}
|
||||
@@ -255,7 +255,7 @@ export default function RootLayout ({
|
||||
downloadedVersionsConfig.list.forEach(i => {
|
||||
const version = getVersionInfo(i)
|
||||
if (!version) return
|
||||
const game = getVersionGame(version.game)
|
||||
const game = getGameInfo(version.game)
|
||||
if (!game) return
|
||||
gamesMap.set(game.id, game)
|
||||
})
|
||||
@@ -282,7 +282,7 @@ export default function RootLayout ({
|
||||
)
|
||||
return
|
||||
}
|
||||
const gameInfo = getVersionGame(info.game)
|
||||
const gameInfo = getGameInfo(info.game)
|
||||
if (!gameInfo) {
|
||||
setDownloadProgress(prev =>
|
||||
prev.filter(d => d.version !== download.version)
|
||||
@@ -343,11 +343,11 @@ export default function RootLayout ({
|
||||
if (!downloadedVersionsConfig || !serverVersionList) return null
|
||||
|
||||
const installed = downloadedVersionsConfig.list.filter(
|
||||
v => getVersionGame(getVersionInfo(v)?.game)?.id === gameId
|
||||
v => getGameInfo(getVersionInfo(v)?.game)?.id === gameId
|
||||
).length
|
||||
|
||||
const total = serverVersionList.versions.filter(
|
||||
v => getVersionGame(v?.game)?.id === gameId
|
||||
v => getGameInfo(v?.game)?.id === gameId
|
||||
).length
|
||||
|
||||
return { installed, total }
|
||||
@@ -427,7 +427,7 @@ export default function RootLayout ({
|
||||
managingVersion,
|
||||
setManagingVersion,
|
||||
getVersionInfo,
|
||||
getVersionGame,
|
||||
getGameInfo,
|
||||
getListOfGames,
|
||||
setSelectedGame,
|
||||
getVersionsAmountData,
|
||||
@@ -520,7 +520,7 @@ export default function RootLayout ({
|
||||
: 'max-w-87.5'
|
||||
}`}
|
||||
>
|
||||
{getVersionGame(v.game)?.name} v
|
||||
{getGameInfo(v.game)?.name} v
|
||||
{v.versionName}
|
||||
</p>
|
||||
</div>
|
||||
@@ -665,7 +665,7 @@ export default function RootLayout ({
|
||||
>
|
||||
<p className='text-2xl text-center'>
|
||||
{
|
||||
getVersionGame(
|
||||
getGameInfo(
|
||||
getVersionInfo(v.version)?.game
|
||||
)?.name
|
||||
}{' '}
|
||||
@@ -752,7 +752,7 @@ export default function RootLayout ({
|
||||
<p className='text-xl text-center'>
|
||||
Manage{' '}
|
||||
{
|
||||
getVersionGame(
|
||||
getGameInfo(
|
||||
getVersionInfo(managingVersion)?.game
|
||||
)?.name
|
||||
}{' '}
|
||||
@@ -825,7 +825,7 @@ export default function RootLayout ({
|
||||
selectedVersionList.length
|
||||
} version${
|
||||
selectedVersionList.length == 1 ? '' : 's'
|
||||
} of ${getVersionGame(selectedGame)?.name}`
|
||||
} of ${getGameInfo(selectedGame)?.name}`
|
||||
}
|
||||
>
|
||||
Download {selectedVersionList.length} version
|
||||
|
||||
Reference in New Issue
Block a user