refactor: remove New OAuth client button from admin page (#27181)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
6a532c2271
commit
f5d79a1470
3 files changed
+28
-97
No files matched your search
@@ -6,7 +6,6 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
|
||||
import { OAuthClientsAdminSkeleton } from "./oauth-clients-admin-skeleton";
|
||||
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
|
||||
|
||||
@@ -15,7 +14,6 @@ import { OAuthClientCreateDialog } from "../oauth/create/OAuthClientCreateModal"
|
||||
import { OAuthClientPreviewDialog } from "../oauth/create/OAuthClientPreviewDialog";
|
||||
import { OAuthClientDetailsDialog, type OAuthClientDetails } from "../oauth/view/OAuthClientDetailsDialog";
|
||||
import { OAuthClientsList } from "../oauth/OAuthClientsList";
|
||||
import { NewOAuthClientButton } from "../oauth/create/NewOAuthClientButton";
|
||||
|
||||
export default function OAuthClientsAdminView() {
|
||||
const { t } = useLocale();
|
||||
@@ -109,60 +107,38 @@ export default function OAuthClientsAdminView() {
|
||||
return <OAuthClientsAdminSkeleton />;
|
||||
}
|
||||
|
||||
const newOAuthClientButton = (
|
||||
<NewOAuthClientButton
|
||||
dataTestId="open-admin-oauth-client-create-dialog"
|
||||
onClick={() => setIsCreatingClient(true)}
|
||||
/>
|
||||
);
|
||||
|
||||
const hasClients =
|
||||
(pendingClients && pendingClients.length > 0) ||
|
||||
(rejectedClients && rejectedClients.length > 0) ||
|
||||
(approvedClients && approvedClients.length > 0);
|
||||
|
||||
return (
|
||||
<SettingsHeader
|
||||
title={t("oauth_clients_admin")}
|
||||
description={t("oauth_clients_admin_description")}
|
||||
CTA={newOAuthClientButton}>
|
||||
{hasClients ? (
|
||||
<div className="space-y-10">
|
||||
<div className="space-y-3" data-testid="oauth-client-admin-pending-section">
|
||||
<h2 className="text-emphasis text-base font-semibold">{t("pending")}</h2>
|
||||
<OAuthClientsList
|
||||
clients={pendingClients ?? []}
|
||||
onSelectClient={(client) => setSelectedClient(client)}
|
||||
showStatus
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3" data-testid="oauth-client-admin-rejected-section">
|
||||
<h2 className="text-emphasis text-base font-semibold">{t("rejected")}</h2>
|
||||
<OAuthClientsList
|
||||
clients={rejectedClients ?? []}
|
||||
onSelectClient={(client) => setSelectedClient(client)}
|
||||
showStatus
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3" data-testid="oauth-client-admin-approved-section">
|
||||
<h2 className="text-emphasis text-base font-semibold">{t("approved")}</h2>
|
||||
<OAuthClientsList
|
||||
clients={approvedClients ?? []}
|
||||
onSelectClient={(client) => setSelectedClient(client)}
|
||||
showStatus
|
||||
/>
|
||||
</div>
|
||||
description={t("oauth_clients_admin_description")}>
|
||||
<div className="space-y-10">
|
||||
<div className="space-y-3" data-testid="oauth-client-admin-pending-section">
|
||||
<h2 className="text-emphasis text-base font-semibold">{t("pending")}</h2>
|
||||
<OAuthClientsList
|
||||
clients={pendingClients ?? []}
|
||||
onSelectClient={(client) => setSelectedClient(client)}
|
||||
showStatus
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<EmptyScreen
|
||||
Icon="key"
|
||||
headline={t("no_oauth_clients")}
|
||||
description={t("no_oauth_clients_admin_description")}
|
||||
buttonRaw={newOAuthClientButton}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="space-y-3" data-testid="oauth-client-admin-rejected-section">
|
||||
<h2 className="text-emphasis text-base font-semibold">{t("rejected")}</h2>
|
||||
<OAuthClientsList
|
||||
clients={rejectedClients ?? []}
|
||||
onSelectClient={(client) => setSelectedClient(client)}
|
||||
showStatus
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3" data-testid="oauth-client-admin-approved-section">
|
||||
<h2 className="text-emphasis text-base font-semibold">{t("approved")}</h2>
|
||||
<OAuthClientsList
|
||||
clients={approvedClients ?? []}
|
||||
onSelectClient={(client) => setSelectedClient(client)}
|
||||
showStatus
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{createdClient ? (
|
||||
<OAuthClientPreviewDialog
|
||||
|
||||
Reference in new issue
Block a user