Files
outline/app/hooks/useGroupMenuActions.tsx
T
Tom Moor 3b6a3f45e3 Add contextual menu to group table (#13220)
* Add contextual menu to group table

* feedback
2026-08-01 12:15:23 +00:00

39 lines
993 B
TypeScript

import { useMemo } from "react";
import { ActionSeparator } from "~/actions";
import {
deleteGroup,
editGroup,
groupExternalId,
groupMembers,
groupProviderExternalId,
} from "~/actions/definitions/groups";
import { useMenuAction } from "~/hooks/useMenuAction";
interface Options {
/** Whether to hide the "Members" navigation action. */
hideMembers?: boolean;
}
/**
* Hook that constructs the action menu for group management operations. The
* group is read from the active models in the action context.
*
* @param options - optional configuration for the menu.
* @returns action with children for use in menus.
*/
export function useGroupMenuActions(options?: Options) {
const actions = useMemo(
() => [
...(options?.hideMembers ? [] : [groupMembers, ActionSeparator]),
editGroup,
deleteGroup,
ActionSeparator,
groupExternalId,
groupProviderExternalId,
],
[options?.hideMembers]
);
return useMenuAction(actions);
}