mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
* feat: limit the amount of transcripts to 10 by default * feat: separate page into different component, greatly improving the loading and reactivity * fix: current implementation immediately invokes the onDelete and onReprocess From pr-agent-monadical: Suggestion: The current implementation immediately invokes the onDelete and onReprocess functions when the component renders, rather than when the menu items are clicked. This can cause unexpected behavior and potential memory leaks. Use callback functions that only execute when the menu items are actually clicked. [possible issue, importance: 9]
40 lines
940 B
TypeScript
40 lines
940 B
TypeScript
import React from "react";
|
|
import {
|
|
Menu,
|
|
MenuButton,
|
|
MenuList,
|
|
MenuItem,
|
|
IconButton,
|
|
Icon,
|
|
} from "@chakra-ui/react";
|
|
import { FaEllipsisVertical } from "react-icons/fa6";
|
|
|
|
interface TranscriptActionsMenuProps {
|
|
transcriptId: string;
|
|
onDelete: (transcriptId: string) => (e: any) => void;
|
|
onReprocess: (transcriptId: string) => (e: any) => void;
|
|
}
|
|
|
|
export default function TranscriptActionsMenu({
|
|
transcriptId,
|
|
onDelete,
|
|
onReprocess,
|
|
}: TranscriptActionsMenuProps) {
|
|
return (
|
|
<Menu closeOnSelect={true} isLazy={true}>
|
|
<MenuButton
|
|
as={IconButton}
|
|
icon={<Icon as={FaEllipsisVertical} />}
|
|
variant="outline"
|
|
aria-label="Options"
|
|
/>
|
|
<MenuList>
|
|
<MenuItem onClick={(e) => onDelete(transcriptId)(e)}>Delete</MenuItem>
|
|
<MenuItem onClick={(e) => onReprocess(transcriptId)(e)}>
|
|
Reprocess
|
|
</MenuItem>
|
|
</MenuList>
|
|
</Menu>
|
|
);
|
|
}
|