Improvements
This commit is contained in:
1 file changed
+19
-3
@@ -66,6 +66,21 @@ export default function GameDownloadsPage () {
|
|||||||
a.click()
|
a.click()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const replaceName = (id: string) => {
|
||||||
|
return id
|
||||||
|
.replace('windows-x86', 'Windows x86')
|
||||||
|
.replace('windows-x64', 'Windows x64')
|
||||||
|
.replace('windows-arm64', 'Windows ARM64')
|
||||||
|
.replace('macos-x64', 'MacOS x64')
|
||||||
|
.replace('macos-arm64', 'MacOS ARM64')
|
||||||
|
.replace('macos-universal', 'MacOS Universal')
|
||||||
|
.replace('linux-x86', 'Linux x86')
|
||||||
|
.replace('linux-x64', 'Linux x64')
|
||||||
|
.replace('linux-ARM64', 'Linux ARM64')
|
||||||
|
.replace('android', 'Android')
|
||||||
|
.replace('ios', 'iOS')
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='box'>
|
<div className='box'>
|
||||||
<HomeButton refLink={backButtonRef} />
|
<HomeButton refLink={backButtonRef} />
|
||||||
@@ -87,15 +102,16 @@ export default function GameDownloadsPage () {
|
|||||||
{Object.entries(v.downloads).map(([key, value]) => (
|
{Object.entries(v.downloads).map(([key, value]) => (
|
||||||
<button
|
<button
|
||||||
key={v.game + '-' + v.id + '-' + key}
|
key={v.game + '-' + v.id + '-' + key}
|
||||||
onClick={async () => {
|
onClick={async e => {
|
||||||
|
e.currentTarget.disabled = true
|
||||||
const result = await axios.get(
|
const result = await axios.get(
|
||||||
`/api/launcher/download?downloadId=${value}&versionId=${v.id}`
|
`/api/launcher/download?downloadId=${value}&versionId=${v.id}`
|
||||||
)
|
)
|
||||||
downloadFile(result.data.data.url)
|
downloadFile(result.data.data.url)
|
||||||
|
e.currentTarget.disabled = false
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{key.charAt(0).toUpperCase() +
|
{replaceName(key)}
|
||||||
key.slice(1).replace('-', ' ')}
|
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user