fix: should not show vulkan options in cpu only mode (#5210)

This commit is contained in:
Louis 2025-06-07 00:55:01 +07:00 committed by GitHub
parent c444643294
commit 1fa9f4e731
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -282,13 +282,17 @@ function Hardware() {
title="Usage" title="Usage"
actions={ actions={
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Progress {hardwareData.cpu?.usage > 0 && (
value={hardwareData.cpu?.usage} <>
className="h-2 w-10" <Progress
/> value={hardwareData.cpu?.usage}
<span className="text-main-view-fg/80"> className="h-2 w-10"
{hardwareData.cpu?.usage?.toFixed(2)}% />
</span> <span className="text-main-view-fg/80">
{hardwareData.cpu?.usage?.toFixed(2)}%
</span>
</>
)}
</div> </div>
} }
/> />
@ -316,49 +320,55 @@ function Hardware() {
title="Usage" title="Usage"
actions={ actions={
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Progress {hardwareData.ram?.total > 0 && (
value={ <>
((hardwareData.ram?.total - <Progress
hardwareData.ram?.available) / value={
hardwareData.ram?.total) * ((hardwareData.ram?.total -
100 hardwareData.ram?.available) /
} hardwareData.ram?.total) *
className="h-2 w-10" 100
/> }
<span className="text-main-view-fg/80"> className="h-2 w-10"
{( />
((hardwareData.ram?.total - <span className="text-main-view-fg/80">
hardwareData.ram?.available) / {(
hardwareData.ram?.total) * ((hardwareData.ram?.total -
100 hardwareData.ram?.available) /
).toFixed(2)} hardwareData.ram?.total) *
% 100
</span> ).toFixed(2)}
%
</span>
</>
)}
</div> </div>
} }
/> />
</Card> </Card>
{/* Vulkan Settings */} {/* Vulkan Settings */}
<Card title="Vulkan"> {hardwareData.gpus.length > 0 && (
<CardItem <Card title="Vulkan">
title="Enable Vulkan" <CardItem
description="Enable Vulkan API for GPU acceleration" title="Enable Vulkan"
actions={ description="Enable Vulkan API for GPU acceleration"
<div className="flex items-center gap-4"> actions={
<Switch <div className="flex items-center gap-4">
checked={vulkanEnabled} <Switch
onCheckedChange={(checked) => { checked={vulkanEnabled}
setVulkanEnabled(checked) onCheckedChange={(checked) => {
setTimeout(() => { setVulkanEnabled(checked)
window.location.reload() setTimeout(() => {
}, 500) // Reload after 500ms to apply changes window.location.reload()
}} }, 500) // Reload after 500ms to apply changes
/> }}
</div> />
} </div>
/> }
</Card> />
</Card>
)}
{/* GPU Information */} {/* GPU Information */}
<Card title="GPUs"> <Card title="GPUs">