Disable download button when downloading

This commit is contained in:
2025-07-19 16:15:35 -07:00
parent 1349f779a0
commit 2604dec0f4
7 changed files with 20 additions and 19 deletions

View File

@@ -7,7 +7,7 @@ body {
} }
.button { .button {
@apply bg-[#0a6ec8] hover:bg-[#1361ad] rounded-md cursor-pointer text-[16px] py-1.5 px-3 transition-colors duration-[0.25s]; @apply bg-[#0a6ec8] hover:bg-[#1361ad] disabled:bg-[#124c7e] disabled:hover:bg-[#1b3f63] disabled:text-[#bdbdbd] disabled:hover:text-[#e6e6e6] rounded-md cursor-pointer text-[16px] py-1.5 px-3 transition-colors duration-[0.25s];
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
@@ -19,9 +19,6 @@ body {
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
@apply bg-[#555] w-1 rounded-lg; @apply bg-[#555] w-1 rounded-lg active:bg-[#888];
} }
::-webkit-scrollbar-thumb:active {
@apply bg-[#888];
}

View File

@@ -16,6 +16,7 @@ function App () {
...prev, ...prev,
...versions.map(v => new DownloadProgress(v, 0, false)) ...versions.map(v => new DownloadProgress(v, 0, false))
]) ])
return; return;
} }
@@ -33,7 +34,7 @@ function App () {
function renderContent () { function renderContent () {
if (hash === '#installs') { if (hash === '#installs') {
return <Installs downloadVersions={downloadVersions} /> return <Installs downloadVersions={downloadVersions} downloadProgress={downloadProgress} />
} else if (hash === '#settings') { } else if (hash === '#settings') {
return <Settings /> return <Settings />
} }

View File

@@ -6,7 +6,7 @@ import { LauncherVersion } from '../types/LauncherVersion'
import axios from 'axios' import axios from 'axios'
import { InstallsProps } from '../types/InstallsProps' import { InstallsProps } from '../types/InstallsProps'
export default function Installs({ downloadVersions }: InstallsProps) { export default function Installs({ downloadVersions, downloadProgress }: InstallsProps) {
const [showPopup, setShowPopup] = useState(false) const [showPopup, setShowPopup] = useState(false)
const [fadeOut, setFadeOut] = useState(false) const [fadeOut, setFadeOut] = useState(false)
const [versionList, setVersionList] = useState<null | LauncherVersion[]>(null); const [versionList, setVersionList] = useState<null | LauncherVersion[]>(null);
@@ -39,6 +39,7 @@ export default function Installs({ downloadVersions }: InstallsProps) {
<button <button
className='button text-3xl mt-4 absolute right-4 top-4' className='button text-3xl mt-4 absolute right-4 top-4'
onClick={downloadVersion} onClick={downloadVersion}
disabled={downloadProgress.length != 0}
> >
Download new version Download new version
</button> </button>

View File

@@ -1,4 +1,4 @@
import { LauncherVersion } from "./LauncherVersion"; import { LauncherVersion } from './LauncherVersion'
export class DownloadProgress { export class DownloadProgress {
constructor ( constructor (

View File

@@ -1,5 +1,7 @@
import { LauncherVersion } from "./LauncherVersion" import { DownloadProgress } from './DownloadProgress'
import { LauncherVersion } from './LauncherVersion'
export type InstallsProps = { export type InstallsProps = {
downloadVersions: (versions: LauncherVersion[]) => void downloadVersions: (versions: LauncherVersion[]) => void
downloadProgress: DownloadProgress[]
} }

View File

@@ -1,6 +1,6 @@
export interface LauncherVersion { export interface LauncherVersion {
version: string, version: string
displayName: string, displayName: string
platforms: string[], platforms: string[]
downloadUrls: string[] downloadUrls: string[]
} }

View File

@@ -1,4 +1,4 @@
import { DownloadProgress } from "./DownloadProgress" import { DownloadProgress } from './DownloadProgress'
export type SidebarProps = { export type SidebarProps = {
downloadProgress: DownloadProgress[] downloadProgress: DownloadProgress[]