chore: remove comments

This commit is contained in:
Tristan Yang
2022-09-02 21:28:37 +08:00
parent 0c431f325a
commit 9b52b4423f
11 changed files with 6 additions and 23 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import { FC } from "react"; import { FC, memo } from "react";
import { NavLink } from "react-router-dom"; import { NavLink } from "react-router-dom";
import Tippy from "@tippyjs/react"; import Tippy from "@tippyjs/react";
import IconMessage from "../../../assets/icons/message.svg"; import IconMessage from "../../../assets/icons/message.svg";
@@ -110,4 +110,4 @@ const Profile: FC<Props> = ({ uid, type = "embed", cid }) => {
); );
}; };
export default Profile; export default memo(Profile);
+1 -2
View File
@@ -13,14 +13,12 @@ const GuestAllows = GuestRoutes.map((path) => {
return { path }; return { path };
}); });
const RequireAuth: FC<Props> = ({ children, redirectTo = "/login" }) => { const RequireAuth: FC<Props> = ({ children, redirectTo = "/login" }) => {
// GuestRoutes
const location = useLocation(); const location = useLocation();
const matchs = matchRoutes(GuestAllows, location); const matchs = matchRoutes(GuestAllows, location);
const allowGuest = matchs ? !!matchs[0].pathname : false; const allowGuest = matchs ? !!matchs[0].pathname : false;
const { data: loginConfig, isLoading: fetchingLoginConfig } = useGetLoginConfigQuery(); const { data: loginConfig, isLoading: fetchingLoginConfig } = useGetLoginConfigQuery();
const { isLoading: checkingInitial } = useGetInitializedQuery(); const { isLoading: checkingInitial } = useGetInitializedQuery();
const { token, guest, initialized } = useAppSelector((store) => store.authData); const { token, guest, initialized } = useAppSelector((store) => store.authData);
// console.log("authhhhh", allowGuest);
// 初始化和login配置检查 // 初始化和login配置检查
if (checkingInitial || fetchingLoginConfig) return null; if (checkingInitial || fetchingLoginConfig) return null;
@@ -30,6 +28,7 @@ const RequireAuth: FC<Props> = ({ children, redirectTo = "/login" }) => {
if (loginConfig?.guest && !token && allowGuest) return <Navigate to={"/guest_login"} replace />; if (loginConfig?.guest && !token && allowGuest) return <Navigate to={"/guest_login"} replace />;
// 登陆者是guest,并且不允许访问 // 登陆者是guest,并且不允许访问
if (token && guest && !allowGuest) return <Navigate to={"/"} replace />; if (token && guest && !allowGuest) return <Navigate to={"/"} replace />;
// console.log("authhhhh", allowGuest, token, guest);
return token ? children : <Navigate to={redirectTo} replace />; return token ? children : <Navigate to={redirectTo} replace />;
}; };
@@ -63,7 +63,6 @@ const handler = (data: ChatEvent, dispatch: AppDispatch, currState: CurrentState
// 如果是自己发的消息,就是已读 // 如果是自己发的消息,就是已读
dispatch(addMessage({ mid, read, ...common })); dispatch(addMessage({ mid, read, ...common }));
// 未推送完 or 不是自己发的消息 // 未推送完 or 不是自己发的消息
// console.log("curr state", ready, loginUid, common.from_uid);
// if (!ready || loginUid != common.from_uid) { // if (!ready || loginUid != common.from_uid) {
dispatch( dispatch(
appendMessage({ appendMessage({
-1
View File
@@ -41,7 +41,6 @@ const NavItem: FC<IProps> = ({ uid, mid = 0, unreads, setFiles }) => {
accept: [NativeTypes.FILE], accept: [NativeTypes.FILE],
drop({ dataTransfer }) { drop({ dataTransfer }) {
if (dataTransfer.files.length) { if (dataTransfer.files.length) {
// console.log(files, rest);
setFiles([...dataTransfer.files]); setFiles([...dataTransfer.files]);
navigate(`/chat/dm/${uid}`); navigate(`/chat/dm/${uid}`);
// 重置 // 重置
-1
View File
@@ -23,7 +23,6 @@ const LoadMore: FC<Props> = ({ pullUp = null }) => {
// const currEle = entry.target; // const currEle = entry.target;
if (intersecting && pullUp) { if (intersecting && pullUp) {
// load more // load more
// console.log("inview");
pullUp(); pullUp();
} }
}); });
@@ -49,7 +49,6 @@ const SessionContextMenu: FC<Props> = ({
}; };
const handleReadAll = () => { const handleReadAll = () => {
// console.log("last mid", mids, lastMid);
if (mid) { if (mid) {
const param = const param =
context == "user" ? { users: [{ uid: +id, mid }] } : { groups: [{ gid: +id, mid }] }; context == "user" ? { users: [{ uid: +id, mid }] } : { groups: [{ gid: +id, mid }] };
-1
View File
@@ -35,7 +35,6 @@ const Session: FC<IProps> = ({
accept: [NativeTypes.FILE], accept: [NativeTypes.FILE],
drop({ files }) { drop({ files }) {
if (files.length) { if (files.length) {
// console.log(files, rest);
const filesData = files.map((file) => { const filesData = files.map((file) => {
const { size, type, name } = file; const { size, type, name } = file;
const url = URL.createObjectURL(file); const url = URL.createObjectURL(file);
-2
View File
@@ -30,7 +30,6 @@ export default function HomePage() {
} = useAppSelector((store) => { } = useAppSelector((store) => {
return { return {
ui: store.ui, ui: store.ui,
loginUid: store.authData.user?.uid, loginUid: store.authData.user?.uid,
guest: store.authData.guest guest: store.authData.guest
}; };
@@ -87,7 +86,6 @@ export default function HomePage() {
</Tooltip> </Tooltip>
</NavLink> </NavLink>
</nav> </nav>
{/* <div className="divider"></div> */}
<Menu /> <Menu />
</div> </div>
)} )}
@@ -41,7 +41,6 @@ const ProfileBasicEditModal: FC<Props> = ({
closeModal closeModal
}) => { }) => {
const [input, setInput] = useState(value); const [input, setInput] = useState(value);
// const dispatch = useDispatch();
const [update, { isLoading, isSuccess }] = useUpdateInfoMutation(); const [update, { isLoading, isSuccess }] = useUpdateInfoMutation();
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => { const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
setInput(evt.target.value); setInput(evt.target.value);
@@ -13,7 +13,6 @@ interface Props {
const DeleteConfirmModal: FC<Props> = ({ id, closeModal }) => { const DeleteConfirmModal: FC<Props> = ({ id, closeModal }) => {
const navigateTo = useNavigate(); const navigateTo = useNavigate();
// const pathMatched = useMatch(`/chat/channel/${id}`);
const [deleteChannel, { isLoading, isSuccess }] = useLazyRemoveChannelQuery(); const [deleteChannel, { isLoading, isSuccess }] = useLazyRemoveChannelQuery();
const handleDelete = () => { const handleDelete = () => {
deleteChannel(id); deleteChannel(id);
@@ -44,7 +43,6 @@ const DeleteConfirmModal: FC<Props> = ({ id, closeModal }) => {
</Button> </Button>
</> </>
} }
// className="animate__animated animate__fadeInDown animate__faster"
></StyledModal> ></StyledModal>
</Modal> </Modal>
); );
+3 -9
View File
@@ -40,15 +40,9 @@ export default function UsersPage() {
</nav> </nav>
</div> </div>
</div> </div>
{user_id ? ( <div className={`right ${!user_id ? "placeholder" : ""}`}>
<div className="right"> {user_id ? <Profile uid={+user_id} /> : <BlankPlaceholder type="user" />}
<Profile uid={+user_id} /> </div>
</div>
) : (
<div className="right placeholder">
<BlankPlaceholder type="user" />
</div>
)}
</StyledWrapper> </StyledWrapper>
); );
} }