Removed unused functions & fixed warning
This commit is contained in:
1 parent
31e4c7b110
commit
b94d1021c2
2 files changed
+4
-24
No files matched your search
@@ -2,7 +2,6 @@ import { Avatar as MuiAvatar } from "@mui/material";
|
|||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { bufferTo64, bufferToUrl } from "../../Utils/fileUtils";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @component
|
* @component
|
||||||
@@ -32,7 +31,6 @@ const Avatar = ({ src, small, sx }) => {
|
|||||||
return (
|
return (
|
||||||
<MuiAvatar
|
<MuiAvatar
|
||||||
alt={`${user?.firstname} ${user?.lastname}`}
|
alt={`${user?.firstname} ${user?.lastname}`}
|
||||||
children={`${user.firstname?.charAt(0)}${user.lastname?.charAt(0)}`}
|
|
||||||
src={
|
src={
|
||||||
src ? src : user?.avatarImage ? image : "/static/images/avatar/2.jpg"
|
src ? src : user?.avatarImage ? image : "/static/images/avatar/2.jpg"
|
||||||
}
|
}
|
||||||
@@ -52,7 +50,9 @@ const Avatar = ({ src, small, sx }) => {
|
|||||||
...style,
|
...style,
|
||||||
...sx,
|
...sx,
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
|
{user.firstname?.charAt(0)}{user.lastname?.charAt(0)}
|
||||||
|
</MuiAvatar>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,24 +8,4 @@ export const checkImage = (url) => {
|
|||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.src = url;
|
img.src = url;
|
||||||
return img.naturalWidth !== 0;
|
return img.naturalWidth !== 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const bufferTo64 = (bufferData) => {
|
|
||||||
const uint8Array = new Uint8Array(bufferData.data);
|
|
||||||
const blob = new Blob([uint8Array], { type: bufferData.contentType });
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
const reader = new FileReader();
|
|
||||||
reader.onloadend = () => {
|
|
||||||
resolve(reader.result);
|
|
||||||
};
|
|
||||||
reader.readAsDataURL(blob);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const bufferToUrl = (buffer) => {
|
|
||||||
console.log(buffer);
|
|
||||||
const blob = new Blob([buffer.data], { type: buffer.contentType });
|
|
||||||
const url = URL.createObjectURL(blob);
|
|
||||||
|
|
||||||
return url;
|
|
||||||
};
|
|
||||||
Reference in new issue
Block a user