diff --git a/frontend/src/components/chat/chat-header/chat-header.tsx b/frontend/src/components/chat/chat-header/chat-header.tsx index 9d2a45f..baf2261 100644 --- a/frontend/src/components/chat/chat-header/chat-header.tsx +++ b/frontend/src/components/chat/chat-header/chat-header.tsx @@ -6,14 +6,18 @@ import SearchIcon from "@assets/svg/search.svg"; import cn from "classnames"; import { SUBSCRIBE_ONLINE_USER } from "@schemas"; import { useSubscription } from "@apollo/client"; -import { useState } from "react"; +import { useEffect, useState } from "react"; type TProps = { reciever?: TUser; }; export const ChatHeader = ({ reciever }: TProps) => { - const [isOnline, setIsOnline] = useState(false); + const [isOnline, setIsOnline] = useState(reciever?.online); + + useEffect(() => { + setIsOnline(reciever?.online); + }, [reciever?.online]); useSubscription(SUBSCRIBE_ONLINE_USER, { onSubscriptionData: ({ @@ -27,8 +31,6 @@ export const ChatHeader = ({ reciever }: TProps) => { }, }); - const online = isOnline || reciever?.online; - return (
@@ -43,11 +45,11 @@ export const ChatHeader = ({ reciever }: TProps) => { - {online ? "Online" : "Offline"} + {isOnline ? "Online" : "Offline"}
diff --git a/frontend/src/components/contact-info/contact-info.tsx b/frontend/src/components/contact-info/contact-info.tsx deleted file mode 100644 index b571f11..0000000 --- a/frontend/src/components/contact-info/contact-info.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import MoreHorizontalIcon from "@assets/svg/more-horizontal.svg"; -import styles from "./styles.scss"; -import PhoneIcon from "@assets/svg/phone.svg"; -import VideoIcon from "@assets/svg/video.svg"; -import { Field } from "@ui"; - -export const ContactInfo = () => { - return ( -
-
- Contact Information - -
-
-
- PR -
- Partners 😎 - 13 members -
- - -
-
-
- - - -
-
- ); -}; diff --git a/frontend/src/components/contact-info/index.ts b/frontend/src/components/contact-info/index.ts deleted file mode 100644 index 7e085b6..0000000 --- a/frontend/src/components/contact-info/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./contact-info"; diff --git a/frontend/src/components/contact-info/styles.scss b/frontend/src/components/contact-info/styles.scss deleted file mode 100644 index 7d511f8..0000000 --- a/frontend/src/components/contact-info/styles.scss +++ /dev/null @@ -1,86 +0,0 @@ -@import "@styles/mixins.scss"; - -.contact-info { - width: 378px; - flex-shrink: 0; - margin: 24px 24px 40px 24px; - background: $c_white; - border-radius: 8px; - - .header { - border-bottom: 1px solid #e1e3e6; - font-size: 18px; - font-weight: 700; - color: $c_text_primary; - display: flex; - justify-content: space-between; - padding: 17px 24px; - } - - .avatar { - border-radius: 50%; - color: $c_white; - font-size: 24px; - width: 72px; - height: 72px; - text-align: center; - padding: 19px 0; - } - - .title { - margin-top: 16px; - color: $c_text_primary; - font-size: 18px; - font-weight: 700; - } - - .members { - color: $c_text_primary; - font-size: 14px; - font-weight: 400; - } - - .first-info { - padding: 32px; - display: flex; - flex-direction: column; - align-items: center; - border-bottom: 1px solid #e1e3e6; - } - - .buttons { - margin-top: 24px; - width: 100%; - display: flex; - justify-content: space-between; - - & button { - border: 1px solid #e1e3e6; - padding: 8px 0; - box-shadow: 0px 4px 2px -2px rgba(27, 46, 94, 0.02); - text-align: center; - width: 48%; - border-radius: 8px; - transition: 0.1s ease all; - background: $c_white; - - &:hover { - background: $c_bg_blue; - border: 1px solid $c_border_hover; - - & svg { - fill: $c_white; - } - } - } - } - - .second-info { - border-bottom: 1px solid #e1e3e6; - padding: 16px 24px; - - & > div { - padding: 6px 0; - } - } -} diff --git a/frontend/src/components/index.ts b/frontend/src/components/index.ts index 7128287..d90e4f7 100644 --- a/frontend/src/components/index.ts +++ b/frontend/src/components/index.ts @@ -1,5 +1,4 @@ export * from "./sidebar"; export * from "./chat"; -export * from "./contact-info"; export * from "./base-form"; export * from "./date-time"; diff --git a/frontend/src/components/sidebar/new-users-list/new-users-list.tsx b/frontend/src/components/sidebar/new-users-list/new-users-list.tsx index 883c259..fb52708 100644 --- a/frontend/src/components/sidebar/new-users-list/new-users-list.tsx +++ b/frontend/src/components/sidebar/new-users-list/new-users-list.tsx @@ -31,6 +31,7 @@ export const NewUsersList = () => { {newUsers.map((user: TUser) => ( { const [isOnline, setIsOnline] = useState(user?.online); const isSelf = currentUser?.id === user?.id; @@ -62,7 +64,7 @@ export const UserItem = ({ }, }); - const online = type === UserLocations.CHAT ? false : isOnline; + const online = !hasOnline || type === UserLocations.CHAT ? false : isOnline; return (