mirror of
https://github.com/outline/outline.git
synced 2026-11-26 07:33:19 +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>
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { observer } from "mobx-react";
|
|
import { useMemo } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import type OAuthClient from "~/models/oauth/OAuthClient";
|
|
import { DropdownMenu } from "~/components/Menu/DropdownMenu";
|
|
import { OverflowMenuButton } from "~/components/Menu/OverflowMenuButton";
|
|
import { ActionSeparator } from "~/actions";
|
|
import {
|
|
deleteOAuthClientActionFactory,
|
|
editOAuthClientActionFactory,
|
|
} from "~/actions/definitions/oauthClients";
|
|
import { useMenuAction } from "~/hooks/useMenuAction";
|
|
|
|
type Props = {
|
|
/** The oauthClient to associate with the menu */
|
|
oauthClient: OAuthClient;
|
|
/** Whether to show the edit button */
|
|
showEdit?: boolean;
|
|
};
|
|
|
|
function OAuthClientMenu({ oauthClient, showEdit }: Props) {
|
|
const { t } = useTranslation();
|
|
|
|
const actions = useMemo(
|
|
() => [
|
|
editOAuthClientActionFactory({ oauthClient, visible: showEdit }),
|
|
ActionSeparator,
|
|
deleteOAuthClientActionFactory({ oauthClient }),
|
|
],
|
|
[oauthClient, showEdit]
|
|
);
|
|
|
|
const rootAction = useMenuAction(actions);
|
|
|
|
return (
|
|
<DropdownMenu action={rootAction} ariaLabel={t("Show menu")}>
|
|
<OverflowMenuButton />
|
|
</DropdownMenu>
|
|
);
|
|
}
|
|
|
|
export default observer(OAuthClientMenu);
|