chore: Name API keys consistently as the model

This commit is contained in:
Tom Moor
2023-04-08 14:16:49 -04:00
parent aab3a49f2c
commit 3115bbd5ef
7 changed files with 35 additions and 39 deletions

View File

@@ -3,7 +3,7 @@ import * as React from "react";
import { useTranslation } from "react-i18next";
import { useMenuState } from "reakit/Menu";
import ApiKey from "~/models/ApiKey";
import TokenRevokeDialog from "~/scenes/Settings/components/TokenRevokeDialog";
import ApiKeyRevokeDialog from "~/scenes/Settings/components/ApiKeyRevokeDialog";
import ContextMenu from "~/components/ContextMenu";
import MenuItem from "~/components/ContextMenu/MenuItem";
import OverflowMenuButton from "~/components/ContextMenu/OverflowMenuButton";
@@ -11,12 +11,10 @@ import useStores from "~/hooks/useStores";
type Props = {
/** The apiKey to associate with the menu */
token: ApiKey;
/** CSS class name */
className?: string;
apiKey: ApiKey;
};
function ApiKeyMenu({ token, className }: Props) {
function ApiKeyMenu({ apiKey }: Props) {
const menu = useMenuState({
modal: true,
});
@@ -28,18 +26,14 @@ function ApiKeyMenu({ token, className }: Props) {
title: t("Revoke token"),
isCentered: true,
content: (
<TokenRevokeDialog onSubmit={dialogs.closeAllModals} token={token} />
<ApiKeyRevokeDialog onSubmit={dialogs.closeAllModals} apiKey={apiKey} />
),
});
}, [t, dialogs, token]);
}, [t, dialogs, apiKey]);
return (
<>
<OverflowMenuButton
aria-label={t("Show menu")}
className={className}
{...menu}
/>
<OverflowMenuButton aria-label={t("Show menu")} {...menu} />
<ContextMenu {...menu}>
<MenuItem {...menu} onClick={handleRevoke} dangerous>
{t("Revoke")}