Skip to content

Commit

Permalink
change unread count if group selected part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
lizardkingLK committed Sep 8, 2023
1 parent 76785a6 commit ed14731
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 17 deletions.
10 changes: 2 additions & 8 deletions components/sections/friends/add/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,12 @@ const AddFriend = (props: IAddFriendProps) => {
}

if (props) {
const { onAddFriendHandler, onSelectGroupHandler, groups,
// setGroup, setMessages, setSection
} = props;
const { onAddFriendHandler, onSelectGroupHandler, groups } = props;

const handleInvitation = async () => {
const tempGroup = groups?.find(g => g.targetId === user?.id);
if (tempGroup) {
onSelectGroupHandler(tempGroup.id);
// setGroup(tempGroup);
// setMessages(tempGroup?.messages);
// setSection(sections.group);
return;
}
setLoading(true);
Expand All @@ -56,8 +51,7 @@ const AddFriend = (props: IAddFriendProps) => {

const handleSearch = (event: { preventDefault: () => void }) => {
event.preventDefault();
const value = searchRef?.current?.value ?? "";
const length = value.length;
const value = searchRef?.current?.value ?? "", length = value.length;
setUserFound(userSearchMessageTypes.notFound);
if (users && value) {
const user = users.find(
Expand Down
5 changes: 1 addition & 4 deletions components/sections/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const SectionSwitch = (props: ISecitonSwitchProps) => {
messages,
group,
setGroup,
setMessages,
active,
notifs,
lastMessageRef,
Expand Down Expand Up @@ -61,9 +60,7 @@ const SectionSwitch = (props: ISecitonSwitchProps) => {
} else if (section === sections.addFriend) {
return (
<div className="flex h-screen items-center justify-center w-full">
<AddFriend onAddFriendHandler={onAddFriendHandler} onSelectGroupHandler={onSelectGroupHandler} groups={groups}
// setGroup={setGroup} setMessages={setMessages} setSection={setSection}
/>
<AddFriend onAddFriendHandler={onAddFriendHandler} onSelectGroupHandler={onSelectGroupHandler} groups={groups} />
</div>
);
} else if (section === sections.feeds) {
Expand Down
1 change: 0 additions & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,6 @@ const Messages = () => {
user={user}
group={group}
setGroup={setGroup}
setMessages={setMessages}
messages={messages}
textInputRef={textInputRef}
input={input}
Expand Down
4 changes: 0 additions & 4 deletions types/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ export interface ISecitonSwitchProps {
onAddFriendHandler: Function;
onSelectGroupHandler: Function;
setGroup: Function;
setMessages: Function;
lastMessageRef: null | LegacyRef<HTMLDivElement>;
textInputRef: LegacyRef<HTMLInputElement> | null;
navbar: boolean;
Expand Down Expand Up @@ -311,7 +310,4 @@ export interface IAddFriendProps {
onAddFriendHandler: Function;
onSelectGroupHandler: Function;
groups: IGroupProps[] | null | undefined;
// setGroup: Function;
// setMessages: Function;
// setSection: Function;
}

0 comments on commit ed14731

Please sign in to comment.