powr-sdk-web 3.4.4 → 3.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _auth = require("../../utils/auth");
|
|
10
|
+
var _reactHotToast = _interopRequireDefault(require("react-hot-toast"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
12
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t4 in e) "default" !== _t4 && {}.hasOwnProperty.call(e, _t4) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t4)) && (i.get || i.set) ? o(f, _t4, i) : f[_t4] = e[_t4]); return f; })(e, t); }
|
|
11
13
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
12
14
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -59,13 +61,14 @@ var CreatePost = function CreatePost(_ref) {
|
|
|
59
61
|
while (1) switch (_context.n) {
|
|
60
62
|
case 0:
|
|
61
63
|
e.preventDefault();
|
|
64
|
+
|
|
65
|
+
// Check if there's any content or media
|
|
62
66
|
if (!(!content.trim() && media.length === 0)) {
|
|
63
67
|
_context.n = 1;
|
|
64
68
|
break;
|
|
65
69
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
70
|
+
// For validation errors, show a toast notification
|
|
71
|
+
_reactHotToast["default"].error('Please add some content or media to your post');
|
|
69
72
|
return _context.a(2);
|
|
70
73
|
case 1:
|
|
71
74
|
setIsSubmitting(true);
|
|
@@ -288,41 +291,26 @@ var CreatePost = function CreatePost(_ref) {
|
|
|
288
291
|
}), /*#__PURE__*/_react["default"].createElement("p", {
|
|
289
292
|
className: "text-xs text-gray-500 mt-1"
|
|
290
293
|
}, "Supported: Images, PDF, DOC, DOCX, TXT")), /*#__PURE__*/_react["default"].createElement("div", {
|
|
291
|
-
className: "flex justify-end mt-4
|
|
294
|
+
className: "flex justify-end mt-4",
|
|
292
295
|
style: {
|
|
293
296
|
position: 'relative',
|
|
294
297
|
zIndex: 10
|
|
295
298
|
}
|
|
296
299
|
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
297
|
-
type: "
|
|
298
|
-
|
|
299
|
-
return alert('Test button works!');
|
|
300
|
-
},
|
|
300
|
+
type: "submit",
|
|
301
|
+
disabled: isSubmitting || !content.trim() && media.length === 0,
|
|
301
302
|
style: {
|
|
302
303
|
padding: '12px 24px',
|
|
303
|
-
backgroundColor: '
|
|
304
|
+
backgroundColor: !content.trim() && media.length === 0 ? '#9ca3af' : 'hsl(24, 100%, 50%)',
|
|
304
305
|
color: 'white',
|
|
305
|
-
border: '
|
|
306
|
+
border: "2px solid ".concat(!content.trim() && media.length === 0 ? '#9ca3af' : 'hsl(24, 100%, 50%)'),
|
|
306
307
|
borderRadius: '8px',
|
|
307
308
|
fontSize: '16px',
|
|
308
309
|
fontWeight: 'bold',
|
|
309
|
-
cursor: 'pointer'
|
|
310
|
-
}
|
|
311
|
-
}, "Test Button"), /*#__PURE__*/_react["default"].createElement("button", {
|
|
312
|
-
type: "submit",
|
|
313
|
-
disabled: isSubmitting,
|
|
314
|
-
className: "px-8 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 disabled:opacity-50 disabled:cursor-not-allowed text-lg font-semibold border-2 border-green-600 shadow-lg",
|
|
315
|
-
style: {
|
|
310
|
+
cursor: !content.trim() && media.length === 0 ? 'not-allowed' : 'pointer',
|
|
316
311
|
minWidth: '120px',
|
|
317
312
|
minHeight: '48px',
|
|
318
|
-
|
|
319
|
-
zIndex: 5,
|
|
320
|
-
opacity: '1 !important',
|
|
321
|
-
visibility: 'visible !important',
|
|
322
|
-
display: 'block !important',
|
|
323
|
-
backgroundColor: '#16a34a !important',
|
|
324
|
-
color: 'white !important',
|
|
325
|
-
border: '2px solid #16a34a !important'
|
|
313
|
+
opacity: !content.trim() && media.length === 0 ? 0.6 : 1
|
|
326
314
|
}
|
|
327
315
|
}, isSubmitting ? 'Posting...' : 'Post'))));
|
|
328
316
|
};
|