-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds UI for creating webhook type campaigns (#130)
* Adds UI for creating webhook type campaigns More fixes to dropdowns Improves locale creation * Fixes linter
- Loading branch information
Showing
21 changed files
with
274 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,4 +142,8 @@ | |
|
||
.push-notification .notification-body { | ||
grid-area: body; | ||
} | ||
|
||
.webhook-frame { | ||
padding: 20px 10px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import TextInput, { TextInputProps } from './TextInput' | ||
import { FieldProps } from '../../types' | ||
import { FieldPath, FieldValues, useController } from 'react-hook-form' | ||
import { useState } from 'react' | ||
|
||
export default function JsonField<X extends FieldValues, P extends FieldPath<X>>({ | ||
form, | ||
name, | ||
required, | ||
...rest | ||
}: Omit<TextInputProps<P>, 'onChange' | 'onBlur' | 'value'> & FieldProps<X, P>) { | ||
const { field: { ref, value, ...field }, fieldState } = useController({ | ||
control: form.control, | ||
name, | ||
rules: { | ||
required, | ||
}, | ||
}) | ||
const [jsonValue, setJsonValue] = useState(JSON.stringify(value)) | ||
|
||
return ( | ||
<TextInput | ||
{...rest} | ||
{...field} | ||
value={jsonValue} | ||
inputRef={ref} | ||
onChange={async (value) => { | ||
setJsonValue(value) | ||
await field.onChange?.(JSON.parse(value)) | ||
}} | ||
required={required} | ||
error={fieldState.error?.message} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.