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