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