From 5783fa8445d0960d0e44911744fbc7b60487ae09 Mon Sep 17 00:00:00 2001 From: Yuri Date: Fri, 2 Aug 2024 10:58:48 +0300 Subject: [PATCH] feat(smartAvatar): ACT-759 refactor --- .../use-device-detector.hook.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hooks/useDeviceDetector/use-device-detector.hook.ts b/src/hooks/useDeviceDetector/use-device-detector.hook.ts index e0d6156c..04a6154b 100644 --- a/src/hooks/useDeviceDetector/use-device-detector.hook.ts +++ b/src/hooks/useDeviceDetector/use-device-detector.hook.ts @@ -17,24 +17,24 @@ const TIER_PRESETS: TierPresets = { }; type DeviceDetectorServiceProps = { - gpuTierResults: TierResult; + gpuTierResult: TierResult; tierPresets?: TierPresets; }; class DeviceDetectorService { private tierPresets: TierPresets = TIER_PRESETS; - private gpuTierResults: TierResult; + private gpuTierResult: TierResult; constructor(props: DeviceDetectorServiceProps) { - this.gpuTierResults = props.gpuTierResults; + this.gpuTierResult = props.gpuTierResult; if (props.tierPresets) { this.tierPresets = props.tierPresets; } } toQueryString() { - return stringify(this.tierPresets[this.gpuTierResults.tier]); + return stringify(this.tierPresets[this.gpuTierResult.tier]); } } @@ -47,13 +47,13 @@ export function useDeviceDetector(options?: DeviceDetectorHookProps) { useEffect(() => { const fetchDeviceDetector = async () => { - const gpuTier = await getGPUTier(); + const gpuTierResult = await getGPUTier(); - if (gpuTier.type !== 'BENCHMARK') { - gpuTier.tier = 3; + if (gpuTierResult.type !== 'BENCHMARK') { + gpuTierResult.tier = 3; } - setDeviceDetector(new DeviceDetectorService({ gpuTierResults: gpuTier, tierPresets: options?.tierPresets })); + setDeviceDetector(new DeviceDetectorService({ gpuTierResult, ...options })); }; fetchDeviceDetector(); }, []);