fix: placeholder no hardware detect (#3873)

This commit is contained in:
Faisal Amir 2024-10-24 09:05:44 +07:00 committed by GitHub
parent 0c78aadf1e
commit 037357e04c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -211,6 +211,9 @@ const Advanced = () => {
saveSettings({ gpusInUse: updatedGpusInUse })
}
const gpuSelectionPlaceHolder =
gpuList.length > 0 ? 'Select GPU' : "You don't have any compatible GPU"
/**
* Handle click outside
*/
@ -322,13 +325,20 @@ const Advanced = () => {
<div className="relative w-full md:w-1/2" ref={setToggle}>
<Input
value={selectedGpu.join() || ''}
className="w-full cursor-pointer"
className={twMerge(
'w-full cursor-pointer',
gpuList.length === 0 && 'pointer-events-none'
)}
readOnly
placeholder=""
disabled={gpuList.length === 0}
placeholder={gpuSelectionPlaceHolder}
suffixIcon={
<ChevronDownIcon
size={14}
className={twMerge(open && 'rotate-180')}
className={twMerge(
gpuList.length === 0 && 'pointer-events-none',
open && 'rotate-180'
)}
/>
}
onClick={() => setOpen(!open)}