feat: add menu to More Button in Profile
This commit is contained in:
@@ -10,7 +10,7 @@ const Styled = styled.span`
|
||||
cursor: pointer;
|
||||
}
|
||||
`;
|
||||
export default function Mention({ uid, popover = true }) {
|
||||
export default function Mention({ uid, popover = true, cid }) {
|
||||
const contactsData = useSelector((store) => store.contacts.byId);
|
||||
const user = contactsData[uid];
|
||||
if (!user) return null;
|
||||
@@ -20,7 +20,7 @@ export default function Mention({ uid, popover = true }) {
|
||||
interactive
|
||||
placement="top"
|
||||
trigger="click"
|
||||
content={<Profile uid={uid} type="card" />}
|
||||
content={<Profile uid={uid} type="card" cid={cid} />}
|
||||
>
|
||||
<Styled className={popover ? "clickable" : ""}>{`@${user.name}`}</Styled>
|
||||
</Tippy>
|
||||
|
||||
@@ -99,7 +99,7 @@ function Message({
|
||||
interactive
|
||||
placement="left"
|
||||
trigger="click"
|
||||
content={<Profile uid={fromUid} type="card" />}
|
||||
content={<Profile uid={fromUid} type="card" cid={contextId} />}
|
||||
>
|
||||
<div className="avatar" data-uid={fromUid} ref={avatarRef}>
|
||||
<Avatar url={currUser.avatar} name={currUser.name} />
|
||||
|
||||
@@ -51,7 +51,7 @@ const renderContent = ({
|
||||
(match, idx) => {
|
||||
console.log("match", match);
|
||||
const uid = match.trim().slice(1);
|
||||
return <Mention key={idx} uid={uid} />;
|
||||
return <Mention key={idx} uid={uid} cid={to} />;
|
||||
}
|
||||
)}
|
||||
{/* {content.replace(/\s{1}\@[1-9]+\s{1}/g,)} */}
|
||||
|
||||
@@ -9,7 +9,7 @@ import useCopy from "../../hook/useCopy";
|
||||
import usePinMessage from "../../hook/usePinMessage";
|
||||
|
||||
export default function useMessageOperation({ mid, context, contextId }) {
|
||||
const [copied, copy] = useCopy();
|
||||
const { copy } = useCopy();
|
||||
const { content_type, properties, currUid, from_uid, content } = useSelector(
|
||||
(store) => {
|
||||
return {
|
||||
@@ -64,11 +64,6 @@ export default function useMessageOperation({ mid, context, contextId }) {
|
||||
toast.success("Unpin Message Successfully!");
|
||||
}
|
||||
}, [isUnpinSuccess]);
|
||||
useEffect(() => {
|
||||
if (copied) {
|
||||
toast.success("Copied");
|
||||
}
|
||||
}, [copied]);
|
||||
const enablePin = context == "channel" && canPin;
|
||||
// const enableReply = currUid != from_uid;
|
||||
const isImage =
|
||||
@@ -83,7 +78,9 @@ export default function useMessageOperation({ mid, context, contextId }) {
|
||||
[ContentTypes.text, ContentTypes.markdown].includes(content_type) ||
|
||||
isImage;
|
||||
return {
|
||||
copyContent: isImage ? copyContent.bind(null, true) : copyContent,
|
||||
copyContent: isImage
|
||||
? copyContent.bind(null, true)
|
||||
: copyContent.bind(null, false),
|
||||
canCopy,
|
||||
isImage,
|
||||
isMarkdown: content_type == ContentTypes.markdown,
|
||||
|
||||
Reference in New Issue
Block a user