Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 23x 23x 2x 2x 23x 3x 23x 23x 3x | import { ConversationsCaretLeft } from "@assets/icons";
import { Text, TruncateText } from "@common/Text";
import { Stack } from "@mui/material";
import { Breadcrumbs } from "@mui/material";
import ImagesStacker from "../../utils/ImagesStacker";
import { useAppDispatch } from "@redux/hooks";
import { resetHiddenInputs } from "@redux/slices/conversations";
import { isEmpty } from "lodash";
import { truncateString } from "@utils/helpers";
import { TQueryObject } from "../../types";
interface Props {
backButtonEnabled: boolean;
handleBreadCrumbClick: () => void;
queryObject?: TQueryObject;
}
export default function ConversationsBreadcrumbs({
backButtonEnabled,
handleBreadCrumbClick,
queryObject,
}: Props) {
const dispatch = useAppDispatch();
const handleClick = () => {
dispatch(resetHiddenInputs());
!backButtonEnabled && handleBreadCrumbClick();
};
const conversationThreadPathObj = queryObject?.paths?.find(
(item) => item.isConversation,
);
const isConversation = !isEmpty(conversationThreadPathObj);
return (
<Breadcrumbs
aria-label="breadcrumb"
data-testid="conversation-breadcrumb-container"
>
<Stack
direction="row"
alignItems="center"
gap={1.5}
sx={{ cursor: "pointer" }}
onClick={handleClick}
data-testid="conversation-topic-container"
>
<ConversationsCaretLeft width={9} height={16.5} />
<TruncateText
lineClamp={1}
maxWidth={isConversation ? "auto" : "100px"}
color="#8F8F8F"
data-testid="conversation-topic-title"
>
{isConversation
? conversationThreadPathObj?.pathName
: queryObject?.name}
</TruncateText>
</Stack>
{!isConversation &&
queryObject?.paths.map(({ avatars, pathName }, index) => (
<Stack
key={index}
direction="row"
alignItems="center"
sx={{ cursor: "default" }}
gap={1}
onClick={() => void 0}
>
<Text fontWeight="regular" color="#292727">
{truncateString(pathName, 15)}
</Text>
<ImagesStacker data={avatars} />
</Stack>
))}
</Breadcrumbs>
);
}
|