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 (
|
|
|
|
<div className="h-full w-full flex justify-center mt-10 p-4">
|
|
|
|
<p className="text-custom-text-300 text-sm">You are not authorized to access this page.</p>
|
|
|
|
</div>
|
|
|
|
);
|
2023-11-15 10:26:57 +00:00
|
|
|
|
2023-11-27 11:45:48 +00:00
|
|
|
return (
|
|
|
|
<div className="w-full overflow-y-auto py-8 pr-9 pl-1">
|
|
|
|
<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;
|