Update webhook settings UI and functionality
This commit is contained in:
parent
29252679a1
commit
5bf0724c2f
1 changed files with 63 additions and 43 deletions
|
@ -7,6 +7,8 @@ import {
|
||||||
CircularProgress,
|
CircularProgress,
|
||||||
Container,
|
Container,
|
||||||
Divider,
|
Divider,
|
||||||
|
FormControl,
|
||||||
|
FormHelperText,
|
||||||
Input,
|
Input,
|
||||||
Typography,
|
Typography,
|
||||||
} from '@mui/joy'
|
} from '@mui/joy'
|
||||||
|
@ -28,6 +30,7 @@ import {
|
||||||
PutWebhookURL,
|
PutWebhookURL,
|
||||||
UpdatePassword,
|
UpdatePassword,
|
||||||
} from '../../utils/Fetcher'
|
} from '../../utils/Fetcher'
|
||||||
|
import { isPlusAccount } from '../../utils/Helpers'
|
||||||
import PassowrdChangeModal from '../Modals/Inputs/PasswordChangeModal'
|
import PassowrdChangeModal from '../Modals/Inputs/PasswordChangeModal'
|
||||||
import APITokenSettings from './APITokenSettings'
|
import APITokenSettings from './APITokenSettings'
|
||||||
import NotificationSetting from './NotificationSetting'
|
import NotificationSetting from './NotificationSetting'
|
||||||
|
@ -327,6 +330,7 @@ const Settings = () => {
|
||||||
services when events happen in your Circle. Use the webhook URL
|
services when events happen in your Circle. Use the webhook URL
|
||||||
below to
|
below to
|
||||||
</Typography>
|
</Typography>
|
||||||
|
<FormControl sx={{ mt: 1 }}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={webhookURL !== null}
|
checked={webhookURL !== null}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -337,8 +341,22 @@ const Settings = () => {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
variant='soft'
|
variant='soft'
|
||||||
label={'Enable Webhook'}
|
label='Enable Webhook'
|
||||||
|
disabled={!isPlusAccount(userProfile)}
|
||||||
|
overlay
|
||||||
/>
|
/>
|
||||||
|
<FormHelperText
|
||||||
|
sx={{
|
||||||
|
opacity: !isPlusAccount(userProfile) ? 0.5 : 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Enable webhook notifications for tasks and things updates.{' '}
|
||||||
|
{userProfile && !isPlusAccount(userProfile) && (
|
||||||
|
<Chip variant='soft' color='warning'>
|
||||||
|
Not available in Basic Plan
|
||||||
|
</Chip>
|
||||||
|
)}
|
||||||
|
</FormHelperText>
|
||||||
<>
|
<>
|
||||||
{webhookURL !== null && (
|
{webhookURL !== null && (
|
||||||
<Typography level='title-sm'>
|
<Typography level='title-sm'>
|
||||||
|
@ -359,7 +377,7 @@ const Settings = () => {
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
variant='soft'
|
variant='soft'
|
||||||
sx={{ width: '110px' }}
|
sx={{ width: '110px', mt: 1 }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
PutWebhookURL(webhookURL).then(resp => {
|
PutWebhookURL(webhookURL).then(resp => {
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
|
@ -369,10 +387,12 @@ const Settings = () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
|
disabled={!isPlusAccount(userProfile)}
|
||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
|
</FormControl>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue