Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const {
user: {
actions: { onCloseSigninModal, onInitSession, onLogout }
},
requestHelpers: { auth, initSession, uploadFileOnChat }
} = useAppContext();
const { signinModalShown, username } = useMyState();
const {
actions: {
onPostFileUploadStatus,
onPostUploadComplete,
onResetChat,
onSendFirstDirectMessage,
onUpdateClientToApiServerProgress
}
} = useChatContext();
const {
actions: { onInitContent }
} = useContentContext();
const {
state: { updateDetail, updateNoticeShown }
} = useNotiContext();
const {
state: { pageVisible },
actions: { onChangePageVisibility }
} = useViewContext();
const [mobileMenuShown, setMobileMenuShown] = useState(false);
const visibilityChangeRef = useRef(null);
const hiddenRef = useRef(null);
const authRef = useRef(null);
const mounted = useRef(true);
onCreateNewChannel,
onEnterChannelWithId,
onEnterEmptyChat,
onLoadMoreChannels,
onLoadMoreMessages,
onNotifyThatMemberLeftChannel,
onOpenDirectMessageChannel,
onReceiveMessage,
onReceiveMessageOnDifferentChannel,
onSendFirstDirectMessage,
onSetReplyTarget,
onSubmitMessage,
onUpdateChessMoveViewTimeStamp,
onUpdateSelectedChannelId
}
} = useChatContext();
const {
state: { pageVisible }
} = useViewContext();
const [
currentChannelOnlineMembers,
setCurrentChannelOnlineMembers
] = useState([]);
const [createNewChannelModalShown, setCreateNewChannelModalShown] = useState(
false
);
const [userListModalShown, setUserListModalShown] = useState(false);
const [chessModalShown, setChessModalShown] = useState(false);
const [chessCountdownObj, setChessCountdownObj] = useState({});
const [channelName, setChannelName] = useState('');
const [partner, setPartner] = useState(null);
const [creatingNewDMChannel, setCreatingNewDMChannel] = useState(false);
onClearNumUnreads,
onCreateNewChannel,
onEnterChannelWithId,
onEnterEmptyChat,
onLoadMoreChannels,
onLoadMoreMessages,
onNotifyThatMemberLeftChannel,
onOpenDirectMessageChannel,
onReceiveMessage,
onReceiveMessageOnDifferentChannel,
onSendFirstDirectMessage,
onSubmitMessage,
onUpdateChessMoveViewTimeStamp,
onUpdateSelectedChannelId
}
} = useChatContext();
const {
state: { pageVisible }
} = useViewContext();
const [channelLoading, setChannelLoading] = useState(false);
const [
currentChannelOnlineMembers,
setCurrentChannelOnlineMembers
] = useState([]);
const [createNewChannelModalShown, setCreateNewChannelModalShown] = useState(
false
);
const [userListModalShown, setUserListModalShown] = useState(false);
const [chessModalShown, setChessModalShown] = useState(false);
const [chessCountdownObj, setChessCountdownObj] = useState({});
const [channelName, setChannelName] = useState('');
const [partner, setPartner] = useState(null);
onSetActualDescription,
onSetActualTitle,
onSetSiteUrl,
onSetThumbUrl
}
} = useContentContext();
const {
state: { reconnecting },
actions: {
onEditMessage,
onSaveMessage,
onSetReplyTarget,
onUpdateChessMoveViewTimeStamp,
onUpdateRecentChessMessage
}
} = useChatContext();
const {
state: { socketConnected }
} = useNotiContext();
let { username, profilePicId, targetMessage, ...post } = message;
const [extractedUrl, setExtractedUrl] = useState('');
const [onEdit, setOnEdit] = useState(false);
const [editPadding, setEditPadding] = useState(false);
const [spoilerOff, setSpoilerOff] = useState(false);
if (fileToUpload && !userId) {
userId = myId;
username = myUsername;
profilePicId = myProfilePicId;
}
useEffect(() => {
if (!message.id && message.isChessMsg) {
onUpdateRecentChessMessage(message);