All files / src/components/FeedbackFlow index.tsx

99.76% Statements 421/422
84.61% Branches 110/130
100% Functions 17/17
99.76% Lines 421/422

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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 5941x 1x 1x     1x 1x             1x 1x 1x 1x     1x                   1x       1x     1x                   1x     1x       1x 1x 1x     1x                                 1x 148x 148x 148x 148x 148x 148x 148x 148x 148x 148x 148x 148x 148x 148x 148x     148x 148x 148x 148x 148x 148x 148x 148x 148x 148x 148x 148x   148x   148x 148x 148x     148x 148x     148x 148x     148x 148x 61x               148x 10x 10x     9x   8x     10x 3x 3x 3x 1x 2x 3x 3x 3x 3x           3x 2x 2x 2x 2x 2x 2x 2x 3x 3x     5x 5x 3x 10x 2x 2x 2x 2x 1x 1x 2x 2x   2x 2x   2x 2x 2x 2x     3x 3x 2x 10x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 10x     148x 2x 2x 2x 2x 2x     148x 5x 5x     148x 4x 4x 4x 4x 4x 3x 1x 4x 4x 4x     148x 9x 9x   148x 1x 1x 1x 1x 1x   148x 1x 1x 1x 1x 1x     148x 4x 4x   148x 1x 1x           148x 19x 19x   19x     19x 19x 19x     148x 14x 14x 14x 14x 14x   148x 5x 5x 5x 5x 5x 5x 5x 5x 5x     148x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 2x 2x 1x 1x 2x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x     148x 4x   4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x   2x 2x 2x 2x 2x 2x 1x 1x 2x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x     148x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x             148x     148x 52x 52x   12x   12x 12x 27x     27x 27x 1x 1x 1x 1x 1x     26x 26x 26x 18x     18x 18x 18x 27x 2x 2x 2x 2x 27x   1x 27x     16x 16x 12x   12x   12x 12x 12x 148x     148x 148x 148x 148x 148x     148x 148x 148x           148x 75x 75x   75x 75x 75x 75x 75x 75x 75x 75x 75x 75x   75x 75x 75x 75x 75x 75x   75x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x   17x 17x 17x 17x 17x 17x 17x 17x   17x 17x   75x   75x     148x           73x 73x   73x 73x 73x 73x 73x 73x       148x 35x 35x 35x 35x 35x 35x 35x 35x 35x 35x 35x 35x 35x 35x 35x 35x 35x 35x 35x 35x   35x 35x   148x   148x  
import { useState, useEffect, useRef } from 'react';
import { flushSync } from 'react-dom';
import { toast } from 'sonner';
 
// Types
import { FeedbackFlowView, FeedbackVisibility } from '@/types';
import {
  CommentChangeAction,
  MenuSocketUpdate,
  OwnCommentChangePayload,
} from '@/types/meal';
 
// Components
import { FeedbackCommentCard } from '@/components/FeedbackCommentCard';
import { UserFeedback } from '@/components/UserFeedback';
import { MenuFeedbackOverlay } from '@/components/MenuFeedbackOverlay';
import { DeleteConfirmModal } from '@/components/DeleteConfirmModal';
 
// Utils
import {
  sentimentToRating,
  toVisibility,
  getInitialDraft,
  getInitialDisplay,
  getInitialUiState,
  type FeedbackDraft,
  type FeedbackDisplay,
  type FeedbackUi,
} from '@/utils/feedbackFlow';
import { getAuthToken, getNaiveLocalNow } from '@/utils';
import { syncCommentToDisplay } from '@/utils/menuFeedback';
 
// Stores
import { sentimentStore } from '@/stores/sentiment';
 
// Hooks
import {
  useFeedbackOpen,
  useSentiment,
  useFirebaseUser,
  useCommentsRealtime,
  useDismissOnOutsideClick,
  useMenuFeedbackOpen,
} from '@/hooks';
 
// Services
import { commentService, lunchMenusService } from '@/services';
 
// Constants
import {
  SENTIMENT_POLL_INTERVAL_MS,
  SENTIMENT_POLL_MAX_ATTEMPTS,
} from '@/constants/dailyFeedback';
import { ERROR_MESSAGES, SUCCESS_MESSAGES } from '@/constants/messages';
import { STATUS_CODE } from '@shared/constants';
import { CommentAction } from '@/types';
 
// Styles
import './styles/feedback-flow.css';
 
