Add a refresh button
This commit is contained in:
3 files changed
+61
-5
No files matched your search
+2
-2
@@ -130,8 +130,8 @@ body {
|
||||
@apply absolute;
|
||||
}
|
||||
|
||||
.close-button {
|
||||
@apply flex justify-center items-center absolute text-2xl text-gray-200 hover:text-white cursor-pointer h-12 w-12 p-3 rounded-lg left-2 top-2 transition-colors border;
|
||||
.popup-top-button {
|
||||
@apply flex justify-center items-center absolute text-2xl text-gray-200 hover:text-white cursor-pointer h-12 w-12 p-3 rounded-lg top-2 transition-colors border;
|
||||
}
|
||||
|
||||
*:focus {
|
||||
|
||||
+1
-1
@@ -695,7 +695,7 @@ export default function RootLayout ({
|
||||
>
|
||||
<div className='popup-box'>
|
||||
<button
|
||||
className='close-button btntheme1'
|
||||
className='popup-top-button left-2 btntheme1'
|
||||
onClick={() => closePopup()}
|
||||
>
|
||||
<FontAwesomeIcon
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
import { useGlobal } from '@/app/GlobalProvider'
|
||||
import { verifySignature } from '@/lib/Util'
|
||||
import { Mod } from '@/types/Mod'
|
||||
import { faDownload, faGlobe } from '@fortawesome/free-solid-svg-icons'
|
||||
import {
|
||||
faDownload,
|
||||
faGlobe,
|
||||
faRefresh
|
||||
} from '@fortawesome/free-solid-svg-icons'
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||
import { arch, platform } from '@tauri-apps/plugin-os'
|
||||
import { useEffect, useState } from 'react'
|
||||
@@ -41,6 +45,25 @@ export default function ModDownloadsPopup () {
|
||||
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
className='popup-top-button btntheme1 right-2'
|
||||
onClick={async () => {
|
||||
setMods(0)
|
||||
const response = await fetch(
|
||||
`https://games.lncvrt.xyz/api/launcher/mods?platform=${platform()}&arch=${arch()}&version=${managingVersion}`
|
||||
)
|
||||
const signature = response.headers.get('x-signature') ?? ''
|
||||
const data = await response.json()
|
||||
if (await verifySignature(JSON.stringify(data), signature)) {
|
||||
setMods(data as Mod[])
|
||||
} else {
|
||||
setMods(1)
|
||||
}
|
||||
}}
|
||||
hidden={typeof mods == 'number'}
|
||||
>
|
||||
<FontAwesomeIcon icon={faRefresh} />
|
||||
</button>
|
||||
<p className='text-xl text-center'>
|
||||
{versionInfo?.displayName} Mod Manager
|
||||
</p>
|
||||
@@ -70,7 +93,40 @@ export default function ModDownloadsPopup () {
|
||||
) : (
|
||||
<div className='flex flex-col items-center justify-center gap-2 p-2'>
|
||||
{tab == 0
|
||||
? null
|
||||
? mods
|
||||
.filter(
|
||||
v =>
|
||||
!downloadedVersionsConfig ||
|
||||
Object.keys(downloadedVersionsConfig.mods).includes(
|
||||
String(v.id)
|
||||
)
|
||||
)
|
||||
.map(v => {
|
||||
return (
|
||||
<div
|
||||
key={v.id}
|
||||
className='bg-(--col3) border border-(--col5) rounded-lg w-full h-16 flex flex-row'
|
||||
>
|
||||
<div className='flex flex-col justify-center h-full px-3 w-fit'>
|
||||
<p>
|
||||
<span className='text-lg'>{v.name}</span>{' '}
|
||||
<span className='text-green-300'>
|
||||
v{v.latestVersion}
|
||||
</span>
|
||||
</p>
|
||||
<p className='text-yellow-200'>
|
||||
Made by {v.creators[0]}
|
||||
{v.creators.length > 1
|
||||
? ' + ' + (v.creators.length - 1) + ' more'
|
||||
: null}
|
||||
</p>
|
||||
</div>
|
||||
<div className='flex items-center h-full gap-2 px-3 ml-auto'>
|
||||
<button className='button btntheme3'>View</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
: mods
|
||||
.filter(
|
||||
v =>
|
||||
|
||||
Reference in new issue
Block a user