Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed navigation after opening a chat that is not available to you #44

Merged
merged 50 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
bc1fb99
repalce nav in chatlist, create more folders for styles
Oleksandr1414 Sep 12, 2023
40de698
create chat btn replaced, cleanup chatlist and main css files
Oleksandr1414 Sep 12, 2023
0632c66
chatform css file updated
Oleksandr1414 Sep 12, 2023
acaeaef
update login and signup css file
Oleksandr1414 Sep 13, 2023
45a4367
add navigation logic for mobile device
Oleksandr1414 Sep 13, 2023
a31e8f5
ChatList and ChatForm cleanup
Oleksandr1414 Sep 13, 2023
2a06ffc
fix key press problem after open chat list
Oleksandr1414 Sep 13, 2023
21c8c41
user search form and style updated
Oleksandr1414 Sep 13, 2023
8ba54a9
user search cleanup
Oleksandr1414 Sep 13, 2023
63aa8a3
move isMobileView in redux
Oleksandr1414 Sep 13, 2023
bd36cd8
Merge branch 'main' into update_ui_ux
Oleksandr1414 Sep 18, 2023
56b2f0e
username does not overlap the trash icon
Oleksandr1414 Sep 19, 2023
1ecd205
fix activity view
Oleksandr1414 Sep 19, 2023
5b1f72e
update bg position in login form
Oleksandr1414 Sep 19, 2023
6c6e83c
update bg position in signup form
Oleksandr1414 Sep 19, 2023
a130697
logout and delete chat btn animation optimized
Oleksandr1414 Sep 19, 2023
a89bab5
fix user name view
Oleksandr1414 Sep 19, 2023
7664b92
try to fix problem with chat form
Oleksandr1414 Sep 19, 2023
5671830
fix ! -> !!
Oleksandr1414 Sep 19, 2023
3eeff00
add useMemo for message block
Oleksandr1414 Sep 20, 2023
3c4b9f4
fix #1
Oleksandr1414 Sep 20, 2023
0c7751d
fix #2
Oleksandr1414 Sep 20, 2023
d725ddc
fix #3
Oleksandr1414 Sep 20, 2023
e8db5dd
destructuring
Oleksandr1414 Sep 20, 2023
c8473a0
update files systems
Oleksandr1414 Sep 20, 2023
a7ef072
Revert "update files systems"
Oleksandr1414 Sep 20, 2023
0b06e89
try to fix #4
Oleksandr1414 Sep 21, 2023
608dc9f
disable infinite scrolling
Oleksandr1414 Sep 21, 2023
a1c342b
cleanup
Oleksandr1414 Sep 21, 2023
014ec42
ChatForm fixed height
Oleksandr1414 Sep 21, 2023
57a6625
add height properties for chat form main
Oleksandr1414 Sep 21, 2023
0166e4d
add flex for chat-form-main
Oleksandr1414 Sep 21, 2023
f35ebc7
remove display flex from chat form main
Oleksandr1414 Sep 21, 2023
6e30820
add dynamic height properties
Oleksandr1414 Sep 21, 2023
e786a56
add flex for chaat-from-main
Oleksandr1414 Sep 21, 2023
e3790a1
add flex-grow for scroll block
Oleksandr1414 Sep 21, 2023
4c31451
chat open from top
Oleksandr1414 Sep 21, 2023
6395a9c
unlock infinity scrolling
Oleksandr1414 Sep 21, 2023
4c1f6dc
inverse -> true
Oleksandr1414 Sep 21, 2023
9d0f75e
try to fix #5
Oleksandr1414 Sep 21, 2023
b7c1519
remove -chat-form-main
Oleksandr1414 Sep 21, 2023
34615c6
add scroll to bottom
Oleksandr1414 Sep 21, 2023
750264f
fixed multiple variables of isMobileView
Oleksandr1414 Sep 21, 2023
d2e2a2f
add wrap value for message text
Oleksandr1414 Sep 22, 2023
027e8e6
add bg for chat empty
Oleksandr1414 Sep 25, 2023
09f22f2
fix chat redirect after get response of forbidden
Oleksandr1414 Sep 25, 2023
a80b199
try to clear all data after login
Oleksandr1414 Sep 25, 2023
eee5257
try to fix #1
Oleksandr1414 Sep 25, 2023
4103902
add network state updte after login
Oleksandr1414 Sep 25, 2023
57264cb
Merge branch 'main' into chat_delete
Oleksandr1414 Sep 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components/screens/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { history } from "../../_helpers/history";
import { motion as m } from "framer-motion";
import { setSelectedConversation } from "../../store/SelectedConversation";
import { setUserIsLoggedIn } from "../../store/UserIsLoggedIn ";
import { updateNetworkState } from "../../store/NetworkState";
import { useDispatch } from "react-redux";
import { useForm } from "react-hook-form";

Expand Down Expand Up @@ -41,6 +42,8 @@ export default function Login() {
const userToken = await api.userLogin(data);
localStorage.setItem("sessionId", userToken);
history.navigate("/main");
dispatch({ type: "RESET_STORE" });
dispatch(updateNetworkState(true));
subscribeForNotifications();
dispatch(setSelectedConversation({}));
dispatch(setUserIsLoggedIn(true));
Expand Down
6 changes: 3 additions & 3 deletions src/components/screens/chat/ChatList.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
selectAllConversations,
upsertChat,
} from "../../../store/Conversations.js";
import { history } from "../../../_helpers/history.js";
import { setSelectedConversation } from "../../../store/SelectedConversation.js";
import { setUserIsLoggedIn } from "../../../store/UserIsLoggedIn .js";
import { updateNetworkState } from "../../../store/NetworkState.js";
Expand All @@ -26,7 +27,6 @@ import { ReactComponent as IconSun } from "./../../../assets/icons/ThemeSun.svg"
import { ReactComponent as IconMoon } from "./../../../assets/icons/ThemeMoon.svg";
import { ReactComponent as CreateChatButton } from "./../../../assets/icons/chatList/CreateChatButton.svg";
import { ReactComponent as LogoutBtn } from "./../../../assets/icons/chatList/LogoutBtn.svg";
import { history } from "../../../_helpers/history.js";

export default function ChatList() {
const dispatch = useDispatch();
Expand Down Expand Up @@ -106,7 +106,7 @@ export default function ChatList() {
let list = [];
for (const obj of conversations) {
const chatName = !obj.name
? obj.owner_id === userInfo._id
? obj.owner_id === userInfo?._id
? participants[obj.opponent_id]?.login
: participants[obj.owner_id]?.login
: obj.name;
Expand All @@ -130,7 +130,7 @@ export default function ChatList() {
countOfNewMessages={obj.unread_messages_count}
chatType={obj.type}
lastMessage={obj.last_message}
uId={userInfo._id}
uId={userInfo?._id}
/>
</NavLink>
);
Expand Down
4 changes: 2 additions & 2 deletions src/services/messagesService.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { addMessages, upsertMessages } from "../store/Messages";
import { getDownloadFileLinks } from "../api/download_manager";
import { setSelectedConversation } from "../store/SelectedConversation";
import { upsertChat } from "../store/Conversations";
import { history } from "../_helpers/history";

class MessagesService {
currentChatId;
Expand Down Expand Up @@ -61,8 +62,7 @@ class MessagesService {
})
.catch(() => {
store.dispatch(setSelectedConversation({}));
// eslint-disable-next-line no-restricted-globals
history.pushState({}, null, location.origin + "/main");
history.navigate("/main");
});
}
}
Expand Down