refactor: more TS code
This commit is contained in:
@@ -40,9 +40,6 @@ const Avatar: FC<Props> = ({ url = "", name = "unknown name", type = "user", ...
|
||||
return <img src={src} onError={handleError} {...rest} />;
|
||||
};
|
||||
|
||||
export default memo(Avatar, (prevs, nexts) => {
|
||||
// const prevKey = prevs.url + prevs.name;
|
||||
// const nextKey = nexts.url + nexts.name;
|
||||
// return prevKey == nextKey;
|
||||
return prevs.url == nexts.url;
|
||||
export default memo(Avatar, (prev, next) => {
|
||||
return prev.url == next.url;
|
||||
});
|
||||
|
||||
@@ -5,6 +5,7 @@ import Avatar from "./Avatar";
|
||||
import useConfig from "../hook/useConfig";
|
||||
import { useAppSelector } from "../../app/store";
|
||||
import { FC } from "react";
|
||||
import { AgoraConfig } from "../../types/server";
|
||||
|
||||
const StyledWrapper = styled.div`
|
||||
background-color: #f4f4f5;
|
||||
@@ -79,7 +80,7 @@ const CurrentUser: FC<Props> = () => {
|
||||
<span className="id">#{uid}</span>
|
||||
</div>
|
||||
</div>
|
||||
{agoraConfig.enabled && (
|
||||
{(agoraConfig as AgoraConfig)?.enabled && (
|
||||
<div className="settings">
|
||||
<img src={soundIcon} className="icon" alt="mic icon" />
|
||||
<img src={micIcon} className="icon" alt="sound icon" />
|
||||
|
||||
@@ -7,7 +7,6 @@ const Styled = styled.div`
|
||||
border-radius: 6px;
|
||||
width: 370px;
|
||||
height: 66px;
|
||||
/* height: fit-content; */
|
||||
* {
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ const FileMessage: FC<Props> = ({
|
||||
});
|
||||
const { stopUploading, data, uploadFile, progress, isSuccess: uploadSuccess } = useUploadFile();
|
||||
const fromUser = useAppSelector((store) => store.users.byId[from_uid]);
|
||||
const { size, name, content_type } = properties ?? {};
|
||||
const { size = 0, name, content_type } = properties ?? {};
|
||||
useEffect(() => {
|
||||
const handleUpSend = async ({
|
||||
url,
|
||||
@@ -129,7 +129,6 @@ const FileMessage: FC<Props> = ({
|
||||
uploading={sending}
|
||||
progress={progress}
|
||||
properties={{ ...imageSize, ...properties }}
|
||||
size={size}
|
||||
content={content}
|
||||
download={download}
|
||||
thumbnail={thumbnail}
|
||||
@@ -142,7 +141,6 @@ const FileMessage: FC<Props> = ({
|
||||
<div className="info">
|
||||
<span className="name">{name}</span>
|
||||
<span className="details">
|
||||
{/* <Progress value={30} width={"80%"} /> */}
|
||||
{sending ? (
|
||||
<Progress value={progress} width={"80%"} />
|
||||
) : (
|
||||
@@ -158,7 +156,6 @@ const FileMessage: FC<Props> = ({
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
{/* <IconClose className="cancel" /> */}
|
||||
{sending ? (
|
||||
<IconClose className="cancel" onClick={handleCancel} />
|
||||
) : (
|
||||
|
||||
@@ -130,12 +130,7 @@ const ForwardModal: FC<IProps> = ({ mids, closeModal }) => {
|
||||
{selectedChannels.map((cid) => {
|
||||
return (
|
||||
<li key={cid} className="item">
|
||||
<Channel
|
||||
key={cid}
|
||||
id={cid}
|
||||
interactive={false}
|
||||
// avatarSize={40}
|
||||
/>
|
||||
<Channel key={cid} id={cid} interactive={false} />
|
||||
<CloseIcon
|
||||
className="remove"
|
||||
onClick={removeSelected.bind(null, cid, "channel")}
|
||||
@@ -146,12 +141,7 @@ const ForwardModal: FC<IProps> = ({ mids, closeModal }) => {
|
||||
{selectedMembers.map((uid) => {
|
||||
return (
|
||||
<li key={uid} className="item">
|
||||
<User
|
||||
key={uid}
|
||||
uid={uid}
|
||||
interactive={false}
|
||||
// avatarSize={40}
|
||||
/>
|
||||
<User key={uid} uid={uid} interactive={false} />
|
||||
<CloseIcon className="remove" onClick={removeSelected.bind(null, uid, "user")} />
|
||||
</li>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user