export interface FeedbackFlowProps {
  menuId: string;
  date: string;
  name: string;
  avatar: string;
  mealImage: string;
  mealItems: string;
  commentId?: string;
  isComment?: boolean;
  initialFeedback?: string;
  initialVisibility?: FeedbackVisibility;
  feedbackSentiment?: string | null;
  createdTime?: string;
}
 
export const FeedbackFlow = ({
  menuId,
  date,
  name,
  avatar,
  mealImage,
  mealItems,
  commentId,
  isComment = false,
  initialFeedback = '',
  initialVisibility = FeedbackVisibility.Public,
  feedbackSentiment,
  createdTime = '',
}: FeedbackFlowProps) => {
  const isExpiredMeal = useFeedbackOpen(date);
  const firebaseUser = useFirebaseUser();
 
  // State: draft is user input being edited; display is the persisted feedback
  const [draft, setDraft] = useState<FeedbackDraft>(
    getInitialDraft(initialVisibility),
  );
  const [display, setDisplay] = useState<FeedbackDisplay>(
    getInitialDisplay(
      initialFeedback,
      initialVisibility,
      feedbackSentiment,
      commentId,
      createdTime,
    ),
  );
  // UI state: controls which view is shown (Read/Compose/Edit)
  const [ui, setUi] = useState<FeedbackUi>(getInitialUiState(isComment));
  // Animation state: tracks when overlay is closing to trigger animation
  const [isMenuFeedbackClosing, setIsMenuFeedbackClosing] = useState(false);
  const menuFeedbackContentRef = useRef<HTMLDivElement>(null);
  const textareaRef = useRef<HTMLTextAreaElement>(null);
 
  // Sentiment: prioritize live updates from WebSocket over initial data
  const liveSentiment = useSentiment(display.commentId);
  const effectiveSentiment = liveSentiment ?? display.sentiment;
 
  // Overlay is visible when editing existing comment or composing new one
  const isMenuFeedbackOpen =
    ui.view === FeedbackFlowView.Edit || ui.isComposeOpen;
 
  // Check if user has made changes in edit mode (used to disable submit button)
  const hasChanges =
    draft.comment !== display.feedback ||
    toVisibility(draft.isAnonymous) !== display.visibility;
 
  // ========================================================================
  // Event Handlers
  // ========================================================================
 
  // Real-time sync: handles own comment changes from socket
  // Only processes ownCommentChange (user's own comments on this menu)
  const handleExternalUpdate = (update: MenuSocketUpdate): void => {
    const change = update.ownCommentChange;
    if (!change) return;
 
    // Only process if this event is for the current menu
    if (change.menuId !== menuId) return;
 
    const { action, comment } = change;
 
    // New comment created in this menu by user
    if (action === CommentChangeAction.CREATED) {
      setDisplay({
        feedback: comment.content || '',
        visibility: comment.isAnonymous
          ? FeedbackVisibility.Anonymous
          : FeedbackVisibility.Public,
        time: comment.createdAt || getNaiveLocalNow(),
        sentiment: comment.sentiment || null,
        commentId: comment.id,
      });
 
      // On the originating device the close animation drives the view change
      // (finalizeMenuFeedbackClose), so defer to avoid a visual jump mid-close.
      // On any other device/tab there is no close animation, so switch to the
      // Read view here — otherwise the new comment never appears there.
      if (!isMenuFeedbackClosing) {
        setDraft({ comment: '', isAnonymous: false });
        setUi((prev) => ({
          ...prev,
          view: FeedbackFlowView.Read,
          isComposeOpen: false,
        }));
      }
      return;
    }
 
    // Comment updated
    if (
      action === CommentChangeAction.UPDATED &&
      comment.id === display.commentId
    ) {
      setDisplay((prev) => ({
        ...prev,
        feedback: comment.content || prev.feedback,
        visibility: comment.isAnonymous
          ? FeedbackVisibility.Anonymous
          : FeedbackVisibility.Public,
        sentiment: comment.sentiment ?? prev.sentiment,
      }));
      // Return to Read view after updating
      setUi((prev) =>
        prev.view === FeedbackFlowView.Edit
          ? { ...prev, view: FeedbackFlowView.Read }
          : prev,
      );
      return;
    }
 
    // Comment was deleted
    if (
      action === CommentChangeAction.DELETED &&
      comment.id === display.commentId
    ) {
      if (display.commentId) sentimentStore.clearData(display.commentId);
      setDisplay({
        feedback: '',
        visibility: FeedbackVisibility.Public,
        time: '',
        sentiment: null,
        commentId: undefined,
      });
      setDraft({ comment: '', isAnonymous: false });
      setUi({
        view: FeedbackFlowView.Compose,
        isLoading: false,
        showDeleteConfirm: false,
        isComposeOpen: false,
      });
    }
  };
 
  // Cache AI sentiment predictions from API response
  const syncSentimentFromResponse = (
    id: string,
    sentiment: string | null,
  ): void => {
    if (sentiment) sentimentStore.setData(id, sentiment);
  };
 
  // Trigger overlay close animation
  const closeMenuFeedback = (): void => {
    setIsMenuFeedbackClosing(true);
  };
 
  // Complete overlay close: cleanup state and return to appropriate view
  const finalizeMenuFeedbackClose = (): void => {
    setIsMenuFeedbackClosing(false);
    setDraft((prev) => ({ ...prev, comment: '' }));
    setUi((prev) => ({
      ...prev,
      view: display.commentId
        ? FeedbackFlowView.Read
        : FeedbackFlowView.Compose,
      isComposeOpen: false,
    }));
  };
 
  // Draft updates: form input handlers
  const handleCommentChange = (comment: string): void => {
    setDraft((prev) => ({ ...prev, comment }));
  };
 
  const handleEmojiClick = (emoji: string): void => {
    setDraft((prev) => ({
      ...prev,
      comment: prev.comment + emoji,
    }));
  };
 
  const handleToggleAnonymous = (): void => {
    setDraft((prev) => ({
      ...prev,
      isAnonymous: !prev.isAnonymous,
    }));
  };
 
  // Modal controls
  const handleShowDeleteConfirm = (): void => {
    setUi((prev) => ({ ...prev, showDeleteConfirm: true }));
  };
 
  const handleCancelDelete = (): void => {
    setUi((prev) => ({ ...prev, showDeleteConfirm: false }));
  };
 
  // iOS only honors programmatic focus inside the originating user gesture, so
  // flush the overlay mount synchronously and focus while still in the tap
  // handler. Without this, iOS drops the focus once the gesture ends and the
  // keyboard never opens (Android is unaffected).
  const focusTextareaWithinGesture = (): void => {
    const textarea = textareaRef.current;
    if (!textarea) return;
 
    textarea.focus();
    // Place the caret after the last character so editing continues from the
    // end of the existing comment instead of the beginning.
    const caret = textarea.value.length;
    textarea.setSelectionRange(caret, caret);
  };
 
  // Overlay controls
  const handleOpenCompose = (): void => {
    flushSync(() => {
      setUi((prev) => ({ ...prev, isComposeOpen: true }));
    });
    focusTextareaWithinGesture();
  };
 
  const handleStartEdit = (): void => {
    flushSync(() => {
      setDraft({
        comment: display.feedback,
        isAnonymous: display.visibility === FeedbackVisibility.Anonymous,
      });
      setUi((prev) => ({ ...prev, isComposeOpen: true }));
    });
    focusTextareaWithinGesture();
  };
 
  // API handlers: create/update/delete comment with optimistic sentiment caching
  const handleSend = async (): Promise<void> => {
    if (!draft.comment.trim() || ui.isLoading) return;
    setUi((prev) => ({ ...prev, isLoading: true }));
    try {
      const token = await getAuthToken();
      const { data, error } = await commentService({
        lunchMenuId: menuId,
        token,
        type: CommentAction.CREATE,
        content: draft.comment.trim(),
        isAnonymous: draft.isAnonymous,
      });
      if (error || !data) {
        toast.error(
          error?.status === STATUS_CODE.FORBIDDEN
            ? ERROR_MESSAGES.MEAL.FEEDBACK_WINDOW_CLOSED
            : (error?.message ?? ERROR_MESSAGES.MEAL.CREATE_COMMENT),
        );
        return;
      }
      syncSentimentFromResponse(data.id, data.sentiment);
      setDisplay({
        feedback: draft.comment.trim(),
        visibility: toVisibility(draft.isAnonymous),
        time: getNaiveLocalNow(),
        sentiment: data.sentiment,
        commentId: data.id,
      });
      setDraft({ comment: '', isAnonymous: false });
      closeMenuFeedback();
      toast.success(SUCCESS_MESSAGES.MEAL.CREATE_COMMENT);
    } catch {
      toast.error(ERROR_MESSAGES.MEAL.CREATE_COMMENT);
    } finally {
      setUi((prev) => ({ ...prev, isLoading: false }));
    }
  };
 
  // Update existing comment, preserving previous sentiment until API responds
  const handleUpdate = async (): Promise<void> => {
    if (!draft.comment.trim() || ui.isLoading) return;
 
    const previousSentiment = display.sentiment;
    const currentCommentId = display.commentId;
    if (currentCommentId) sentimentStore.clearData(currentCommentId);
    setDisplay((prev) => ({ ...prev, sentiment: null }));
    setUi((prev) => ({ ...prev, isLoading: true }));
    try {
      const token = await getAuthToken();
      const { data, error } = await commentService({
        lunchMenuId: menuId,
        token,
        type: CommentAction.UPDATE,
        content: draft.comment.trim(),
        isAnonymous: draft.isAnonymous,
      });
      if (error || !data) {
        // Restore previous sentiment on error
        if (previousSentiment && currentCommentId) {
          sentimentStore.setData(currentCommentId, previousSentiment);
        }
        setDisplay((prev) => ({ ...prev, sentiment: previousSentiment }));
        toast.error(
          error?.status === STATUS_CODE.FORBIDDEN
            ? ERROR_MESSAGES.MEAL.FEEDBACK_WINDOW_CLOSED
            : (error?.message ?? ERROR_MESSAGES.MEAL.UPDATE_COMMENT),
        );
        return;
      }
      syncSentimentFromResponse(data.id, data.sentiment);
      setDisplay((prev) => ({
        ...prev,
        feedback: draft.comment.trim(),
        visibility: toVisibility(draft.isAnonymous),
        time: getNaiveLocalNow(),
        sentiment: data.sentiment,
        commentId: data.id,
      }));
      closeMenuFeedback();
      toast.success(SUCCESS_MESSAGES.MEAL.UPDATE_COMMENT);
    } catch {
      toast.error(ERROR_MESSAGES.MEAL.UPDATE_COMMENT);
    } finally {
      setUi((prev) => ({ ...prev, isLoading: false }));
    }
  };
 
  // Delete comment and return to Compose view
  const handleDelete = async (): Promise<void> => {
    if (ui.isLoading) return;
    setUi((prev) => ({ ...prev, isLoading: true }));
    try {
      const token = await getAuthToken();
      const { success, error } = await commentService({
        lunchMenuId: menuId,
        token,
        type: CommentAction.DELETE,
      });
      if (!success || error) {
        toast.error(error?.message ?? ERROR_MESSAGES.MEAL.DELETE_COMMENT);
        return;
      }
      setDraft({ comment: '', isAnonymous: false });
      setUi({
        view: FeedbackFlowView.Compose,
        isLoading: false,
        showDeleteConfirm: false,
        isComposeOpen: false,
      });
      toast.success(SUCCESS_MESSAGES.MEAL.DELETE_COMMENT);
    } catch {
      toast.error(ERROR_MESSAGES.MEAL.DELETE_COMMENT);
    } finally {
      setUi((prev) => ({ ...prev, isLoading: false }));
    }
  };
 
  // ========================================================================
  // Effects
  // ========================================================================
 
  // Subscribe to real-time comment updates via WebSocket (ownCommentChange events)
  useCommentsRealtime(handleExternalUpdate, !!firebaseUser);
 
  // Poll for sentiment when initial socket update is missed
  useEffect(() => {
    const currentCommentId = display.commentId;
    if (!currentCommentId || effectiveSentiment != null) return;
 
    let cancelled = false;
 
    const pollForSentiment = async (): Promise<void> => {
      for (let attempt = 0; attempt < SENTIMENT_POLL_MAX_ATTEMPTS; attempt++) {
        if (cancelled) return;
 
        // Check cache first
        const cached = sentimentStore.getData(currentCommentId);
        if (cached) {
          setDisplay((prev) =>
            prev.sentiment ? prev : { ...prev, sentiment: cached },
          );
          return;
        }
 
        // Wait before next attempt
        await new Promise((resolve) =>
          setTimeout(resolve, SENTIMENT_POLL_INTERVAL_MS),
        );
        if (cancelled) return;
 
        // Fallback API call if socket event never arrives
        try {
          const token = await getAuthToken();
          const { data } = await lunchMenusService.getComment(menuId, token);
          if (data?.id === currentCommentId && data.sentiment) {
            sentimentStore.setData(currentCommentId, data.sentiment);
            setDisplay((prev) => ({ ...prev, sentiment: data.sentiment }));
            return;
          }
        } catch {
          // Best-effort fallback when the socket event is missed.
        }
      }
 
      // After all polling attempts, mark as analyzed but without sentiment if not found
      sentimentStore.clearData(currentCommentId);
      setDisplay((prev) => ({ ...prev, sentiment: null }));
    };
 
    void pollForSentiment();
 
    return () => {
      cancelled = true;
    };
  }, [display.commentId, effectiveSentiment, menuId]);
 
  // Close overlay when clicking outside (except on menu content)
  useDismissOnOutsideClick({
    enabled: isMenuFeedbackOpen && !isMenuFeedbackClosing,
    ignoreRefs: [menuFeedbackContentRef],
    onDismiss: closeMenuFeedback,
  });
 
  // Lock body scroll when overlay is open
  useMenuFeedbackOpen({
    isOpen: isMenuFeedbackOpen,
  });
 
  // ========================================================================
  // Render: Read View (existing feedback)
  // ========================================================================
 
  if (ui.view === FeedbackFlowView.Read) {
    return (
      <>
        {/* Display persisted feedback with sentiment rating */}
        <UserFeedback
          name={name}
          avatar={avatar}
          isAnonymous={display.visibility === FeedbackVisibility.Anonymous}
          time={display.time}
          rating={sentimentToRating(effectiveSentiment)}
          content={display.feedback}
          onEdit={!isExpiredMeal ? handleStartEdit : undefined}
          onDelete={!isExpiredMeal ? handleShowDeleteConfirm : undefined}
        />
        {/* Delete confirmation modal */}
        <DeleteConfirmModal
          isVisible={ui.showDeleteConfirm}
          isLoading={ui.isLoading}
          onCancel={handleCancelDelete}
          onDelete={handleDelete}
        />
        {/* Edit overlay triggered by onEdit button */}
        {isMenuFeedbackOpen && (
          <MenuFeedbackOverlay
            name={name}
            avatar={avatar}
            date={date || ''}
            mealImage={mealImage}
            mealItems={mealItems}
            draft={draft}
            display={display}
            isLoading={ui.isLoading}
            isClosing={isMenuFeedbackClosing}
            hasChanges={hasChanges}
            contentRef={
              menuFeedbackContentRef as React.RefObject<HTMLDivElement>
            }
            textareaRef={textareaRef as React.RefObject<HTMLTextAreaElement>}
            onCommentChange={handleCommentChange}
            onEmojiClick={handleEmojiClick}
            onToggleAnonymous={handleToggleAnonymous}
            onSubmit={handleUpdate}
            onClose={closeMenuFeedback}
            onAnimationEnd={
              isMenuFeedbackClosing ? finalizeMenuFeedbackClose : undefined
            }
            isEditMode={true}
          />
        )}
      </>
    );
  }
 
  // Hide component if feedback window has closed
  if (isExpiredMeal) return null;
 
  // ========================================================================
  // Render: Compose View (new feedback)
  // ========================================================================
 
  return (
    <>
      {/* Card to prompt user to leave feedback */}
      {ui.view === FeedbackFlowView.Compose && (
        <FeedbackCommentCard
          name={name}
          avatar={avatar}
          onClick={handleOpenCompose}
        />
      )}
 
      {/* Compose overlay triggered by card click or programmatically */}
      {isMenuFeedbackOpen && (
        <MenuFeedbackOverlay
          name={name}
          avatar={avatar}
          date={date || ''}
          mealImage={mealImage}
          mealItems={mealItems}
          draft={draft}
          display={display}
          isLoading={ui.isLoading}
          isClosing={isMenuFeedbackClosing}
          hasChanges={hasChanges}
          contentRef={menuFeedbackContentRef as React.RefObject<HTMLDivElement>}
          textareaRef={textareaRef as React.RefObject<HTMLTextAreaElement>}
          onCommentChange={handleCommentChange}
          onEmojiClick={handleEmojiClick}
          onToggleAnonymous={handleToggleAnonymous}
          onSubmit={handleSend}
          onClose={closeMenuFeedback}
          onAnimationEnd={
            isMenuFeedbackClosing ? finalizeMenuFeedbackClose : undefined
          }
          isEditMode={false}
        />
      )}
    </>
  );
};