refactor: rename contact with user
This commit is contained in:
@@ -24,7 +24,7 @@ interface Props {
|
||||
|
||||
const User: FC<Props> = ({ uid }) => {
|
||||
const { pathname } = useLocation();
|
||||
const user = useAppSelector((store) => store.contacts.byId[uid]);
|
||||
const user = useAppSelector((store) => store.users.byId[uid]);
|
||||
if (!user) return null;
|
||||
|
||||
return (
|
||||
|
||||
@@ -13,7 +13,7 @@ import Notification from "../../common/component/Notification";
|
||||
import Manifest from "../../common/component/Manifest";
|
||||
|
||||
import ChatIcon from "../../assets/icons/chat.svg";
|
||||
import ContactIcon from "../../assets/icons/contact.svg";
|
||||
import ContactIcon from "../../assets/icons/user.svg";
|
||||
import FavIcon from "../../assets/icons/bookmark.svg";
|
||||
import FolderIcon from "../../assets/icons/folder.svg";
|
||||
import { useAppSelector } from "../../app/store";
|
||||
@@ -27,7 +27,7 @@ export default function HomePage() {
|
||||
loginUid,
|
||||
ui: {
|
||||
ready,
|
||||
remeberedNavs: { chat: chatPath, contact: contactPath }
|
||||
remeberedNavs: { chat: chatPath, user: userPath }
|
||||
}
|
||||
} = useAppSelector((store) => {
|
||||
return {
|
||||
@@ -52,7 +52,7 @@ export default function HomePage() {
|
||||
}
|
||||
// 有点绕
|
||||
const chatNav = isChatHomePath ? "/chat" : chatPath || "/chat";
|
||||
const contactNav = contactPath || "/contacts";
|
||||
const userNav = userPath || "/users";
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -72,7 +72,7 @@ export default function HomePage() {
|
||||
<ChatIcon />
|
||||
</Tooltip>
|
||||
</NavLink>
|
||||
<NavLink className="link" to={contactNav}>
|
||||
<NavLink className="link" to={userNav}>
|
||||
<Tooltip tip="Members">
|
||||
<ContactIcon />
|
||||
</Tooltip>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect } from "react";
|
||||
import initCache, { useRehydrate } from "../../app/cache";
|
||||
import { useLazyGetFavoritesQuery } from "../../app/services/message";
|
||||
import { useLazyGetContactsQuery } from "../../app/services/contact";
|
||||
import { useLazyGetContactsQuery } from "../../app/services/user";
|
||||
import { useLazyGetServerQuery } from "../../app/services/server";
|
||||
import useStreaming from "../../common/hook/useStreaming";
|
||||
import { useAppSelector } from "../../app/store";
|
||||
@@ -27,12 +27,7 @@ export default function usePreload() {
|
||||
] = useLazyGetFavoritesQuery();
|
||||
const [
|
||||
getContacts,
|
||||
{
|
||||
isLoading: contactsLoading,
|
||||
isSuccess: contactsSuccess,
|
||||
isError: contactsError,
|
||||
data: contacts
|
||||
}
|
||||
{ isLoading: usersLoading, isSuccess: usersSuccess, isError: usersError, data: users }
|
||||
] = useLazyGetContactsQuery();
|
||||
const [
|
||||
getServer,
|
||||
@@ -61,11 +56,11 @@ export default function usePreload() {
|
||||
}, [canStreaming]);
|
||||
|
||||
return {
|
||||
loading: contactsLoading || serverLoading || favoritesLoading || !rehydrated,
|
||||
error: contactsError && serverError && favoritesError,
|
||||
success: contactsSuccess && serverSuccess && favoritesSuccess,
|
||||
loading: usersLoading || serverLoading || favoritesLoading || !rehydrated,
|
||||
error: usersError && serverError && favoritesError,
|
||||
success: usersSuccess && serverSuccess && favoritesSuccess,
|
||||
data: {
|
||||
contacts,
|
||||
users,
|
||||
server,
|
||||
favorites
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user