Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add quote reply #252

Merged
merged 5 commits into from
Sep 26, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 48 additions & 24 deletions client/src/components/Chat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,17 @@ const Chat = () => {
setEditing({ isediting: true, messageID: id });
};

const handleQuoteReply = (id) => {
inputRef.current.focus();

const { message } = getMessage(id);
if (message.includes('Warning Message')) {
cancelEdit();
return;
}
inputRef.current.value = '>' + message + '\n';
};

const handleTypingStatus = debounce((e) => {
if (e.target.value.length > 0) {
socket
Expand Down Expand Up @@ -403,42 +414,55 @@ const Chat = () => {
}`}
>
<p>{message}</p>
{sender.toString() ===
senderId.toString() &&
status !== 'pending' && (
<Dropdown
placement="leftStart"
style={{ zIndex: 3 }}
renderToggle={
renderIconButton
}
NoCaret
>
<Dropdown.Item
onClick={() =>
handleDelete(id)
}
>
Delete
</Dropdown.Item>
{status !== 'pending' && (
<Dropdown
placement="leftStart"
style={{ zIndex: 3 }}
renderToggle={
renderIconButton
}
NoCaret
>
if(sender.toString() ===
senderId.toString())
{
<Dropdown.Item
onClick={() =>
handleEdit(id)
}
>
Edit
</Dropdown.Item>
}
<Dropdown.Item
onClick={() =>
handleCopyToClipBoard(
id
)
}
>
Copy
</Dropdown.Item>
<Dropdown.Item
onClick={() =>
handleQuoteReply(id)
}
>
Quote Reply
</Dropdown.Item>
if(sender.toString() ===
senderId.toString())
{
<Dropdown.Item
onClick={() =>
handleCopyToClipBoard(
id
)
handleDelete(id)
}
>
Copy
Delete
</Dropdown.Item>
</Dropdown>
)}
}
</Dropdown>
)}
</div>
<div
className={`status ${
Expand Down