Skip to content

Commit

Permalink
Add canSave
Browse files Browse the repository at this point in the history
  • Loading branch information
thomtrp committed Jul 31, 2024
1 parent 632e2f5 commit 588cccb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { ClipboardEvent } from 'react';
import { filterSuggestionItems } from '@blocknote/core';
import { BlockNoteView } from '@blocknote/mantine';
import { SuggestionMenuController } from '@blocknote/react';

import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { ClipboardEvent } from 'react';

import { blockSchema } from '@/activities/blocks/schema';
import { getSlashMenu } from '@/activities/blocks/slashMenu';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export const SettingsDevelopersWebhooksDetail = () => {
navigate('/settings/developers');
};
const formConfig = useForm<SettingsDevelopersWebhooksDetailForm>();

const { isDirty, isValid, isSubmitting } = formConfig.formState;
const canSave = isDirty && isValid && !isSubmitting;

const handleSave = async (
formValues: SettingsDevelopersWebhooksDetailForm,
) => {
Expand Down Expand Up @@ -76,6 +80,7 @@ export const SettingsDevelopersWebhooksDetail = () => {
<SaveAndCancelButtons
onCancel={() => navigate(`/settings/developers`)}
onSave={formConfig.handleSubmit(handleSave)}
isSaveDisabled={!canSave}
/>
</SettingsHeaderContainer>
<Section>
Expand Down

0 comments on commit 588cccb

Please sign in to comment.