From 95e47a1e7952be68a3f60184aa6ba47b286250b2 Mon Sep 17 00:00:00 2001 From: Yuri Date: Mon, 5 Aug 2024 12:05:34 +0300 Subject: [PATCH] feat: remove SmartAvatar component --- .../SmartAvatar/SmartAvatar.component.tsx | 35 ------------------- 1 file changed, 35 deletions(-) delete mode 100644 src/components/SmartAvatar/SmartAvatar.component.tsx diff --git a/src/components/SmartAvatar/SmartAvatar.component.tsx b/src/components/SmartAvatar/SmartAvatar.component.tsx deleted file mode 100644 index c5fd44a3..00000000 --- a/src/components/SmartAvatar/SmartAvatar.component.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import React, { FC, useMemo } from 'react'; -import { useDeviceDetector, DeviceDetectorHookProps } from 'src/hooks/useDeviceDetector/use-device-detector.hook'; -import qs from 'qs'; -import { Avatar, AvatarProps } from '../Avatar'; - -export interface SmartAvatarProps extends AvatarProps, DeviceDetectorHookProps {} - -/** - * Detects the device performance and adjusts the avatar props accordingly - */ - -const SmartAvatar: FC = (props) => { - const deviceDetector = useDeviceDetector(props); - - const updatedProps: AvatarProps = useMemo(() => { - if (props.modelSrc instanceof Blob) { - return props; - } - const [modelUrl, originalQueryParams] = props.modelSrc.split('?'); - - const queryStringParams = { - ...qs.parse(originalQueryParams), - ...qs.parse(deviceDetector?.toQueryString() || '') - }; - - return { - ...props, - modelSrc: `${modelUrl}?${qs.stringify(queryStringParams)}` - }; - }, [props, deviceDetector]); - - return ; -}; - -export default SmartAvatar;