refactor: Setting redesign (#11124)
Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
1 parent
85a1713897
commit
685be1663e
33 files changed
+1184
-782
No files matched your search
@@ -11,6 +11,7 @@ import {
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
showToast,
|
||||
} from "@calcom/ui";
|
||||
import { MoreHorizontal, Edit2, Trash } from "@calcom/ui/components/icon";
|
||||
|
||||
@@ -34,22 +35,31 @@ const ApiKeyListItem = ({
|
||||
const deleteApiKey = trpc.viewer.apiKeys.delete.useMutation({
|
||||
async onSuccess() {
|
||||
await utils.viewer.apiKeys.list.invalidate();
|
||||
showToast(t("api_key_deleted"), "success");
|
||||
},
|
||||
onError(err) {
|
||||
console.log(err);
|
||||
showToast(t("something_went_wrong"), "error");
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<div
|
||||
key={apiKey.id}
|
||||
className={classNames("flex w-full justify-between p-4", lastItem ? "" : "border-subtle border-b")}>
|
||||
className={classNames(
|
||||
"flex w-full justify-between px-4 py-4 sm:px-6",
|
||||
lastItem ? "" : "border-subtle border-b"
|
||||
)}>
|
||||
<div>
|
||||
<p className="font-medium"> {apiKey?.note ? apiKey.note : t("api_key_no_note")}</p>
|
||||
<div className="flex items-center space-x-3.5">
|
||||
<div className="flex gap-1">
|
||||
<p className="text-sm font-semibold"> {apiKey?.note ? apiKey.note : t("api_key_no_note")}</p>
|
||||
{!neverExpires && isExpired && <Badge variant="red">{t("expired")}</Badge>}
|
||||
{!isExpired && <Badge variant="green">{t("active")}</Badge>}
|
||||
<p className="text-default text-xs">
|
||||
{" "}
|
||||
</div>
|
||||
<div className="mt-1 flex items-center space-x-3.5">
|
||||
<p className="text-default text-sm">
|
||||
{neverExpires ? (
|
||||
<div className="text-subtle flex flex-row space-x-3">{t("api_key_never_expires")}</div>
|
||||
<div className="flex flex-row space-x-3">{t("api_key_never_expires")}</div>
|
||||
) : (
|
||||
`${isExpired ? t("expired") : t("expires")} ${dayjs(apiKey?.expiresAt?.toString()).fromNow()}`
|
||||
)}
|
||||
@@ -71,6 +81,8 @@ const ApiKeyListItem = ({
|
||||
<DropdownMenuItem>
|
||||
<DropdownItem
|
||||
type="button"
|
||||
color="destructive"
|
||||
disabled={deleteApiKey.isLoading}
|
||||
onClick={() =>
|
||||
deleteApiKey.mutate({
|
||||
id: apiKey.id,
|
||||
|
||||
@@ -145,7 +145,7 @@ const CreateConnectionDialog = ({
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<DialogFooter showDivider className="mt-10">
|
||||
<DialogFooter showDivider className="relative mt-10">
|
||||
<Button
|
||||
type="button"
|
||||
color="secondary"
|
||||
|
||||
@@ -6,7 +6,20 @@ import OIDCConnection from "@calcom/features/ee/sso/components/OIDCConnection";
|
||||
import SAMLConnection from "@calcom/features/ee/sso/components/SAMLConnection";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { AppSkeletonLoader as SkeletonLoader, Meta, Alert } from "@calcom/ui";
|
||||
import { Meta, Alert, SkeletonContainer, SkeletonText } from "@calcom/ui";
|
||||
|
||||
const SkeletonLoader = ({ title, description }: { title: string; description: string }) => {
|
||||
return (
|
||||
<SkeletonContainer>
|
||||
<Meta title={title} description={description} borderInShellHeader={true} />
|
||||
<div className="divide-subtle border-subtle space-y-6 rounded-b-xl border border-t-0 px-6 py-4">
|
||||
<SkeletonText className="h-8 w-full" />
|
||||
<SkeletonText className="h-8 w-full" />
|
||||
<SkeletonText className="h-8 w-full" />
|
||||
</div>
|
||||
</SkeletonContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default function SSOConfiguration({ teamId }: { teamId: number | null }) {
|
||||
const [errorMessage, setErrorMessage] = useState("");
|
||||
@@ -22,14 +35,18 @@ export default function SSOConfiguration({ teamId }: { teamId: number | null })
|
||||
);
|
||||
|
||||
if (isLoading) {
|
||||
return <SkeletonLoader />;
|
||||
return <SkeletonLoader title={t("sso_configuration")} description={t("sso_configuration_description")} />;
|
||||
}
|
||||
|
||||
if (errorMessage) {
|
||||
return (
|
||||
<>
|
||||
<Meta title={t("sso_configuration")} description={t("saml_description")} />
|
||||
<Alert severity="warning" message={t(errorMessage)} className="mb-4 " />
|
||||
<Meta
|
||||
title={t("sso_configuration")}
|
||||
description={t("sso_configuration_description")}
|
||||
borderInShellHeader={true}
|
||||
/>
|
||||
<Alert severity="warning" message={t(errorMessage)} className="mt-4" />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -38,7 +55,7 @@ export default function SSOConfiguration({ teamId }: { teamId: number | null })
|
||||
if (!connection) {
|
||||
return (
|
||||
<LicenseRequired>
|
||||
<div className="flex flex-col space-y-10">
|
||||
<div className="[&>*]:border-subtle flex flex-col [&>*:last-child]:rounded-b-xl [&>*]:border [&>*]:border-t-0 [&>*]:px-4 [&>*]:py-6 [&>*]:sm:px-6">
|
||||
<SAMLConnection teamId={teamId} connection={null} />
|
||||
<OIDCConnection teamId={teamId} connection={null} />
|
||||
</div>
|
||||
@@ -48,7 +65,7 @@ export default function SSOConfiguration({ teamId }: { teamId: number | null })
|
||||
|
||||
return (
|
||||
<LicenseRequired>
|
||||
<div className="flex flex-col space-y-6">
|
||||
<div className="[&>*]:border-subtle flex flex-col [&>*:last-child]:rounded-b-xl [&>*]:border [&>*]:border-t-0 [&>*]:px-4 [&>*]:py-6 [&>*]:sm:px-6">
|
||||
{connection.type === "saml" ? (
|
||||
<SAMLConnection teamId={teamId} connection={connection} />
|
||||
) : (
|
||||
|
||||
@@ -19,8 +19,12 @@ const SAMLSSO = () => {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="bg-default w-full sm:mx-0 xl:mt-0">
|
||||
<Meta title={t("sso_configuration")} description={t("sso_configuration_description")} />
|
||||
<div className="bg-default w-full sm:mx-0">
|
||||
<Meta
|
||||
title={t("sso_configuration")}
|
||||
description={t("sso_configuration_description")}
|
||||
borderInShellHeader={true}
|
||||
/>
|
||||
<SSOConfiguration teamId={null} />
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user