mirror of
https://github.com/outline/outline.git
synced 2026-11-25 23:24:06 +03:00
39 lines
993 B
TypeScript
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);
|
|
}
|