Improve animation

This commit is contained in:
2025-09-04 21:25:38 +03:00
Unverified
parent 68ac96c1e4
commit b6542328de
3 changed files with 59 additions and 16 deletions
@@ -33,6 +33,7 @@ export function MessageContextMenu({
// Internal state for dialogs
const [editDialogOpen, setEditDialogOpen] = useState(false);
const [replyDialogOpen, setReplyDialogOpen] = useState(false);
const [isClosing, setIsClosing] = useState(false);
const handleAction = (action: string) => {
console.log("Context menu action triggered:", action);
@@ -48,12 +49,20 @@ export function MessageContextMenu({
case "delete":
if (isAuthor) {
onDelete(message);
onClose();
handleClose();
}
break;
}
};
const handleClose = () => {
setIsClosing(true);
// Wait for animation to complete before calling onClose
setTimeout(() => {
onClose();
}, 200); // Match the animation duration from _animations.scss
};
const handleEditSave = (messageId: number, newContent: string) => {
// Create a temporary message object with the updated content
const updatedMessage = { ...message, content: newContent };
@@ -71,7 +80,7 @@ export function MessageContextMenu({
return (
<>
<div
className="context-menu"
className={`context-menu ${isClosing ? 'closing' : 'entering'}`}
style={{
position: "fixed",
display: "block",