diff --git a/packages/frontend/src/pages/org-slug/projects/id/settings/Git.tsx b/packages/frontend/src/pages/org-slug/projects/id/settings/Git.tsx index aa83bb65..b753b7ad 100644 --- a/packages/frontend/src/pages/org-slug/projects/id/settings/Git.tsx +++ b/packages/frontend/src/pages/org-slug/projects/id/settings/Git.tsx @@ -1,18 +1,15 @@ -import { useCallback, useEffect } from 'react'; +import { useCallback, useEffect, useState } from 'react'; import { useOutletContext } from 'react-router-dom'; import { SubmitHandler, useForm } from 'react-hook-form'; -import toast from 'react-hot-toast'; -import { - Button, - Input, - Switch, - Typography, -} from '@snowballtools/material-tailwind-react-fork'; - -import WebhookCard from '../../../../../components/projects/project/settings/WebhookCard'; +import WebhookCard from 'components/projects/project/settings/WebhookCard'; import { useGQLClient } from '../../../../../context/GQLClientContext'; -import { OutletContextType } from '../../../../../types/types'; +import { OutletContextType } from '../../../../../types'; +import { Button } from 'components/shared/Button'; +import { Input } from 'components/shared/Input'; +import { Switch } from 'components/shared/Switch'; +import { Heading } from 'components/shared/Heading'; +import { useToast } from 'components/shared/Toast'; type UpdateProdBranchValues = { prodBranch: string; @@ -24,8 +21,12 @@ type UpdateWebhooksValues = { const GitTabPanel = () => { const client = useGQLClient(); + const { toast } = useToast(); const { project, onUpdate } = useOutletContext(); + const [pullRequestComments, updatePullRequestComments] = useState(true); + const [commitComments, updateCommitComments] = useState(false); + const { register: registerProdBranch, handleSubmit: handleSubmitProdBranch, @@ -45,9 +46,19 @@ const GitTabPanel = () => { if (updateProject) { await onUpdate(); - toast.success('Production branch upadated successfully'); + toast({ + id: 'prod_branch_updated', + title: 'Production branch updated successfully', + variant: 'success', + onDismiss() {}, + }); } else { - toast.error('Error updating production branch'); + toast({ + id: 'prod_branch_update_failed', + title: 'Error updating production branch', + variant: 'error', + onDismiss() {}, + }); } }, [project], @@ -72,9 +83,19 @@ const GitTabPanel = () => { if (updateProject) { await onUpdate(); - toast.success('Webhook added successfully'); + toast({ + id: 'webhook_added', + title: 'Webhook added successfully', + variant: 'success', + onDismiss() {}, + }); } else { - toast.error('Error adding webhook'); + toast({ + id: 'webhook_add_failed', + title: 'Error adding webhook', + variant: 'error', + onDismiss() {}, + }); } resetWebhooks(); @@ -96,80 +117,107 @@ const GitTabPanel = () => { if (updateProject) { await onUpdate(); - toast.success('Webhook deleted successfully'); + toast({ + id: 'webhook_deleted', + title: 'Webhook deleted successfully', + variant: 'success', + onDismiss() {}, + }); } else { - toast.error('Error deleting webhook'); + toast({ + id: 'webhook_delete_failed', + title: 'Error deleting webhook', + variant: 'error', + onDismiss() {}, + }); } }; return ( - <> -
- +
+
+ Git repository - +
- Pull request comments +

+ Pull request comments +

- + updatePullRequestComments(!pullRequestComments)} + />
- Commit comments +

+ Commit comments +

- + updateCommitComments(!commitComments)} + />
-
-
- - Production branch - - - By default, each commit pushed to the{' '} - {project.prodBranch} branch - initiates a production deployment. You can opt for a different - branch for deployment in the settings. - - Branch name - - -
+ + + Production branch + +

+ By default, each commit pushed to the{' '} + {project.prodBranch} branch + initiates a production deployment. You can opt for a different branch + for deployment in the settings. +

+

+ Branch name +

+ +
-
-
- - Deploy webhooks - - - Webhooks configured to trigger when there is a change in a - project's build or deployment status. - -
-
- Webhook URL - -
-
- -
+ + + Deploy webhooks + +

+ {' '} + Webhooks configured to trigger when there is a change in a + project's build or deployment status. +

+
+
+

+ Webhook URL +

+ +
+
+
-
+
{project.webhooks.map((webhookUrl, index) => { return ( { ); })}
- +
); };