/** * MobileImageActionsSheet — three-dots menu opened from the mobile * ImageLightbox header. Renders a Fluxer-style grouped action list * inside a `BottomSheet`, same visual idiom as the existing * MobileMessageActionsSheet so the two sheets feel like siblings. * * Group layout (matches the user's spec, not the richer reference): * 1. Favorite / Remove from Favorites (single-row group) * 2. Save Image • Open Link (two-row group) * 3. Delete Message (danger, single-row group) * * Each row only renders when its callback is actually provided so * callers with limited capability (e.g. the pinned-message popover, * which can't delete the source message) can drop rows without * leaving empty groups behind. */ import { BottomSheet } from '@brycord/ui'; import { Star, Download, ArrowSquareOut, Trash, } from '@phosphor-icons/react'; import styles from './MobileImageActionsSheet.module.css'; interface MobileImageActionsSheetProps { isOpen: boolean; onClose: () => void; isFavorited: boolean; onToggleFavorite?: () => void; onSaveImage?: () => void; onOpenLink?: () => void; /** When provided, a red "Delete Message" row is appended at the * bottom. Lets callers hide the row entirely when the current * user doesn't have permission or when the lightbox is rendered * from a context with no parent message (pinned popover). */ onDeleteMessage?: () => void; } export function MobileImageActionsSheet({ isOpen, onClose, isFavorited, onToggleFavorite, onSaveImage, onOpenLink, onDeleteMessage, }: MobileImageActionsSheetProps) { // Wrap each action so tapping always closes the sheet after the // handler fires. Mirrors the pattern in MobileMessageActionsSheet. const wrap = (fn?: () => void) => () => { if (!fn) return; fn(); onClose(); }; return (
Media Options
{onToggleFavorite && (
)} {(onSaveImage || onOpenLink) && (
{onSaveImage && ( )} {onOpenLink && ( )}
)} {onDeleteMessage && (
)}
); }