-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix inbox not closing conversation after deleting one
- Loading branch information
1 parent
7e5eae4
commit 5e159b9
Showing
7 changed files
with
153 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
client/ecommerce/src/components/inbox/DisplayFilteredUsers.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { | ||
Avatar, | ||
Box, | ||
Card, | ||
CardActionArea, | ||
CardContent, | ||
Divider, | ||
Typography, | ||
} from "@mui/material"; | ||
import { UserWithAvatar } from "../../types/types"; | ||
import { AccountCircle } from "@mui/icons-material"; | ||
|
||
type Props = { | ||
filteredUsers: UserWithAvatar[]; | ||
setSearchInputValue: React.Dispatch<React.SetStateAction<string>> | ||
setChosenUserId: React.Dispatch<React.SetStateAction<number | null>> | ||
setIsSearchedIconClicked: React.Dispatch<React.SetStateAction<boolean>> | ||
}; | ||
|
||
export const DisplayFilteredUsers = ({ filteredUsers, setSearchInputValue, setChosenUserId, setIsSearchedIconClicked }: Props) => { | ||
return ( | ||
<Card | ||
sx={{ | ||
width: "100%", | ||
height: "281px", | ||
boxShadow: "none", | ||
overflowY: "auto", | ||
}} | ||
> | ||
{filteredUsers.map((user, index) => ( | ||
<CardActionArea | ||
onClick={() => { | ||
setSearchInputValue(user.username); | ||
setChosenUserId(user.id); | ||
|
||
setIsSearchedIconClicked(false); | ||
}} | ||
> | ||
<CardContent key={index} sx={{ display: "flex" }}> | ||
<Box sx={{ display: "flex", gap: "10px" }}> | ||
{user.avatar ? ( | ||
<Avatar src={user.avatar} /> | ||
) : ( | ||
<AccountCircle | ||
sx={{ | ||
color: "grey", | ||
width: "24px", | ||
height: "24px", | ||
}} | ||
/> | ||
)} | ||
<Typography>{user.username}</Typography> | ||
</Box> | ||
</CardContent> | ||
<Divider /> | ||
</CardActionArea> | ||
))} | ||
</Card> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
client/ecommerce/src/components/inbox/InboxSidebarNavbar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import AddCommentOutlinedIcon from "@mui/icons-material/AddCommentOutlined"; | ||
import { Box, Button, Typography } from "@mui/material"; | ||
import { useLocation } from "wouter"; | ||
|
||
type Props = { | ||
setIsNewChatClicked: React.Dispatch<React.SetStateAction<boolean>>; | ||
}; | ||
export const InboxSidebarNavbar = ({ setIsNewChatClicked }: Props) => { | ||
const [, setLocation] = useLocation(); | ||
const handleClick = () => { | ||
setIsNewChatClicked(true); | ||
setLocation("/inbox/new"); | ||
}; | ||
return ( | ||
<Box | ||
sx={{ | ||
height: "52px", | ||
display: "flex", | ||
justifyContent: "space-between", | ||
alignItems: "center", | ||
borderRight: "1px solid rgba(23, 23, 23, 0.08)", | ||
borderBottom: "1px solid rgba(23, 23, 23, 0.08)", | ||
padding: "4px", | ||
}} | ||
> | ||
<Typography sx={{ fontSize: "16px", padding: "8px", fontWeight: "500" }}> | ||
Inbox | ||
</Typography> | ||
<Button onClick={handleClick}> | ||
<AddCommentOutlinedIcon | ||
sx={{ | ||
color: "#007782", | ||
width: "24px", | ||
height: "24px", | ||
}} | ||
/> | ||
</Button> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters