+
+ {
+ setMapping((prev) => {
+ const copy = createCopy(prev);
+ const col = copy[idx].column;
+ if (col.id) {
+ if (UNSUPPORTED_TYPES_BY_NOTION.includes(col.type)) {
+ copy[idx] = {
+ ...copy[idx],
+ error: {
+ type: ERRORS.UNSUPPORTED_TYPE,
+ },
+ question: item,
+ };
+ return copy;
+ }
+
+ const isValidColType = TYPE_MAPPING[item.type].includes(col.type);
+ if (!isValidColType) {
+ copy[idx] = {
+ ...copy[idx],
+ error: {
+ type: ERRORS.MAPPING,
+ },
+ question: item,
+ };
+ return copy;
+ }
+ }
+
+ copy[idx] = {
+ ...copy[idx],
+ question: item,
+ error: null,
+ };
+ return copy;
+ });
+ }}
+ disabled={questionItems.length === 0}
+ />
+
+
+
+ {
+ setMapping((prev) => {
+ const copy = createCopy(prev);
+ const ques = copy[idx].question;
+ if (ques.id) {
+ const isValidQuesType = TYPE_MAPPING[ques.type].includes(item.type);
+
+ if (UNSUPPORTED_TYPES_BY_NOTION.includes(item.type)) {
+ copy[idx] = {
+ ...copy[idx],
+ error: {
+ type: ERRORS.UNSUPPORTED_TYPE,
+ },
+ column: item,
+ };
+ return copy;
+ }
+
+ if (!isValidQuesType) {
+ copy[idx] = {
+ ...copy[idx],
+ error: {
+ type: ERRORS.MAPPING,
+ },
+ column: item,
+ };
+ return copy;
+ }
+ }
+ copy[idx] = {
+ ...copy[idx],
+ column: item,
+ error: null,
+ };
+ return copy;
+ });
+ }}
+ disabled={dbItems.length === 0}
+ />
+
+