powr-sdk-web 3.4.3 → 3.4.5
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);
|
|
@@ -295,15 +298,19 @@ var CreatePost = function CreatePost(_ref) {
|
|
|
295
298
|
}
|
|
296
299
|
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
297
300
|
type: "submit",
|
|
298
|
-
disabled: isSubmitting,
|
|
299
|
-
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",
|
|
301
|
+
disabled: isSubmitting || !content.trim() && media.length === 0,
|
|
300
302
|
style: {
|
|
303
|
+
padding: '12px 24px',
|
|
304
|
+
backgroundColor: !content.trim() && media.length === 0 ? '#9ca3af' : '#16a34a',
|
|
305
|
+
color: 'white',
|
|
306
|
+
border: "2px solid ".concat(!content.trim() && media.length === 0 ? '#9ca3af' : '#16a34a'),
|
|
307
|
+
borderRadius: '8px',
|
|
308
|
+
fontSize: '16px',
|
|
309
|
+
fontWeight: 'bold',
|
|
310
|
+
cursor: !content.trim() && media.length === 0 ? 'not-allowed' : 'pointer',
|
|
301
311
|
minWidth: '120px',
|
|
302
312
|
minHeight: '48px',
|
|
303
|
-
|
|
304
|
-
zIndex: 5,
|
|
305
|
-
opacity: 1,
|
|
306
|
-
visibility: 'visible'
|
|
313
|
+
opacity: !content.trim() && media.length === 0 ? 0.6 : 1
|
|
307
314
|
}
|
|
308
315
|
}, isSubmitting ? 'Posting...' : 'Post'))));
|
|
309
316
|
};
|