2023-11-27 11:45:48 +00:00
|
|
|
import React from "react";
|
|
|
|
import { observer } from "mobx-react-lite";
|
|
|
|
// mobx store
|
|
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
|
|
|
// layouts
|
2023-11-15 10:26:57 +00:00
|
|
|
import { AppLayout } from "layouts/app-layout";
|
|
|
|
import { WorkspaceSettingLayout } from "layouts/settings-layout";
|
2023-11-27 11:45:48 +00:00
|
|
|
// components
|
|
|
|
import { WorkspaceSettingHeader } from "components/headers";
|
|
|
|
import { WebhookForm } from "components/web-hooks";
|
|
|
|
// types
|
|
|
|
import { NextPageWithLayout } from "types/app";
|
2023-11-15 10:26:57 +00:00
|
|
|
|
2023-11-27 11:45:48 +00:00
|
|
|
const CreateWebhookPage: NextPageWithLayout = observer(() => {
|
|
|
|
const {
|
|
|
|
user: { currentWorkspaceRole },
|
|
|
|
} = useMobxStore();
|
2023-11-15 10:26:57 +00:00
|
|
|
|
2023-11-27 11:45:48 +00:00
|
|
|
const isAdmin = currentWorkspaceRole === 20;
|
2023-11-15 10:26:57 +00:00
|
|
|
|
2023-11-27 11:45:48 +00:00
|
|
|
if (!isAdmin)
|
|
|
|
return (
|
2023-12-10 10:18:10 +00:00
|
|
|
<div className="mt-10 flex h-full w-full justify-center p-4">
|
|
|
|
<p className="text-sm text-custom-text-300">You are not authorized to access this page.</p>
|
2023-11-27 11:45:48 +00:00
|
|
|
</div>
|
|
|
|
);
|
2023-11-15 10:26:57 +00:00
|
|
|
|
2023-11-27 11:45:48 +00:00
|
|
|
return (
|
2023-12-10 10:18:10 +00:00
|
|
|
<div className="w-full overflow-y-auto py-8 pl-1 pr-9">
|
2023-11-27 11:45:48 +00:00
|
|
|
<WebhookForm />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
});
|
2023-11-15 10:26:57 +00:00
|
|
|
|
2023-11-27 11:45:48 +00:00
|
|
|
CreateWebhookPage.getLayout = function getLayout(page: React.ReactElement) {
|
2023-11-15 10:26:57 +00:00
|
|
|
return (
|
2023-11-27 11:45:48 +00:00
|
|
|
<AppLayout header={<WorkspaceSettingHeader title="Webhook settings" />}>
|
|
|
|
<WorkspaceSettingLayout>{page}</WorkspaceSettingLayout>
|
2023-11-15 10:26:57 +00:00
|
|
|
</AppLayout>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2023-11-27 11:45:48 +00:00
|
|
|
export default CreateWebhookPage;
|