mirror of
https://github.com/outline/outline.git
synced 2026-12-01 17:32:49 +03:00
* chore: Audit and move inline actions to definitions * fix: Reuse existing smart-quote translation key in emoji delete dialog Co-Authored-By: Claude <noreply@anthropic.com> * Remove two usages of 'Link copied' translation --------- Co-authored-by: Claude <noreply@anthropic.com>
29 lines
763 B
TypeScript
29 lines
763 B
TypeScript
import { useMemo } from "react";
|
|
import type Emoji from "~/models/Emoji";
|
|
import {
|
|
deleteEmojiActionFactory,
|
|
replaceEmojiActionFactory,
|
|
} from "~/actions/definitions/emojis";
|
|
import { useMenuAction } from "~/hooks/useMenuAction";
|
|
|
|
/**
|
|
* Hook that constructs the action menu for emoji management operations.
|
|
*
|
|
* @param targetEmoji - the emoji to build actions for, or null to skip.
|
|
* @returns action with children for use in menus.
|
|
*/
|
|
export function useEmojiMenuActions(targetEmoji: Emoji | null) {
|
|
const actions = useMemo(
|
|
() =>
|
|
targetEmoji
|
|
? [
|
|
replaceEmojiActionFactory(targetEmoji),
|
|
deleteEmojiActionFactory(targetEmoji),
|
|
]
|
|
: [],
|
|
[targetEmoji]
|
|
);
|
|
|
|
return useMenuAction(actions);
|
|
}
|