Skip to content

Commit

Permalink
Hide GPU setting when it is not available (#1959)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiaMineJP committed Jul 31, 2023
1 parent f9a4974 commit f0c5ebb
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/gui/src/components/settings/SettingsHarvester.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ServiceName, HarvesterConfig } from '@chia-network/api';
import {
useGetHarvesterConfigQuery,
useGetPlottersQuery,
useUpdateHarvesterConfigMutation,
useClientStartServiceMutation,
useClientStopServiceMutation,
Expand All @@ -14,6 +15,7 @@ import React from 'react';
const messageAnchorOrigin = { vertical: 'bottom' as const, horizontal: 'center' as const };

export default function SettingsHarvester() {
const { data: plotters } = useGetPlottersQuery();
const { data, isLoading } = useGetHarvesterConfigQuery();
const [updateHarvesterConfig, { isLoading: isUpdating }] = useUpdateHarvesterConfigMutation();
const [startService, { isLoading: isStarting }] = useClientStartServiceMutation();
Expand Down Expand Up @@ -351,6 +353,17 @@ export default function SettingsHarvester() {
[configUpdateRequests]
);

const gpuOptionStyle = React.useMemo(
() =>
!plotters ||
!plotters.bladebit_cuda ||
!plotters.bladebit_cuda.installInfo.cudaSupport ||
configUpdateRequests.parallelDecompressorCount === 0
? { display: 'none' }
: undefined,
[configUpdateRequests, plotters]
);

return (
<Grid container style={{ maxWidth: '624px' }} gap={3}>
<Grid item>
Expand Down Expand Up @@ -473,7 +486,7 @@ export default function SettingsHarvester() {
</Grid>
</Grid>

<Grid container sx={compressionOptionStyle}>
<Grid container sx={gpuOptionStyle}>
<Grid item style={{ width: '400px' }}>
<SettingsTitle>
<Trans>Enable GPU Harvesting</Trans>
Expand All @@ -489,7 +502,7 @@ export default function SettingsHarvester() {
</Grid>
</Grid>

<Grid container sx={compressionOptionStyle}>
<Grid container sx={gpuOptionStyle}>
<Grid item style={{ width: '400px' }}>
<SettingsTitle>
<Trans>GPU Device Index</Trans>
Expand Down

0 comments on commit f0c5ebb

Please sign in to comment.