mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
@@ -38,11 +38,7 @@ const emailOnCreate = (config: EmailOnTriggerConfig) =>
|
||||
);
|
||||
const from = await config.from(snapshotData, db);
|
||||
const to = await config.to(snapshotData, db);
|
||||
|
||||
console.log(
|
||||
JSON.stringify({ to, from, hasAllRequiredFields, shouldSend })
|
||||
);
|
||||
|
||||
console.log({ attachments: snapshotData.attachments });
|
||||
if (shouldSend && hasAllRequiredFields) {
|
||||
const msg = {
|
||||
from,
|
||||
@@ -58,10 +54,9 @@ const emailOnCreate = (config: EmailOnTriggerConfig) =>
|
||||
categories: config.categories,
|
||||
attachments: snapshotData.attachments,
|
||||
};
|
||||
console.log(JSON.stringify(msg));
|
||||
|
||||
const resp = await sendEmail(msg);
|
||||
console.log(JSON.stringify(resp));
|
||||
|
||||
return resp;
|
||||
} else {
|
||||
console.log("requirements were not met");
|
||||
@@ -95,7 +90,6 @@ const emailOnUpdate = (config: EmailOnTriggerConfig) =>
|
||||
if (shouldSend && hasAllRequiredFields) {
|
||||
const from = await config.from(afterData, db);
|
||||
const to = await config.to(afterData, db);
|
||||
console.log(JSON.stringify({ to }));
|
||||
const msg = {
|
||||
from,
|
||||
personalizations: [
|
||||
@@ -107,8 +101,7 @@ const emailOnUpdate = (config: EmailOnTriggerConfig) =>
|
||||
template_id: config.templateId,
|
||||
categories: config.categories,
|
||||
};
|
||||
const resp = await sendEmail(msg);
|
||||
console.log(JSON.stringify(resp));
|
||||
await sendEmail(msg);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -19,6 +19,7 @@ export interface ITextProps
|
||||
extends IFieldProps,
|
||||
Omit<FilledTextFieldProps, "variant" | "name"> {
|
||||
fieldVariant?: "short" | "long" | "email" | "phone" | "number" | "url";
|
||||
config: { maxLength: string };
|
||||
}
|
||||
|
||||
export default function Text({
|
||||
@@ -27,30 +28,34 @@ export default function Text({
|
||||
docRef,
|
||||
fieldVariant = "short",
|
||||
editable,
|
||||
config,
|
||||
...props
|
||||
}: ITextProps) {
|
||||
const classes = useStyles();
|
||||
let variantProps = {};
|
||||
|
||||
const { maxLength } = config;
|
||||
switch (fieldVariant) {
|
||||
case "long":
|
||||
variantProps = {
|
||||
multiline: true,
|
||||
InputProps: { classes: { multiline: classes.multiline } },
|
||||
inputProps: { rowsMin: 5 },
|
||||
inputProps: { rowsMin: 5, maxLength },
|
||||
};
|
||||
break;
|
||||
|
||||
case "email":
|
||||
variantProps = {
|
||||
// type: "email",
|
||||
inputProps: { autoComplete: "email" },
|
||||
inputProps: { autoComplete: "email", maxLength },
|
||||
};
|
||||
break;
|
||||
|
||||
case "phone":
|
||||
// TODO: add mask, validation
|
||||
variantProps = { type: "tel", inputProps: { autoComplete: "tel" } };
|
||||
variantProps = {
|
||||
type: "tel",
|
||||
inputProps: { autoComplete: "tel", maxLength },
|
||||
};
|
||||
break;
|
||||
|
||||
case "number":
|
||||
@@ -59,6 +64,7 @@ export default function Text({
|
||||
|
||||
case "short":
|
||||
default:
|
||||
variantProps = { inputProps: { maxLength } };
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,18 +114,18 @@ export default function SideDrawer() {
|
||||
field.fieldVariant = "number";
|
||||
break;
|
||||
|
||||
case FieldType.singleSelect:
|
||||
case FieldType.multiSelect:
|
||||
case FieldType.connectTable:
|
||||
case FieldType.subTable:
|
||||
case FieldType.action:
|
||||
field.config = column.config;
|
||||
break;
|
||||
// case FieldType.singleSelect:
|
||||
// case FieldType.multiSelect:
|
||||
// case FieldType.connectTable:
|
||||
// case FieldType.subTable:
|
||||
// case FieldType.action:
|
||||
// break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
field.editable = column.editable;
|
||||
field.config = column.config;
|
||||
return field;
|
||||
});
|
||||
|
||||
|
||||
@@ -28,6 +28,22 @@ const CodeEditor = lazy(
|
||||
);
|
||||
const ConfigFields = ({ fieldType, config, handleChange, tables, columns }) => {
|
||||
switch (fieldType) {
|
||||
case FieldType.longText:
|
||||
case FieldType.shortText:
|
||||
return (
|
||||
<>
|
||||
<TextField
|
||||
type="number"
|
||||
value={config.maxLength}
|
||||
label={"Character Limit"}
|
||||
fullWidth
|
||||
onChange={(e) => {
|
||||
if (e.target.value === "0") handleChange("maxLength")(null);
|
||||
else handleChange("maxLength")(e.target.value);
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
case FieldType.singleSelect:
|
||||
case FieldType.multiSelect:
|
||||
return (
|
||||
|
||||
@@ -72,14 +72,14 @@ class TextEditor extends React.Component<
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
const { maxLength } = (column as any).config;
|
||||
return (
|
||||
<TextField
|
||||
defaultValue={value}
|
||||
type={inputType}
|
||||
fullWidth
|
||||
variant="standard"
|
||||
inputProps={{ ref: this.inputRef }}
|
||||
inputProps={{ ref: this.inputRef, maxLength: maxLength }}
|
||||
className={classes.root}
|
||||
InputProps={{
|
||||
classes: { root: classes.inputBase, input: classes.input },
|
||||
|
||||
Reference in New Issue
Block a user