datastake-daf 0.6.505 → 0.6.506
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.
- package/dist/layouts/index.js +250 -97
- package/package.json +1 -1
- package/src/@daf/layouts/AppLayout/components/MobileDrawer/index.js +2 -6
- package/src/@daf/layouts/AppLayout/components/Notifications/index.js +5 -4
- package/src/@daf/layouts/AppLayout/components/Sidenav/index.js +19 -20
- package/src/@daf/layouts/AppLayout/components/UserDropdown/index.js +57 -38
- package/src/@daf/layouts/AppLayout/index.jsx +28 -23
package/dist/layouts/index.js
CHANGED
|
@@ -5124,7 +5124,8 @@ const renderModule = ({
|
|
|
5124
5124
|
isCollapsed,
|
|
5125
5125
|
onClick,
|
|
5126
5126
|
user,
|
|
5127
|
-
userHelpers = {}
|
|
5127
|
+
userHelpers = {},
|
|
5128
|
+
goTo = () => {}
|
|
5128
5129
|
}) => {
|
|
5129
5130
|
const {
|
|
5130
5131
|
userIsAdmin,
|
|
@@ -5193,7 +5194,7 @@ const Sidenav = ({
|
|
|
5193
5194
|
isCollapsed = false,
|
|
5194
5195
|
showMenu = true,
|
|
5195
5196
|
sidenavConfig = {},
|
|
5196
|
-
|
|
5197
|
+
goTo = () => {},
|
|
5197
5198
|
location,
|
|
5198
5199
|
matchPath,
|
|
5199
5200
|
t,
|
|
@@ -5201,7 +5202,7 @@ const Sidenav = ({
|
|
|
5201
5202
|
userHelpers = {},
|
|
5202
5203
|
isDev = false,
|
|
5203
5204
|
appName = 'app',
|
|
5204
|
-
getRedirectLink,
|
|
5205
|
+
getRedirectLink = () => {},
|
|
5205
5206
|
isDatastake,
|
|
5206
5207
|
selectedProject
|
|
5207
5208
|
}) => {
|
|
@@ -5219,19 +5220,13 @@ const Sidenav = ({
|
|
|
5219
5220
|
pathname
|
|
5220
5221
|
} = location || {};
|
|
5221
5222
|
const mod = o.useMemo(() => module, [module, user]);
|
|
5222
|
-
const _getRedirectLink = getRedirectLink || (link => {
|
|
5223
|
-
if (window.location.pathname.includes(`/${appName}`)) {
|
|
5224
|
-
return `/${appName}${link}`;
|
|
5225
|
-
}
|
|
5226
|
-
return link;
|
|
5227
|
-
});
|
|
5228
5223
|
const checkPath = i => {
|
|
5229
5224
|
if (!matchPath || !pathname) return false;
|
|
5230
5225
|
return matchPath({
|
|
5231
|
-
path:
|
|
5226
|
+
path: getRedirectLink(i.path),
|
|
5232
5227
|
exact: true
|
|
5233
5228
|
}, pathname) || i.subPath && i.subPath.filter(s => matchPath({
|
|
5234
|
-
path:
|
|
5229
|
+
path: getRedirectLink(s),
|
|
5235
5230
|
exact: true
|
|
5236
5231
|
}, pathname)).length ? true : false;
|
|
5237
5232
|
};
|
|
@@ -5268,16 +5263,19 @@ const Sidenav = ({
|
|
|
5268
5263
|
const checkOnClick = ({
|
|
5269
5264
|
event
|
|
5270
5265
|
}) => {
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
onYes: () => {}
|
|
5279
|
-
});
|
|
5266
|
+
console.log("checkOnClick", changeNotificationState);
|
|
5267
|
+
// If no changeNotificationState or no unsaved changes, execute immediately
|
|
5268
|
+
if (!changeNotificationState) {
|
|
5269
|
+
if (typeof event === 'function') {
|
|
5270
|
+
event();
|
|
5271
|
+
}
|
|
5272
|
+
return;
|
|
5280
5273
|
}
|
|
5274
|
+
|
|
5275
|
+
// Otherwise, use the notification state mechanism
|
|
5276
|
+
changeNotificationState({
|
|
5277
|
+
onYes: event
|
|
5278
|
+
});
|
|
5281
5279
|
};
|
|
5282
5280
|
const {
|
|
5283
5281
|
hoverContent,
|
|
@@ -5297,7 +5295,7 @@ const Sidenav = ({
|
|
|
5297
5295
|
setHoverOpen,
|
|
5298
5296
|
module,
|
|
5299
5297
|
notApprovedModal,
|
|
5300
|
-
goTo
|
|
5298
|
+
goTo,
|
|
5301
5299
|
hoverItemSecond,
|
|
5302
5300
|
isDev
|
|
5303
5301
|
});
|
|
@@ -5346,7 +5344,7 @@ const Sidenav = ({
|
|
|
5346
5344
|
isCollapsed,
|
|
5347
5345
|
onClick: () => checkOnClick({
|
|
5348
5346
|
event: () => {
|
|
5349
|
-
|
|
5347
|
+
goTo(getRedirectLink(`/app`));
|
|
5350
5348
|
}
|
|
5351
5349
|
}),
|
|
5352
5350
|
mod,
|
|
@@ -5378,7 +5376,7 @@ const Sidenav = ({
|
|
|
5378
5376
|
setHoverOpen: setHoverOpen,
|
|
5379
5377
|
onMouseMove: onMouseMove,
|
|
5380
5378
|
user: user,
|
|
5381
|
-
goTo:
|
|
5379
|
+
goTo: goTo,
|
|
5382
5380
|
notApprovedModal: notApprovedModal,
|
|
5383
5381
|
isDev: isDev,
|
|
5384
5382
|
t: t,
|
|
@@ -5614,7 +5612,7 @@ var browser$1 = {
|
|
|
5614
5612
|
uptime: uptime
|
|
5615
5613
|
};
|
|
5616
5614
|
|
|
5617
|
-
var process
|
|
5615
|
+
var process = browser$1;
|
|
5618
5616
|
|
|
5619
5617
|
/******************************************************************************
|
|
5620
5618
|
Copyright (c) Microsoft Corporation.
|
|
@@ -5729,7 +5727,7 @@ var unitlessKeys = {
|
|
|
5729
5727
|
strokeWidth: 1
|
|
5730
5728
|
};
|
|
5731
5729
|
|
|
5732
|
-
var f="undefined"!=typeof process$1&&void 0!==process$1.env&&(process$1.env.REACT_APP_SC_ATTR||process$1.env.SC_ATTR)||"data-styled",m="active",y="data-styled-version",v="6.1.12",g="/*!sc*/\n",S="undefined"!=typeof window&&"HTMLElement"in window,w=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process$1&&void 0!==process$1.env&&void 0!==process$1.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process$1.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process$1.env.REACT_APP_SC_DISABLE_SPEEDY&&process$1.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process$1&&void 0!==process$1.env&&void 0!==process$1.env.SC_DISABLE_SPEEDY&&""!==process$1.env.SC_DISABLE_SPEEDY?"false"!==process$1.env.SC_DISABLE_SPEEDY&&process$1.env.SC_DISABLE_SPEEDY:"production"!==process$1.env.NODE_ENV),E=/invalid hook call/i,N=new Set,P=function(t,n){if("production"!==process$1.env.NODE_ENV){var o$1=n?' with the id of "'.concat(n,'"'):"",s="The component ".concat(t).concat(o$1," has been created dynamically.\n")+"You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.",i=console.error;try{var a=!0;console.error=function(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];E.test(t)?(a=!1,N.delete(s)):i.apply(void 0,__spreadArray([t],n,!1));},o.useRef(),a&&!N.has(s)&&(console.warn(s),N.add(s));}catch(e){E.test(e.message)&&N.delete(s);}finally{console.error=i;}}},_=Object.freeze([]),C=Object.freeze({});function I(e,t,n){return void 0===n&&(n=C),e.theme!==n.theme&&e.theme||t||n.theme}var A=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),O=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,D=/(^-|-$)/g;function R(e){return e.replace(O,"-").replace(D,"")}var T=/(a)(d)/gi,k=52,j=function(e){return String.fromCharCode(e+(e>25?39:97))};function x(e){var t,n="";for(t=Math.abs(e);t>k;t=t/k|0)n=j(t%k)+n;return (j(t%k)+n).replace(T,"$1-$2")}var V,F=5381,M=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},z=function(e){return M(F,e)};function $(e){return x(z(e)>>>0)}function B(e){return "production"!==process$1.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function L(e){return "string"==typeof e&&("production"===process$1.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var G="function"==typeof Symbol&&Symbol.for,Y=G?Symbol.for("react.memo"):60115,W=G?Symbol.for("react.forward_ref"):60112,q={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},H={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},U={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},J=((V={})[W]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},V[Y]=U,V);function X(e){return ("type"in(t=e)&&t.type.$$typeof)===Y?U:"$$typeof"in e?J[e.$$typeof]:q;var t;}var Z=Object.defineProperty,K=Object.getOwnPropertyNames,Q=Object.getOwnPropertySymbols,ee=Object.getOwnPropertyDescriptor,te=Object.getPrototypeOf,ne=Object.prototype;function oe(e,t,n){if("string"!=typeof t){if(ne){var o=te(t);o&&o!==ne&&oe(e,o,n);}var r=K(t);Q&&(r=r.concat(Q(t)));for(var s=X(e),i=X(t),a=0;a<r.length;++a){var c=r[a];if(!(c in H||n&&n[c]||i&&c in i||s&&c in s)){var l=ee(t,c);try{Z(e,c,l);}catch(e){}}}}return e}function re(e){return "function"==typeof e}function se(e){return "object"==typeof e&&"styledComponentId"in e}function ie(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function ae(e,t){if(0===e.length)return "";for(var n=e[0],o=1;o<e.length;o++)n+=t?t+e[o]:e[o];return n}function ce(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function le(e,t,n){if(void 0===n&&(n=!1),!n&&!ce(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var o=0;o<t.length;o++)e[o]=le(e[o],t[o]);else if(ce(t))for(var o in t)e[o]=le(e[o],t[o]);return e}function ue(e,t){Object.defineProperty(e,"toString",{value:t});}var pe="production"!==process$1.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function de(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=e[0],o=[],r=1,s=e.length;r<s;r+=1)o.push(e[r]);return o.forEach(function(e){n=n.replace(/%[a-z]/,e);}),n}function he(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return "production"===process$1.env.NODE_ENV?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t," for more information.").concat(n.length>0?" Args: ".concat(n.join(", ")):"")):new Error(de.apply(void 0,__spreadArray([pe[t]],n,!1)).trim())}var fe=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e;}return e.prototype.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,o=n.length,r=o;e>=r;)if((r<<=1)<0)throw he(16,"".concat(e));this.groupSizes=new Uint32Array(r),this.groupSizes.set(n),this.length=r;for(var s=o;s<r;s++)this.groupSizes[s]=0;}for(var i=this.indexOfGroup(e+1),a=(s=0,t.length);s<a;s++)this.tag.insertRule(i,t[s])&&(this.groupSizes[e]++,i++);},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),o=n+t;this.groupSizes[e]=0;for(var r=n;r<o;r++)this.tag.deleteRule(n);}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],o=this.indexOfGroup(e),r=o+n,s=o;s<r;s++)t+="".concat(this.tag.getRule(s)).concat(g);return t},e}(),me=1<<30,ye=new Map,ve=new Map,ge=1,Se=function(e){if(ye.has(e))return ye.get(e);for(;ve.has(ge);)ge++;var t=ge++;if("production"!==process$1.env.NODE_ENV&&((0|t)<0||t>me))throw he(16,"".concat(t));return ye.set(e,t),ve.set(t,e),t},we=function(e,t){ge=t+1,ye.set(e,t),ve.set(t,e);},be="style[".concat(f,"][").concat(y,'="').concat(v,'"]'),Ee=new RegExp("^".concat(f,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),Ne=function(e,t,n){for(var o,r=n.split(","),s=0,i=r.length;s<i;s++)(o=r[s])&&e.registerName(t,o);},Pe=function(e,t){for(var n,o=(null!==(n=t.textContent)&&void 0!==n?n:"").split(g),r=[],s=0,i=o.length;s<i;s++){var a=o[s].trim();if(a){var c=a.match(Ee);if(c){var l=0|parseInt(c[1],10),u=c[2];0!==l&&(we(u,l),Ne(e,u,c[3]),e.getTag().insertRules(l,r)),r.length=0;}else r.push(a);}}},_e=function(e){for(var t=document.querySelectorAll(be),n=0,o=t.length;n<o;n++){var r=t[n];r&&r.getAttribute(f)!==m&&(Pe(e,r),r.parentNode&&r.parentNode.removeChild(r));}};function Ce(){return "undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null}var Ie=function(e){var t=document.head,n=e||t,o=document.createElement("style"),r=function(e){var t=Array.from(e.querySelectorAll("style[".concat(f,"]")));return t[t.length-1]}(n),s=void 0!==r?r.nextSibling:null;o.setAttribute(f,m),o.setAttribute(y,v);var i=Ce();return i&&o.setAttribute("nonce",i),n.insertBefore(o,s),o},Ae=function(){function e(e){this.element=Ie(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,o=t.length;n<o;n++){var r=t[n];if(r.ownerNode===e)return r}throw he(17)}(this.element),this.length=0;}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return !1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--;},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),Oe=function(){function e(e){this.element=Ie(e),this.nodes=this.element.childNodes,this.length=0;}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return !1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--;},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),De=function(){function e(e){this.rules=[],this.length=0;}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--;},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),Re=S,Te={isServer:!S,useCSSOMInjection:!w},ke=function(){function e(e,n,o){void 0===e&&(e=C),void 0===n&&(n={});var r=this;this.options=__assign(__assign({},Te),e),this.gs=n,this.names=new Map(o),this.server=!!e.isServer,!this.server&&S&&Re&&(Re=!1,_e(this)),ue(this,function(){return function(e){for(var t=e.getTag(),n=t.length,o="",r=function(n){var r=function(e){return ve.get(e)}(n);if(void 0===r)return "continue";var s=e.names.get(r),i=t.getGroup(n);if(void 0===s||!s.size||0===i.length)return "continue";var a="".concat(f,".g").concat(n,'[id="').concat(r,'"]'),c="";void 0!==s&&s.forEach(function(e){e.length>0&&(c+="".concat(e,","));}),o+="".concat(i).concat(a,'{content:"').concat(c,'"}').concat(g);},s=0;s<n;s++)r(s);return o}(r)});}return e.registerId=function(e){return Se(e)},e.prototype.rehydrate=function(){!this.server&&S&&_e(this);},e.prototype.reconstructWithOptions=function(n,o){return void 0===o&&(o=!0),new e(__assign(__assign({},this.options),n),this.gs,o&&this.names||void 0)},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new De(n):t?new Ae(n):new Oe(n)}(this.options),new fe(e)));var e;},e.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},e.prototype.registerName=function(e,t){if(Se(e),this.names.has(e))this.names.get(e).add(t);else {var n=new Set;n.add(t),this.names.set(e,n);}},e.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(Se(e),n);},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear();},e.prototype.clearRules=function(e){this.getTag().clearGroup(Se(e)),this.clearNames(e);},e.prototype.clearTag=function(){this.tag=void 0;},e}(),je=/&/g,xe=/^\s*\/\/.*$/gm;function Ve(e,t){return e.map(function(e){return "rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map(function(e){return "".concat(t," ").concat(e)})),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=Ve(e.children,t)),e})}function Fe(e){var t,n,o,r=void 0===e?C:e,s=r.options,i=void 0===s?C:s,a=r.plugins,c$1=void 0===a?_:a,l=function(e,o,r){return r.startsWith(n)&&r.endsWith(n)&&r.replaceAll(n,"").length>0?".".concat(t):e},u=c$1.slice();u.push(function(e){e.type===c&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(je,n).replace(o,l));}),i.prefix&&u.push(de$1),u.push(he$1);var p=function(e,r,s,a){void 0===r&&(r=""),void 0===s&&(s=""),void 0===a&&(a="&"),t=a,n=r,o=new RegExp("\\".concat(n,"\\b"),"g");var c=e.replace(xe,""),l=ue$1(s||r?"".concat(s," ").concat(r," { ").concat(c," }"):c);i.namespace&&(l=Ve(l,i.namespace));var p=[];return pe$1(l,be$1(u.concat(we$1(function(e){return p.push(e)})))),p};return p.hash=c$1.length?c$1.reduce(function(e,t){return t.name||he(15),M(e,t.name)},F).toString():"",p}var Me=new ke,ze=Fe(),$e=o__default["default"].createContext({shouldForwardProp:void 0,styleSheet:Me,stylis:ze});$e.Consumer;o__default["default"].createContext(void 0);function Ge(){return o.useContext($e)}var We=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=ze);var o=n.name+t.hash;e.hasNameForId(n.id,o)||e.insertRules(n.id,o,t(n.rules,o,"@keyframes"));},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,ue(this,function(){throw he(12,String(n.name))});}return e.prototype.getName=function(e){return void 0===e&&(e=ze),this.name+e.hash},e}(),qe=function(e){return e>="A"&&e<="Z"};function He(e){for(var t="",n=0;n<e.length;n++){var o=e[n];if(1===n&&"-"===o&&"-"===e[0])return e;qe(o)?t+="-"+o.toLowerCase():t+=o;}return t.startsWith("ms-")?"-"+t:t}var Ue=function(e){return null==e||!1===e||""===e},Je=function(t){var n,o,r=[];for(var s in t){var i=t[s];t.hasOwnProperty(s)&&!Ue(i)&&(Array.isArray(i)&&i.isCss||re(i)?r.push("".concat(He(s),":"),i,";"):ce(i)?r.push.apply(r,__spreadArray(__spreadArray(["".concat(s," {")],Je(i),!1),["}"],!1)):r.push("".concat(He(s),": ").concat((n=s,null==(o=i)||"boolean"==typeof o||""===o?"":"number"!=typeof o||0===o||n in unitlessKeys||n.startsWith("--")?String(o).trim():"".concat(o,"px")),";")));}return r};function Xe(e,t,n,o){if(Ue(e))return [];if(se(e))return [".".concat(e.styledComponentId)];if(re(e)){if(!re(s=e)||s.prototype&&s.prototype.isReactComponent||!t)return [e];var r=e(t);return "production"===process$1.env.NODE_ENV||"object"!=typeof r||Array.isArray(r)||r instanceof We||ce(r)||null===r||console.error("".concat(B(e)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),Xe(r,t,n,o)}var s;return e instanceof We?n?(e.inject(n,o),[e.getName(o)]):[e]:ce(e)?Je(e):Array.isArray(e)?Array.prototype.concat.apply(_,e.map(function(e){return Xe(e,t,n,o)})):[e.toString()]}function Ze(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(re(n)&&!se(n))return !1}return !0}var Ke=z(v),Qe=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process$1.env.NODE_ENV&&(void 0===n||n.isStatic)&&Ze(e),this.componentId=t,this.baseHash=M(Ke,t),this.baseStyle=n,ke.registerId(t);}return e.prototype.generateAndInjectStyles=function(e,t,n){var o=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))o=ie(o,this.staticRulesId);else {var r=ae(Xe(this.rules,e,t,n)),s=x(M(this.baseHash,r)>>>0);if(!t.hasNameForId(this.componentId,s)){var i=n(r,".".concat(s),void 0,this.componentId);t.insertRules(this.componentId,s,i);}o=ie(o,s),this.staticRulesId=s;}else {for(var a=M(this.baseHash,n.hash),c="",l=0;l<this.rules.length;l++){var u=this.rules[l];if("string"==typeof u)c+=u,"production"!==process$1.env.NODE_ENV&&(a=M(a,u));else if(u){var p=ae(Xe(u,e,t,n));a=M(a,p+l),c+=p;}}if(c){var d=x(a>>>0);t.hasNameForId(this.componentId,d)||t.insertRules(this.componentId,d,n(c,".".concat(d),void 0,this.componentId)),o=ie(o,d);}}return o},e}(),et=o__default["default"].createContext(void 0);et.Consumer;var rt={},st=new Set;function it(e,r,s){var i=se(e),a=e,c=!L(e),p=r.attrs,d=void 0===p?_:p,h=r.componentId,f=void 0===h?function(e,t){var n="string"!=typeof e?"sc":R(e);rt[n]=(rt[n]||0)+1;var o="".concat(n,"-").concat($(v+n+rt[n]));return t?"".concat(t,"-").concat(o):o}(r.displayName,r.parentComponentId):h,m=r.displayName,y=void 0===m?function(e){return L(e)?"styled.".concat(e):"Styled(".concat(B(e),")")}(e):m,g=r.displayName&&r.componentId?"".concat(R(r.displayName),"-").concat(r.componentId):r.componentId||f,S=i&&a.attrs?a.attrs.concat(d).filter(Boolean):d,w=r.shouldForwardProp;if(i&&a.shouldForwardProp){var b=a.shouldForwardProp;if(r.shouldForwardProp){var E=r.shouldForwardProp;w=function(e,t){return b(e,t)&&E(e,t)};}else w=b;}var N=new Qe(s,g,i?a.componentStyle:void 0);function O(e,r){return function(e,r,s){var i=e.attrs,a=e.componentStyle,c=e.defaultProps,p=e.foldedComponentIds,d=e.styledComponentId,h=e.target,f=o__default["default"].useContext(et),m=Ge(),y=e.shouldForwardProp||m.shouldForwardProp;"production"!==process$1.env.NODE_ENV&&o.useDebugValue(d);var v=I(r,f,c)||C,g=function(e,n,o){for(var r,s=__assign(__assign({},n),{className:void 0,theme:o}),i=0;i<e.length;i+=1){var a=re(r=e[i])?r(s):r;for(var c in a)s[c]="className"===c?ie(s[c],a[c]):"style"===c?__assign(__assign({},s[c]),a[c]):a[c];}return n.className&&(s.className=ie(s.className,n.className)),s}(i,r,v),S=g.as||h,w={};for(var b in g)void 0===g[b]||"$"===b[0]||"as"===b||"theme"===b&&g.theme===v||("forwardedAs"===b?w.as=g.forwardedAs:y&&!y(b,S)||(w[b]=g[b],y||"development"!==process$1.env.NODE_ENV||isPropValid(b)||st.has(b)||!A.has(S)||(st.add(b),console.warn('styled-components: it looks like an unknown prop "'.concat(b,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var E=function(e,t){var n=Ge(),o$1=e.generateAndInjectStyles(t,n.styleSheet,n.stylis);return "production"!==process$1.env.NODE_ENV&&o.useDebugValue(o$1),o$1}(a,g);"production"!==process$1.env.NODE_ENV&&e.warnTooManyClasses&&e.warnTooManyClasses(E);var N=ie(p,d);return E&&(N+=" "+E),g.className&&(N+=" "+g.className),w[L(S)&&!A.has(S)?"class":"className"]=N,w.ref=s,o.createElement(S,w)}(D,e,r)}O.displayName=y;var D=o__default["default"].forwardRef(O);return D.attrs=S,D.componentStyle=N,D.displayName=y,D.shouldForwardProp=w,D.foldedComponentIds=i?ie(a.foldedComponentIds,a.styledComponentId):"",D.styledComponentId=g,D.target=i?a.target:e,Object.defineProperty(D,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=i?function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var o=0,r=t;o<r.length;o++)le(e,r[o],!0);return e}({},a.defaultProps,e):e;}}),"production"!==process$1.env.NODE_ENV&&(P(y,g),D.warnTooManyClasses=function(e,t){var n={},o=!1;return function(r){if(!o&&(n[r]=!0,Object.keys(n).length>=200)){var s=t?' with the id of "'.concat(t,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(e).concat(s,".\n")+"Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"),o=!0,n={};}}}(y,g)),ue(D,function(){return ".".concat(D.styledComponentId)}),c&&oe(D,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),D}function at(e,t){for(var n=[e[0]],o=0,r=t.length;o<r;o+=1)n.push(t[o],e[o+1]);return n}var ct=function(e){return Object.assign(e,{isCss:!0})};function lt(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];if(re(t)||ce(t))return ct(Xe(at(_,__spreadArray([t],n,!0))));var r=t;return 0===n.length&&1===r.length&&"string"==typeof r[0]?Xe(r):ct(Xe(at(r,n)))}function ut(n,o,r){if(void 0===r&&(r=C),!o)throw he(1,o);var s=function(t){for(var s=[],i=1;i<arguments.length;i++)s[i-1]=arguments[i];return n(o,r,lt.apply(void 0,__spreadArray([t],s,!1)))};return s.attrs=function(e){return ut(n,o,__assign(__assign({},r),{attrs:Array.prototype.concat(r.attrs,e).filter(Boolean)}))},s.withConfig=function(e){return ut(n,o,__assign(__assign({},r),e))},s}var pt=function(e){return ut(it,e)},dt=pt;A.forEach(function(e){dt[e]=pt(e);});"production"!==process$1.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native");var St="__sc-".concat(f,"__");"production"!==process$1.env.NODE_ENV&&"test"!==process$1.env.NODE_ENV&&"undefined"!=typeof window&&(window[St]||(window[St]=0),1===window[St]&&console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."),window[St]+=1);
|
|
5730
|
+
var f="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",m="active",y="data-styled-version",v="6.1.12",g="/*!sc*/\n",S="undefined"!=typeof window&&"HTMLElement"in window,w=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV),E=/invalid hook call/i,N=new Set,P=function(t,n){if("production"!==process.env.NODE_ENV){var o$1=n?' with the id of "'.concat(n,'"'):"",s="The component ".concat(t).concat(o$1," has been created dynamically.\n")+"You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.",i=console.error;try{var a=!0;console.error=function(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];E.test(t)?(a=!1,N.delete(s)):i.apply(void 0,__spreadArray([t],n,!1));},o.useRef(),a&&!N.has(s)&&(console.warn(s),N.add(s));}catch(e){E.test(e.message)&&N.delete(s);}finally{console.error=i;}}},_=Object.freeze([]),C=Object.freeze({});function I(e,t,n){return void 0===n&&(n=C),e.theme!==n.theme&&e.theme||t||n.theme}var A=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),O=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,D=/(^-|-$)/g;function R(e){return e.replace(O,"-").replace(D,"")}var T=/(a)(d)/gi,k=52,j=function(e){return String.fromCharCode(e+(e>25?39:97))};function x(e){var t,n="";for(t=Math.abs(e);t>k;t=t/k|0)n=j(t%k)+n;return (j(t%k)+n).replace(T,"$1-$2")}var V,F=5381,M=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},z=function(e){return M(F,e)};function $(e){return x(z(e)>>>0)}function B(e){return "production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function L(e){return "string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var G="function"==typeof Symbol&&Symbol.for,Y=G?Symbol.for("react.memo"):60115,W=G?Symbol.for("react.forward_ref"):60112,q={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},H={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},U={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},J=((V={})[W]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},V[Y]=U,V);function X(e){return ("type"in(t=e)&&t.type.$$typeof)===Y?U:"$$typeof"in e?J[e.$$typeof]:q;var t;}var Z=Object.defineProperty,K=Object.getOwnPropertyNames,Q=Object.getOwnPropertySymbols,ee=Object.getOwnPropertyDescriptor,te=Object.getPrototypeOf,ne=Object.prototype;function oe(e,t,n){if("string"!=typeof t){if(ne){var o=te(t);o&&o!==ne&&oe(e,o,n);}var r=K(t);Q&&(r=r.concat(Q(t)));for(var s=X(e),i=X(t),a=0;a<r.length;++a){var c=r[a];if(!(c in H||n&&n[c]||i&&c in i||s&&c in s)){var l=ee(t,c);try{Z(e,c,l);}catch(e){}}}}return e}function re(e){return "function"==typeof e}function se(e){return "object"==typeof e&&"styledComponentId"in e}function ie(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function ae(e,t){if(0===e.length)return "";for(var n=e[0],o=1;o<e.length;o++)n+=t?t+e[o]:e[o];return n}function ce(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function le(e,t,n){if(void 0===n&&(n=!1),!n&&!ce(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var o=0;o<t.length;o++)e[o]=le(e[o],t[o]);else if(ce(t))for(var o in t)e[o]=le(e[o],t[o]);return e}function ue(e,t){Object.defineProperty(e,"toString",{value:t});}var pe="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function de(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=e[0],o=[],r=1,s=e.length;r<s;r+=1)o.push(e[r]);return o.forEach(function(e){n=n.replace(/%[a-z]/,e);}),n}function he(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return "production"===process.env.NODE_ENV?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t," for more information.").concat(n.length>0?" Args: ".concat(n.join(", ")):"")):new Error(de.apply(void 0,__spreadArray([pe[t]],n,!1)).trim())}var fe=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e;}return e.prototype.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,o=n.length,r=o;e>=r;)if((r<<=1)<0)throw he(16,"".concat(e));this.groupSizes=new Uint32Array(r),this.groupSizes.set(n),this.length=r;for(var s=o;s<r;s++)this.groupSizes[s]=0;}for(var i=this.indexOfGroup(e+1),a=(s=0,t.length);s<a;s++)this.tag.insertRule(i,t[s])&&(this.groupSizes[e]++,i++);},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),o=n+t;this.groupSizes[e]=0;for(var r=n;r<o;r++)this.tag.deleteRule(n);}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],o=this.indexOfGroup(e),r=o+n,s=o;s<r;s++)t+="".concat(this.tag.getRule(s)).concat(g);return t},e}(),me=1<<30,ye=new Map,ve=new Map,ge=1,Se=function(e){if(ye.has(e))return ye.get(e);for(;ve.has(ge);)ge++;var t=ge++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>me))throw he(16,"".concat(t));return ye.set(e,t),ve.set(t,e),t},we=function(e,t){ge=t+1,ye.set(e,t),ve.set(t,e);},be="style[".concat(f,"][").concat(y,'="').concat(v,'"]'),Ee=new RegExp("^".concat(f,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),Ne=function(e,t,n){for(var o,r=n.split(","),s=0,i=r.length;s<i;s++)(o=r[s])&&e.registerName(t,o);},Pe=function(e,t){for(var n,o=(null!==(n=t.textContent)&&void 0!==n?n:"").split(g),r=[],s=0,i=o.length;s<i;s++){var a=o[s].trim();if(a){var c=a.match(Ee);if(c){var l=0|parseInt(c[1],10),u=c[2];0!==l&&(we(u,l),Ne(e,u,c[3]),e.getTag().insertRules(l,r)),r.length=0;}else r.push(a);}}},_e=function(e){for(var t=document.querySelectorAll(be),n=0,o=t.length;n<o;n++){var r=t[n];r&&r.getAttribute(f)!==m&&(Pe(e,r),r.parentNode&&r.parentNode.removeChild(r));}};function Ce(){return "undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null}var Ie=function(e){var t=document.head,n=e||t,o=document.createElement("style"),r=function(e){var t=Array.from(e.querySelectorAll("style[".concat(f,"]")));return t[t.length-1]}(n),s=void 0!==r?r.nextSibling:null;o.setAttribute(f,m),o.setAttribute(y,v);var i=Ce();return i&&o.setAttribute("nonce",i),n.insertBefore(o,s),o},Ae=function(){function e(e){this.element=Ie(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,o=t.length;n<o;n++){var r=t[n];if(r.ownerNode===e)return r}throw he(17)}(this.element),this.length=0;}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return !1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--;},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),Oe=function(){function e(e){this.element=Ie(e),this.nodes=this.element.childNodes,this.length=0;}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return !1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--;},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),De=function(){function e(e){this.rules=[],this.length=0;}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--;},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),Re=S,Te={isServer:!S,useCSSOMInjection:!w},ke=function(){function e(e,n,o){void 0===e&&(e=C),void 0===n&&(n={});var r=this;this.options=__assign(__assign({},Te),e),this.gs=n,this.names=new Map(o),this.server=!!e.isServer,!this.server&&S&&Re&&(Re=!1,_e(this)),ue(this,function(){return function(e){for(var t=e.getTag(),n=t.length,o="",r=function(n){var r=function(e){return ve.get(e)}(n);if(void 0===r)return "continue";var s=e.names.get(r),i=t.getGroup(n);if(void 0===s||!s.size||0===i.length)return "continue";var a="".concat(f,".g").concat(n,'[id="').concat(r,'"]'),c="";void 0!==s&&s.forEach(function(e){e.length>0&&(c+="".concat(e,","));}),o+="".concat(i).concat(a,'{content:"').concat(c,'"}').concat(g);},s=0;s<n;s++)r(s);return o}(r)});}return e.registerId=function(e){return Se(e)},e.prototype.rehydrate=function(){!this.server&&S&&_e(this);},e.prototype.reconstructWithOptions=function(n,o){return void 0===o&&(o=!0),new e(__assign(__assign({},this.options),n),this.gs,o&&this.names||void 0)},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new De(n):t?new Ae(n):new Oe(n)}(this.options),new fe(e)));var e;},e.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},e.prototype.registerName=function(e,t){if(Se(e),this.names.has(e))this.names.get(e).add(t);else {var n=new Set;n.add(t),this.names.set(e,n);}},e.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(Se(e),n);},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear();},e.prototype.clearRules=function(e){this.getTag().clearGroup(Se(e)),this.clearNames(e);},e.prototype.clearTag=function(){this.tag=void 0;},e}(),je=/&/g,xe=/^\s*\/\/.*$/gm;function Ve(e,t){return e.map(function(e){return "rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map(function(e){return "".concat(t," ").concat(e)})),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=Ve(e.children,t)),e})}function Fe(e){var t,n,o,r=void 0===e?C:e,s=r.options,i=void 0===s?C:s,a=r.plugins,c$1=void 0===a?_:a,l=function(e,o,r){return r.startsWith(n)&&r.endsWith(n)&&r.replaceAll(n,"").length>0?".".concat(t):e},u=c$1.slice();u.push(function(e){e.type===c&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(je,n).replace(o,l));}),i.prefix&&u.push(de$1),u.push(he$1);var p=function(e,r,s,a){void 0===r&&(r=""),void 0===s&&(s=""),void 0===a&&(a="&"),t=a,n=r,o=new RegExp("\\".concat(n,"\\b"),"g");var c=e.replace(xe,""),l=ue$1(s||r?"".concat(s," ").concat(r," { ").concat(c," }"):c);i.namespace&&(l=Ve(l,i.namespace));var p=[];return pe$1(l,be$1(u.concat(we$1(function(e){return p.push(e)})))),p};return p.hash=c$1.length?c$1.reduce(function(e,t){return t.name||he(15),M(e,t.name)},F).toString():"",p}var Me=new ke,ze=Fe(),$e=o__default["default"].createContext({shouldForwardProp:void 0,styleSheet:Me,stylis:ze});$e.Consumer;o__default["default"].createContext(void 0);function Ge(){return o.useContext($e)}var We=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=ze);var o=n.name+t.hash;e.hasNameForId(n.id,o)||e.insertRules(n.id,o,t(n.rules,o,"@keyframes"));},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,ue(this,function(){throw he(12,String(n.name))});}return e.prototype.getName=function(e){return void 0===e&&(e=ze),this.name+e.hash},e}(),qe=function(e){return e>="A"&&e<="Z"};function He(e){for(var t="",n=0;n<e.length;n++){var o=e[n];if(1===n&&"-"===o&&"-"===e[0])return e;qe(o)?t+="-"+o.toLowerCase():t+=o;}return t.startsWith("ms-")?"-"+t:t}var Ue=function(e){return null==e||!1===e||""===e},Je=function(t){var n,o,r=[];for(var s in t){var i=t[s];t.hasOwnProperty(s)&&!Ue(i)&&(Array.isArray(i)&&i.isCss||re(i)?r.push("".concat(He(s),":"),i,";"):ce(i)?r.push.apply(r,__spreadArray(__spreadArray(["".concat(s," {")],Je(i),!1),["}"],!1)):r.push("".concat(He(s),": ").concat((n=s,null==(o=i)||"boolean"==typeof o||""===o?"":"number"!=typeof o||0===o||n in unitlessKeys||n.startsWith("--")?String(o).trim():"".concat(o,"px")),";")));}return r};function Xe(e,t,n,o){if(Ue(e))return [];if(se(e))return [".".concat(e.styledComponentId)];if(re(e)){if(!re(s=e)||s.prototype&&s.prototype.isReactComponent||!t)return [e];var r=e(t);return "production"===process.env.NODE_ENV||"object"!=typeof r||Array.isArray(r)||r instanceof We||ce(r)||null===r||console.error("".concat(B(e)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),Xe(r,t,n,o)}var s;return e instanceof We?n?(e.inject(n,o),[e.getName(o)]):[e]:ce(e)?Je(e):Array.isArray(e)?Array.prototype.concat.apply(_,e.map(function(e){return Xe(e,t,n,o)})):[e.toString()]}function Ze(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(re(n)&&!se(n))return !1}return !0}var Ke=z(v),Qe=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&Ze(e),this.componentId=t,this.baseHash=M(Ke,t),this.baseStyle=n,ke.registerId(t);}return e.prototype.generateAndInjectStyles=function(e,t,n){var o=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))o=ie(o,this.staticRulesId);else {var r=ae(Xe(this.rules,e,t,n)),s=x(M(this.baseHash,r)>>>0);if(!t.hasNameForId(this.componentId,s)){var i=n(r,".".concat(s),void 0,this.componentId);t.insertRules(this.componentId,s,i);}o=ie(o,s),this.staticRulesId=s;}else {for(var a=M(this.baseHash,n.hash),c="",l=0;l<this.rules.length;l++){var u=this.rules[l];if("string"==typeof u)c+=u,"production"!==process.env.NODE_ENV&&(a=M(a,u));else if(u){var p=ae(Xe(u,e,t,n));a=M(a,p+l),c+=p;}}if(c){var d=x(a>>>0);t.hasNameForId(this.componentId,d)||t.insertRules(this.componentId,d,n(c,".".concat(d),void 0,this.componentId)),o=ie(o,d);}}return o},e}(),et=o__default["default"].createContext(void 0);et.Consumer;var rt={},st=new Set;function it(e,r,s){var i=se(e),a=e,c=!L(e),p=r.attrs,d=void 0===p?_:p,h=r.componentId,f=void 0===h?function(e,t){var n="string"!=typeof e?"sc":R(e);rt[n]=(rt[n]||0)+1;var o="".concat(n,"-").concat($(v+n+rt[n]));return t?"".concat(t,"-").concat(o):o}(r.displayName,r.parentComponentId):h,m=r.displayName,y=void 0===m?function(e){return L(e)?"styled.".concat(e):"Styled(".concat(B(e),")")}(e):m,g=r.displayName&&r.componentId?"".concat(R(r.displayName),"-").concat(r.componentId):r.componentId||f,S=i&&a.attrs?a.attrs.concat(d).filter(Boolean):d,w=r.shouldForwardProp;if(i&&a.shouldForwardProp){var b=a.shouldForwardProp;if(r.shouldForwardProp){var E=r.shouldForwardProp;w=function(e,t){return b(e,t)&&E(e,t)};}else w=b;}var N=new Qe(s,g,i?a.componentStyle:void 0);function O(e,r){return function(e,r,s){var i=e.attrs,a=e.componentStyle,c=e.defaultProps,p=e.foldedComponentIds,d=e.styledComponentId,h=e.target,f=o__default["default"].useContext(et),m=Ge(),y=e.shouldForwardProp||m.shouldForwardProp;"production"!==process.env.NODE_ENV&&o.useDebugValue(d);var v=I(r,f,c)||C,g=function(e,n,o){for(var r,s=__assign(__assign({},n),{className:void 0,theme:o}),i=0;i<e.length;i+=1){var a=re(r=e[i])?r(s):r;for(var c in a)s[c]="className"===c?ie(s[c],a[c]):"style"===c?__assign(__assign({},s[c]),a[c]):a[c];}return n.className&&(s.className=ie(s.className,n.className)),s}(i,r,v),S=g.as||h,w={};for(var b in g)void 0===g[b]||"$"===b[0]||"as"===b||"theme"===b&&g.theme===v||("forwardedAs"===b?w.as=g.forwardedAs:y&&!y(b,S)||(w[b]=g[b],y||"development"!==process.env.NODE_ENV||isPropValid(b)||st.has(b)||!A.has(S)||(st.add(b),console.warn('styled-components: it looks like an unknown prop "'.concat(b,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var E=function(e,t){var n=Ge(),o$1=e.generateAndInjectStyles(t,n.styleSheet,n.stylis);return "production"!==process.env.NODE_ENV&&o.useDebugValue(o$1),o$1}(a,g);"production"!==process.env.NODE_ENV&&e.warnTooManyClasses&&e.warnTooManyClasses(E);var N=ie(p,d);return E&&(N+=" "+E),g.className&&(N+=" "+g.className),w[L(S)&&!A.has(S)?"class":"className"]=N,w.ref=s,o.createElement(S,w)}(D,e,r)}O.displayName=y;var D=o__default["default"].forwardRef(O);return D.attrs=S,D.componentStyle=N,D.displayName=y,D.shouldForwardProp=w,D.foldedComponentIds=i?ie(a.foldedComponentIds,a.styledComponentId):"",D.styledComponentId=g,D.target=i?a.target:e,Object.defineProperty(D,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=i?function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var o=0,r=t;o<r.length;o++)le(e,r[o],!0);return e}({},a.defaultProps,e):e;}}),"production"!==process.env.NODE_ENV&&(P(y,g),D.warnTooManyClasses=function(e,t){var n={},o=!1;return function(r){if(!o&&(n[r]=!0,Object.keys(n).length>=200)){var s=t?' with the id of "'.concat(t,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(e).concat(s,".\n")+"Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"),o=!0,n={};}}}(y,g)),ue(D,function(){return ".".concat(D.styledComponentId)}),c&&oe(D,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),D}function at(e,t){for(var n=[e[0]],o=0,r=t.length;o<r;o+=1)n.push(t[o],e[o+1]);return n}var ct=function(e){return Object.assign(e,{isCss:!0})};function lt(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];if(re(t)||ce(t))return ct(Xe(at(_,__spreadArray([t],n,!0))));var r=t;return 0===n.length&&1===r.length&&"string"==typeof r[0]?Xe(r):ct(Xe(at(r,n)))}function ut(n,o,r){if(void 0===r&&(r=C),!o)throw he(1,o);var s=function(t){for(var s=[],i=1;i<arguments.length;i++)s[i-1]=arguments[i];return n(o,r,lt.apply(void 0,__spreadArray([t],s,!1)))};return s.attrs=function(e){return ut(n,o,__assign(__assign({},r),{attrs:Array.prototype.concat(r.attrs,e).filter(Boolean)}))},s.withConfig=function(e){return ut(n,o,__assign(__assign({},r),e))},s}var pt=function(e){return ut(it,e)},dt=pt;A.forEach(function(e){dt[e]=pt(e);});"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native");var St="__sc-".concat(f,"__");"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window[St]||(window[St]=0),1===window[St]&&console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."),window[St]+=1);
|
|
5733
5731
|
|
|
5734
5732
|
const MOBILE_W = 850;
|
|
5735
5733
|
const MOBILE_WIDTH = `max-width: ${MOBILE_W}px`;
|
|
@@ -5929,7 +5927,8 @@ function MobileDrawer({
|
|
|
5929
5927
|
isUserDropdown = false,
|
|
5930
5928
|
user,
|
|
5931
5929
|
sidenavConfig = {},
|
|
5932
|
-
|
|
5930
|
+
goTo = () => {},
|
|
5931
|
+
getRedirectLink = () => {},
|
|
5933
5932
|
t = key => key,
|
|
5934
5933
|
checkPermission = () => false,
|
|
5935
5934
|
logOut,
|
|
@@ -5966,10 +5965,6 @@ function MobileDrawer({
|
|
|
5966
5965
|
}
|
|
5967
5966
|
logOut?.();
|
|
5968
5967
|
}, [logOut]);
|
|
5969
|
-
const goTo = (...props) => {
|
|
5970
|
-
navigate?.(...props);
|
|
5971
|
-
toggle();
|
|
5972
|
-
};
|
|
5973
5968
|
const filteredItems = o.useMemo(() => {
|
|
5974
5969
|
const mapItems = item => {
|
|
5975
5970
|
const isDisabled = typeof item.isDisabled === 'function' ? item.isDisabled(user, selectedProject, selectedProject) : item.isDisabled || false;
|
|
@@ -6095,7 +6090,8 @@ const UserDropdownMenu = ({
|
|
|
6095
6090
|
user,
|
|
6096
6091
|
toggleSettingsDrawer = () => {},
|
|
6097
6092
|
settingsDrawerOpened,
|
|
6098
|
-
|
|
6093
|
+
goTo = () => {},
|
|
6094
|
+
getRedirectLink = () => {},
|
|
6099
6095
|
changeNotificationState,
|
|
6100
6096
|
t = s => s,
|
|
6101
6097
|
isAppNavigation,
|
|
@@ -6114,15 +6110,10 @@ const UserDropdownMenu = ({
|
|
|
6114
6110
|
userIsAdmin
|
|
6115
6111
|
} = userHelpers;
|
|
6116
6112
|
const isAdmin = o.useMemo(() => userIsAdmin?.(user), [user, userIsAdmin]);
|
|
6113
|
+
|
|
6114
|
+
// Add fallback for windowWidth
|
|
6117
6115
|
const actualWidth = windowWidth || (typeof window !== 'undefined' ? window.innerWidth : 1920);
|
|
6118
6116
|
const isMobile = o.useMemo(() => actualWidth <= MOBILE_W, [actualWidth]);
|
|
6119
|
-
console.log('UserDropdown Debug:', {
|
|
6120
|
-
windowWidth,
|
|
6121
|
-
actualWidth,
|
|
6122
|
-
isMobile,
|
|
6123
|
-
MOBILE_W
|
|
6124
|
-
}); // Debug log
|
|
6125
|
-
|
|
6126
6117
|
const canViewUsers = checkPermission({
|
|
6127
6118
|
permission: 'users.canView',
|
|
6128
6119
|
permissions: user?.role?.permissions
|
|
@@ -6135,7 +6126,29 @@ const UserDropdownMenu = ({
|
|
|
6135
6126
|
const _arr = Array.isArray(user?.company?.logo) ? user?.company?.logo : user?.company?.logo?.fileList && Array.isArray(user?.company?.logo?.fileList) ? user?.company?.logo?.fileList.map(v => v.response ? v.response : v) : [];
|
|
6136
6127
|
return Array.isArray(_arr) && _arr[0] ? _arr[0].url : null;
|
|
6137
6128
|
}, [user]);
|
|
6138
|
-
const isDemoEnv =
|
|
6129
|
+
const isDemoEnv = isDev;
|
|
6130
|
+
|
|
6131
|
+
// Helper function to handle navigation with notification check
|
|
6132
|
+
const handleNavigate = path => {
|
|
6133
|
+
if (changeNotificationState) {
|
|
6134
|
+
changeNotificationState({
|
|
6135
|
+
onYes: () => goTo(getRedirectLink(path))
|
|
6136
|
+
});
|
|
6137
|
+
} else {
|
|
6138
|
+
goTo(getRedirectLink(path));
|
|
6139
|
+
}
|
|
6140
|
+
};
|
|
6141
|
+
|
|
6142
|
+
// Helper function to handle logout with notification check
|
|
6143
|
+
const handleLogout = () => {
|
|
6144
|
+
if (changeNotificationState) {
|
|
6145
|
+
changeNotificationState({
|
|
6146
|
+
onYes: () => logOut()
|
|
6147
|
+
});
|
|
6148
|
+
} else {
|
|
6149
|
+
logOut();
|
|
6150
|
+
}
|
|
6151
|
+
};
|
|
6139
6152
|
return isMobile ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6140
6153
|
className: "d-flex flex-column justify-content-center",
|
|
6141
6154
|
onClick: toggleSettingsDrawer,
|
|
@@ -6147,7 +6160,8 @@ const UserDropdownMenu = ({
|
|
|
6147
6160
|
toggle: toggleSettingsDrawer,
|
|
6148
6161
|
drawerOpened: settingsDrawerOpened,
|
|
6149
6162
|
user: user,
|
|
6150
|
-
|
|
6163
|
+
goTo: goTo,
|
|
6164
|
+
getRedirectLink: getRedirectLink,
|
|
6151
6165
|
t: t,
|
|
6152
6166
|
checkPermission: checkPermission,
|
|
6153
6167
|
logOut: logOut,
|
|
@@ -6159,47 +6173,44 @@ const UserDropdownMenu = ({
|
|
|
6159
6173
|
placement: "bottomLeft",
|
|
6160
6174
|
rootClassName: formatClassname(['user-dropdown-layout', appName]),
|
|
6161
6175
|
menu: {
|
|
6162
|
-
items: [
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
});
|
|
6187
|
-
},
|
|
6188
|
-
children: t('Settings')
|
|
6189
|
-
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6190
|
-
className: "list-item",
|
|
6191
|
-
onClick: () => {
|
|
6192
|
-
changeNotificationState({
|
|
6193
|
-
onYes: () => logOut()
|
|
6194
|
-
});
|
|
6195
|
-
},
|
|
6196
|
-
children: t('Log out')
|
|
6197
|
-
})]
|
|
6198
|
-
})]
|
|
6199
|
-
}),
|
|
6200
|
-
key: 'userMenu'
|
|
6201
|
-
}]
|
|
6176
|
+
items: [
|
|
6177
|
+
// Only show Users option if conditions met
|
|
6178
|
+
...(user.company && !isDemoEnv && canViewUsers && !isAdmin ? [{
|
|
6179
|
+
label: t('Users'),
|
|
6180
|
+
key: 'users',
|
|
6181
|
+
onClick: () => handleNavigate(getRedirectLink(`/app/users`))
|
|
6182
|
+
}] : []),
|
|
6183
|
+
// Only show Settings option if conditions met
|
|
6184
|
+
...(canViewSettings && !isAppNavigation && !isAdmin ? [{
|
|
6185
|
+
label: t('Settings'),
|
|
6186
|
+
key: 'settings',
|
|
6187
|
+
onClick: () => handleNavigate(getRedirectLink(`/app/view/settings`))
|
|
6188
|
+
}] : []),
|
|
6189
|
+
// Always show logout
|
|
6190
|
+
{
|
|
6191
|
+
label: t('Log out'),
|
|
6192
|
+
key: 'logout',
|
|
6193
|
+
onClick: handleLogout
|
|
6194
|
+
}],
|
|
6195
|
+
// Add the header as a separate component
|
|
6196
|
+
onClick: info => {
|
|
6197
|
+
// This will be called when any menu item is clicked
|
|
6198
|
+
console.log('Menu item clicked:', info.key);
|
|
6199
|
+
}
|
|
6202
6200
|
},
|
|
6201
|
+
dropdownRender: menu => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6202
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6203
|
+
className: "drop-header",
|
|
6204
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("h4", {
|
|
6205
|
+
children: user?.company?.name || ''
|
|
6206
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("p", {
|
|
6207
|
+
children: [user?.firstName || '', " ", user?.lastName || '']
|
|
6208
|
+
})]
|
|
6209
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6210
|
+
className: "list",
|
|
6211
|
+
children: /*#__PURE__*/o__default["default"].cloneElement(menu)
|
|
6212
|
+
})]
|
|
6213
|
+
}),
|
|
6203
6214
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6204
6215
|
className: "d-flex flex-column justify-content-center",
|
|
6205
6216
|
children: /*#__PURE__*/jsxRuntime.jsx(UserIcon, {
|
|
@@ -6486,7 +6497,8 @@ function Notifications({
|
|
|
6486
6497
|
mod = 'pme',
|
|
6487
6498
|
toggle = () => {},
|
|
6488
6499
|
t = key => key,
|
|
6489
|
-
|
|
6500
|
+
goTo = () => {},
|
|
6501
|
+
getRedirectLink = () => {},
|
|
6490
6502
|
appName = 'app'
|
|
6491
6503
|
}) {
|
|
6492
6504
|
const [historyVisible, setHistoryVisible] = o.useState(false);
|
|
@@ -6531,7 +6543,7 @@ function Notifications({
|
|
|
6531
6543
|
}),
|
|
6532
6544
|
onClick: () => {
|
|
6533
6545
|
toggle();
|
|
6534
|
-
|
|
6546
|
+
goTo(getRedirectLink(`/app/${mod}/view/settings?activeForm=notifications`));
|
|
6535
6547
|
},
|
|
6536
6548
|
label: t('Settings')
|
|
6537
6549
|
}];
|
|
@@ -6572,7 +6584,7 @@ function Notifications({
|
|
|
6572
6584
|
toggle: toggle,
|
|
6573
6585
|
n: n,
|
|
6574
6586
|
t: t,
|
|
6575
|
-
|
|
6587
|
+
goTo: goTo
|
|
6576
6588
|
}, `notifications-${i + 1}`)), loading && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6577
6589
|
className: "loading-cont",
|
|
6578
6590
|
children: /*#__PURE__*/jsxRuntime.jsx(icons.LoadingOutlined, {})
|
|
@@ -6581,7 +6593,7 @@ function Notifications({
|
|
|
6581
6593
|
visible: historyVisible,
|
|
6582
6594
|
setHistoryVisible: setHistoryVisible,
|
|
6583
6595
|
t: t,
|
|
6584
|
-
|
|
6596
|
+
goTo: goTo
|
|
6585
6597
|
})]
|
|
6586
6598
|
});
|
|
6587
6599
|
}
|
|
@@ -6805,6 +6817,143 @@ function LoginPopup({
|
|
|
6805
6817
|
});
|
|
6806
6818
|
}
|
|
6807
6819
|
|
|
6820
|
+
/**
|
|
6821
|
+
* @description Manages window.storage
|
|
6822
|
+
* @returns storage objects
|
|
6823
|
+
* @class StorageManager
|
|
6824
|
+
*/
|
|
6825
|
+
class StorageManager {
|
|
6826
|
+
/**
|
|
6827
|
+
* @description Set or update given value in localStorage
|
|
6828
|
+
* @static
|
|
6829
|
+
* @returns Object
|
|
6830
|
+
* @memberof StorageManager
|
|
6831
|
+
*/
|
|
6832
|
+
static set(key, value) {
|
|
6833
|
+
if (key && value) {
|
|
6834
|
+
window.localStorage.setItem(key, value);
|
|
6835
|
+
return {
|
|
6836
|
+
success: true,
|
|
6837
|
+
data: "Storage has been set successfully."
|
|
6838
|
+
};
|
|
6839
|
+
}
|
|
6840
|
+
return {
|
|
6841
|
+
error: true,
|
|
6842
|
+
data: "Storage was not set. Storage key and value is required!"
|
|
6843
|
+
};
|
|
6844
|
+
}
|
|
6845
|
+
|
|
6846
|
+
/**
|
|
6847
|
+
* @description Set or update given value in sessionStorage, used to not remember user after closing opened tab.
|
|
6848
|
+
* @static
|
|
6849
|
+
* @returns Object
|
|
6850
|
+
* @memberof StorageManager
|
|
6851
|
+
*/
|
|
6852
|
+
static setToSession(key, value) {
|
|
6853
|
+
if (key && value) {
|
|
6854
|
+
window.sessionStorage.setItem(key, value);
|
|
6855
|
+
return {
|
|
6856
|
+
success: true,
|
|
6857
|
+
data: "Storage has been set successfully."
|
|
6858
|
+
};
|
|
6859
|
+
}
|
|
6860
|
+
return {
|
|
6861
|
+
error: true,
|
|
6862
|
+
data: "Storage was not set. Storage key and value is required!"
|
|
6863
|
+
};
|
|
6864
|
+
}
|
|
6865
|
+
|
|
6866
|
+
/**
|
|
6867
|
+
* @description Fetch data from localStorage
|
|
6868
|
+
* @static
|
|
6869
|
+
* @returns Object
|
|
6870
|
+
* @memberof StorageManager
|
|
6871
|
+
*/
|
|
6872
|
+
static get(key, defaultValue = undefined) {
|
|
6873
|
+
if (key) {
|
|
6874
|
+
const val = window.localStorage.getItem(key) || window.sessionStorage.getItem(key);
|
|
6875
|
+
return val || defaultValue;
|
|
6876
|
+
}
|
|
6877
|
+
return {
|
|
6878
|
+
error: true,
|
|
6879
|
+
data: "Storage key is required!"
|
|
6880
|
+
};
|
|
6881
|
+
}
|
|
6882
|
+
|
|
6883
|
+
/**
|
|
6884
|
+
* @description Clear only one value from localStorage
|
|
6885
|
+
* @static
|
|
6886
|
+
* @returns Object
|
|
6887
|
+
* @memberof StorageManager
|
|
6888
|
+
*/
|
|
6889
|
+
static clearOne(key) {
|
|
6890
|
+
if (key === 'token') {
|
|
6891
|
+
localStorage.removeItem('trade-type');
|
|
6892
|
+
localStorage.removeItem('trade-value');
|
|
6893
|
+
}
|
|
6894
|
+
if (key) {
|
|
6895
|
+
window.localStorage.removeItem(key) || window.sessionStorage.removeItem(key);
|
|
6896
|
+
}
|
|
6897
|
+
return "Storage key is required!";
|
|
6898
|
+
}
|
|
6899
|
+
|
|
6900
|
+
/**
|
|
6901
|
+
* @description Clear all values from localStorage
|
|
6902
|
+
* @static
|
|
6903
|
+
* @returns Object
|
|
6904
|
+
* @memberof StorageManager
|
|
6905
|
+
*/
|
|
6906
|
+
static clearAll() {
|
|
6907
|
+
window.localStorage.clear();
|
|
6908
|
+
window.sessionStorage.clear();
|
|
6909
|
+
}
|
|
6910
|
+
static hasKey(key) {
|
|
6911
|
+
return typeof this.get(key) === 'string';
|
|
6912
|
+
}
|
|
6913
|
+
static saveFilters(module, namespace, filters = {}, merge = false) {
|
|
6914
|
+
let savedFilters = this.get('filters');
|
|
6915
|
+
try {
|
|
6916
|
+
savedFilters = JSON.parse(savedFilters);
|
|
6917
|
+
} catch (e) {
|
|
6918
|
+
savedFilters = {};
|
|
6919
|
+
}
|
|
6920
|
+
if (!savedFilters) {
|
|
6921
|
+
savedFilters = {};
|
|
6922
|
+
}
|
|
6923
|
+
if (!savedFilters[module]) {
|
|
6924
|
+
savedFilters[module] = {};
|
|
6925
|
+
}
|
|
6926
|
+
if (!savedFilters[module][namespace]) {
|
|
6927
|
+
savedFilters[module][namespace] = {};
|
|
6928
|
+
}
|
|
6929
|
+
if (Object.keys(filters).length) {
|
|
6930
|
+
savedFilters[module][namespace] = merge ? Object.assign(savedFilters[module][namespace], filters) : filters;
|
|
6931
|
+
} else {
|
|
6932
|
+
savedFilters[module][namespace] = {};
|
|
6933
|
+
}
|
|
6934
|
+
this.set('filters', JSON.stringify(savedFilters));
|
|
6935
|
+
return savedFilters[module][namespace];
|
|
6936
|
+
}
|
|
6937
|
+
static getFilters(module, namespace) {
|
|
6938
|
+
let savedFilters = this.get('filters');
|
|
6939
|
+
try {
|
|
6940
|
+
savedFilters = JSON.parse(savedFilters);
|
|
6941
|
+
} catch (e) {
|
|
6942
|
+
savedFilters = {};
|
|
6943
|
+
}
|
|
6944
|
+
if (!savedFilters) {
|
|
6945
|
+
savedFilters = {};
|
|
6946
|
+
}
|
|
6947
|
+
if (!savedFilters[module]) {
|
|
6948
|
+
savedFilters[module] = {};
|
|
6949
|
+
}
|
|
6950
|
+
if (!savedFilters[module][namespace]) {
|
|
6951
|
+
savedFilters[module][namespace] = {};
|
|
6952
|
+
}
|
|
6953
|
+
return savedFilters[module][namespace];
|
|
6954
|
+
}
|
|
6955
|
+
}
|
|
6956
|
+
|
|
6808
6957
|
/* eslint-disable react/prop-types */
|
|
6809
6958
|
const {
|
|
6810
6959
|
Content
|
|
@@ -6853,11 +7002,11 @@ function AppLayout({
|
|
|
6853
7002
|
getUserOptions,
|
|
6854
7003
|
selectedProject,
|
|
6855
7004
|
// Navigation (injected from app)
|
|
6856
|
-
|
|
7005
|
+
goTo = () => {},
|
|
6857
7006
|
location,
|
|
6858
7007
|
matchPath,
|
|
6859
7008
|
Outlet,
|
|
6860
|
-
getRedirectLink,
|
|
7009
|
+
getRedirectLink = () => {},
|
|
6861
7010
|
isDatastake,
|
|
6862
7011
|
// Others
|
|
6863
7012
|
userHelpers = {},
|
|
@@ -6937,10 +7086,9 @@ function AppLayout({
|
|
|
6937
7086
|
_fetchPreferences();
|
|
6938
7087
|
}, [getUserPreference]);
|
|
6939
7088
|
const setIsCollapse = (val = false) => {
|
|
6940
|
-
|
|
7089
|
+
console.log('setIsCollapse called with:', val); // Debug
|
|
7090
|
+
StorageManager.set('is_collapsed', val ? 'true' : 'false');
|
|
6941
7091
|
setIsCollapsed(val);
|
|
6942
|
-
|
|
6943
|
-
// Also call the parent's onCollapse callback
|
|
6944
7092
|
if (onCollapse && typeof onCollapse === 'function') {
|
|
6945
7093
|
onCollapse(val);
|
|
6946
7094
|
}
|
|
@@ -6955,7 +7103,7 @@ function AppLayout({
|
|
|
6955
7103
|
};
|
|
6956
7104
|
const isUserApproved = user?.modules && user?.modules[module] && user?.modules[module].status === 'approved';
|
|
6957
7105
|
o.useEffect(() => {
|
|
6958
|
-
if (
|
|
7106
|
+
if (StorageManager.get('previous')) {
|
|
6959
7107
|
setPrevious(true);
|
|
6960
7108
|
}
|
|
6961
7109
|
}, [user?.language]);
|
|
@@ -6989,7 +7137,7 @@ function AppLayout({
|
|
|
6989
7137
|
return;
|
|
6990
7138
|
}
|
|
6991
7139
|
changeNotificationState({
|
|
6992
|
-
onYes: () =>
|
|
7140
|
+
onYes: () => goTo(getRedirectLink('/app'))
|
|
6993
7141
|
});
|
|
6994
7142
|
};
|
|
6995
7143
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -7021,7 +7169,7 @@ function AppLayout({
|
|
|
7021
7169
|
isCollapsed: isCollapsed,
|
|
7022
7170
|
user: user,
|
|
7023
7171
|
sidenavConfig: sidenavConfig,
|
|
7024
|
-
|
|
7172
|
+
goTo: goTo,
|
|
7025
7173
|
location: location,
|
|
7026
7174
|
matchPath: matchPath,
|
|
7027
7175
|
t: t,
|
|
@@ -7051,7 +7199,10 @@ function AppLayout({
|
|
|
7051
7199
|
children: isAppNavigation ? null : /*#__PURE__*/o__default["default"].createElement(isCollapsed ? icons.MenuUnfoldOutlined : icons.MenuFoldOutlined, {
|
|
7052
7200
|
className: 'trigger',
|
|
7053
7201
|
onClick: () => {
|
|
7054
|
-
|
|
7202
|
+
console.log('Trigger clicked! Current isCollapsed:', isCollapsed);
|
|
7203
|
+
const newValue = !isCollapsed;
|
|
7204
|
+
console.log('Setting to:', newValue);
|
|
7205
|
+
setIsCollapse(newValue);
|
|
7055
7206
|
}
|
|
7056
7207
|
})
|
|
7057
7208
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -7085,7 +7236,8 @@ function AppLayout({
|
|
|
7085
7236
|
userPreferences: userPreferences,
|
|
7086
7237
|
module: module,
|
|
7087
7238
|
t: t,
|
|
7088
|
-
|
|
7239
|
+
goTo: goTo,
|
|
7240
|
+
getRedirectLink: getRedirectLink,
|
|
7089
7241
|
appName: appName
|
|
7090
7242
|
}),
|
|
7091
7243
|
disabled: true
|
|
@@ -7110,7 +7262,7 @@ function AppLayout({
|
|
|
7110
7262
|
color: 'white',
|
|
7111
7263
|
height: '30px'
|
|
7112
7264
|
},
|
|
7113
|
-
defaultValue:
|
|
7265
|
+
defaultValue: StorageManager.get('datastakeLng') || 'en',
|
|
7114
7266
|
bordered: false,
|
|
7115
7267
|
onChange: lng => updateLanguage?.(lng),
|
|
7116
7268
|
popupClassName: formatClassname(['dark-select-popup language-select', appName]),
|
|
@@ -7144,7 +7296,8 @@ function AppLayout({
|
|
|
7144
7296
|
settingsDrawerOpened: settingsDrawerOpened,
|
|
7145
7297
|
notificationMode: notificationMode,
|
|
7146
7298
|
isAppNavigation: isAppNavigation,
|
|
7147
|
-
|
|
7299
|
+
goTo: goTo,
|
|
7300
|
+
getRedirectLink: getRedirectLink,
|
|
7148
7301
|
changeNotificationState: changeNotificationState,
|
|
7149
7302
|
isUserApproved: isUserApproved,
|
|
7150
7303
|
t: t,
|
|
@@ -7168,7 +7321,7 @@ function AppLayout({
|
|
|
7168
7321
|
drawerOpened: drawerOpened,
|
|
7169
7322
|
user: user,
|
|
7170
7323
|
sidenavConfig: sidenavConfig,
|
|
7171
|
-
navigate:
|
|
7324
|
+
navigate: goTo,
|
|
7172
7325
|
t: t,
|
|
7173
7326
|
checkPermission: checkPermission,
|
|
7174
7327
|
logOut: logOut,
|
package/package.json
CHANGED
|
@@ -15,7 +15,8 @@ export default function MobileDrawer({
|
|
|
15
15
|
isUserDropdown = false,
|
|
16
16
|
user,
|
|
17
17
|
sidenavConfig = {},
|
|
18
|
-
|
|
18
|
+
goTo = () => {},
|
|
19
|
+
getRedirectLink = () => {},
|
|
19
20
|
t = (key) => key,
|
|
20
21
|
checkPermission = () => false,
|
|
21
22
|
logOut,
|
|
@@ -57,11 +58,6 @@ export default function MobileDrawer({
|
|
|
57
58
|
logOut?.();
|
|
58
59
|
}, [logOut]);
|
|
59
60
|
|
|
60
|
-
const goTo = (...props) => {
|
|
61
|
-
navigate?.(...props);
|
|
62
|
-
toggle();
|
|
63
|
-
};
|
|
64
|
-
|
|
65
61
|
const filteredItems = useMemo(() => {
|
|
66
62
|
const mapItems = (item) => {
|
|
67
63
|
const isDisabled = typeof item.isDisabled === 'function' ?
|
|
@@ -13,7 +13,8 @@ export default function Notifications({
|
|
|
13
13
|
mod = 'pme',
|
|
14
14
|
toggle = () => { },
|
|
15
15
|
t = (key) => key,
|
|
16
|
-
|
|
16
|
+
goTo = () => {},
|
|
17
|
+
getRedirectLink = () => {},
|
|
17
18
|
appName = 'app',
|
|
18
19
|
}) {
|
|
19
20
|
const [historyVisible, setHistoryVisible] = useState(false);
|
|
@@ -44,7 +45,7 @@ export default function Notifications({
|
|
|
44
45
|
icon: <CustomIcon name="Settings" width={13} height={13} />,
|
|
45
46
|
onClick: () => {
|
|
46
47
|
toggle();
|
|
47
|
-
|
|
48
|
+
goTo(getRedirectLink(`/app/${mod}/view/settings?activeForm=notifications`));
|
|
48
49
|
},
|
|
49
50
|
label: t('Settings'),
|
|
50
51
|
},
|
|
@@ -86,7 +87,7 @@ export default function Notifications({
|
|
|
86
87
|
key={`notifications-${i + 1}`}
|
|
87
88
|
n={n}
|
|
88
89
|
t={t}
|
|
89
|
-
|
|
90
|
+
goTo={goTo}
|
|
90
91
|
/>
|
|
91
92
|
))}
|
|
92
93
|
{loading && (
|
|
@@ -99,7 +100,7 @@ export default function Notifications({
|
|
|
99
100
|
visible={historyVisible}
|
|
100
101
|
setHistoryVisible={setHistoryVisible}
|
|
101
102
|
t={t}
|
|
102
|
-
|
|
103
|
+
goTo={goTo}
|
|
103
104
|
/>
|
|
104
105
|
</NotificationsStyle>
|
|
105
106
|
);
|
|
@@ -25,7 +25,8 @@ export const renderModule = ({
|
|
|
25
25
|
isCollapsed,
|
|
26
26
|
onClick,
|
|
27
27
|
user,
|
|
28
|
-
userHelpers = {}
|
|
28
|
+
userHelpers = {},
|
|
29
|
+
goTo = () => {},
|
|
29
30
|
}) => {
|
|
30
31
|
const { userIsAdmin, userIsSbgImplementor, userIsSbgPartner } = userHelpers;
|
|
31
32
|
|
|
@@ -86,7 +87,7 @@ const Sidenav = ({
|
|
|
86
87
|
isCollapsed = false,
|
|
87
88
|
showMenu = true,
|
|
88
89
|
sidenavConfig = {},
|
|
89
|
-
|
|
90
|
+
goTo = () => {},
|
|
90
91
|
location,
|
|
91
92
|
matchPath,
|
|
92
93
|
t,
|
|
@@ -94,7 +95,7 @@ const Sidenav = ({
|
|
|
94
95
|
userHelpers = {},
|
|
95
96
|
isDev = false,
|
|
96
97
|
appName = 'app',
|
|
97
|
-
getRedirectLink,
|
|
98
|
+
getRedirectLink = () => {},
|
|
98
99
|
isDatastake,
|
|
99
100
|
selectedProject,
|
|
100
101
|
}) => {
|
|
@@ -111,22 +112,15 @@ const Sidenav = ({
|
|
|
111
112
|
const { pathname } = location || {};
|
|
112
113
|
|
|
113
114
|
const mod = useMemo(() => module, [module, user]);
|
|
114
|
-
|
|
115
|
-
const _getRedirectLink = getRedirectLink || ((link) => {
|
|
116
|
-
if (window.location.pathname.includes(`/${appName}`)) {
|
|
117
|
-
return `/${appName}${link}`;
|
|
118
|
-
}
|
|
119
|
-
return link;
|
|
120
|
-
});
|
|
121
115
|
|
|
122
116
|
const checkPath = (i) => {
|
|
123
117
|
if (!matchPath || !pathname) return false;
|
|
124
118
|
|
|
125
119
|
return (matchPath({
|
|
126
|
-
path:
|
|
120
|
+
path: getRedirectLink(i.path),
|
|
127
121
|
exact: true,
|
|
128
122
|
}, pathname) || (i.subPath && i.subPath.filter(s => matchPath({
|
|
129
|
-
path:
|
|
123
|
+
path: getRedirectLink(s),
|
|
130
124
|
exact: true,
|
|
131
125
|
}, pathname)).length)) ? true : false;
|
|
132
126
|
};
|
|
@@ -169,12 +163,17 @@ const Sidenav = ({
|
|
|
169
163
|
};
|
|
170
164
|
|
|
171
165
|
const checkOnClick = ({ event }) => {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
166
|
+
console.log("checkOnClick", changeNotificationState);
|
|
167
|
+
// If no changeNotificationState or no unsaved changes, execute immediately
|
|
168
|
+
if (!changeNotificationState) {
|
|
169
|
+
if (typeof event === 'function') {
|
|
170
|
+
event();
|
|
171
|
+
}
|
|
172
|
+
return;
|
|
177
173
|
}
|
|
174
|
+
|
|
175
|
+
// Otherwise, use the notification state mechanism
|
|
176
|
+
changeNotificationState({ onYes: event });
|
|
178
177
|
};
|
|
179
178
|
|
|
180
179
|
const { hoverContent, hoverContentSecond } = useMenu({
|
|
@@ -192,7 +191,7 @@ const Sidenav = ({
|
|
|
192
191
|
setHoverOpen,
|
|
193
192
|
module,
|
|
194
193
|
notApprovedModal,
|
|
195
|
-
goTo
|
|
194
|
+
goTo,
|
|
196
195
|
hoverItemSecond,
|
|
197
196
|
isDev,
|
|
198
197
|
});
|
|
@@ -253,7 +252,7 @@ const Sidenav = ({
|
|
|
253
252
|
isCollapsed,
|
|
254
253
|
onClick: () => checkOnClick({
|
|
255
254
|
event: () => {
|
|
256
|
-
|
|
255
|
+
goTo(getRedirectLink(`/app`));
|
|
257
256
|
}
|
|
258
257
|
}),
|
|
259
258
|
mod,
|
|
@@ -288,7 +287,7 @@ const Sidenav = ({
|
|
|
288
287
|
setHoverOpen={setHoverOpen}
|
|
289
288
|
onMouseMove={onMouseMove}
|
|
290
289
|
user={user}
|
|
291
|
-
goTo={
|
|
290
|
+
goTo={goTo}
|
|
292
291
|
notApprovedModal={notApprovedModal}
|
|
293
292
|
isDev={isDev}
|
|
294
293
|
t={t}
|
|
@@ -11,7 +11,8 @@ export const UserDropdownMenu = ({
|
|
|
11
11
|
user,
|
|
12
12
|
toggleSettingsDrawer = () => { },
|
|
13
13
|
settingsDrawerOpened,
|
|
14
|
-
|
|
14
|
+
goTo = () => {},
|
|
15
|
+
getRedirectLink = () => {},
|
|
15
16
|
changeNotificationState,
|
|
16
17
|
t = (s) => s,
|
|
17
18
|
isAppNavigation,
|
|
@@ -27,11 +28,10 @@ export const UserDropdownMenu = ({
|
|
|
27
28
|
const { userIsAdmin } = userHelpers;
|
|
28
29
|
const isAdmin = useMemo(() => userIsAdmin?.(user), [user, userIsAdmin]);
|
|
29
30
|
|
|
31
|
+
// Add fallback for windowWidth
|
|
30
32
|
const actualWidth = windowWidth || (typeof window !== 'undefined' ? window.innerWidth : 1920);
|
|
31
33
|
const isMobile = useMemo(() => actualWidth <= MOBILE_W, [actualWidth]);
|
|
32
34
|
|
|
33
|
-
console.log('UserDropdown Debug:', { windowWidth, actualWidth, isMobile, MOBILE_W }); // Debug log
|
|
34
|
-
|
|
35
35
|
const canViewUsers = checkPermission({
|
|
36
36
|
permission: 'users.canView',
|
|
37
37
|
permissions: user?.role?.permissions
|
|
@@ -48,7 +48,25 @@ export const UserDropdownMenu = ({
|
|
|
48
48
|
return Array.isArray(_arr) && _arr[0] ? _arr[0].url : null;
|
|
49
49
|
}, [user]);
|
|
50
50
|
|
|
51
|
-
const isDemoEnv =
|
|
51
|
+
const isDemoEnv = isDev;
|
|
52
|
+
|
|
53
|
+
// Helper function to handle navigation with notification check
|
|
54
|
+
const handleNavigate = (path) => {
|
|
55
|
+
if (changeNotificationState) {
|
|
56
|
+
changeNotificationState({ onYes: () => goTo(getRedirectLink(path)) });
|
|
57
|
+
} else {
|
|
58
|
+
goTo(getRedirectLink(path));
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// Helper function to handle logout with notification check
|
|
63
|
+
const handleLogout = () => {
|
|
64
|
+
if (changeNotificationState) {
|
|
65
|
+
changeNotificationState({ onYes: () => logOut() });
|
|
66
|
+
} else {
|
|
67
|
+
logOut();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
52
70
|
|
|
53
71
|
return isMobile ? (
|
|
54
72
|
<div className="d-flex flex-column justify-content-center" onClick={toggleSettingsDrawer}>
|
|
@@ -59,7 +77,8 @@ export const UserDropdownMenu = ({
|
|
|
59
77
|
toggle={toggleSettingsDrawer}
|
|
60
78
|
drawerOpened={settingsDrawerOpened}
|
|
61
79
|
user={user}
|
|
62
|
-
|
|
80
|
+
goTo={goTo}
|
|
81
|
+
getRedirectLink={getRedirectLink}
|
|
63
82
|
t={t}
|
|
64
83
|
checkPermission={checkPermission}
|
|
65
84
|
logOut={logOut}
|
|
@@ -74,42 +93,42 @@ export const UserDropdownMenu = ({
|
|
|
74
93
|
rootClassName={formatClassname(['user-dropdown-layout', appName])}
|
|
75
94
|
menu={{
|
|
76
95
|
items: [
|
|
96
|
+
// Only show Users option if conditions met
|
|
97
|
+
...(user.company && !isDemoEnv && canViewUsers && !isAdmin ? [{
|
|
98
|
+
label: t('Users'),
|
|
99
|
+
key: 'users',
|
|
100
|
+
onClick: () => handleNavigate(getRedirectLink(`/app/users`))
|
|
101
|
+
}] : []),
|
|
102
|
+
// Only show Settings option if conditions met
|
|
103
|
+
...(canViewSettings && !isAppNavigation && !isAdmin ? [{
|
|
104
|
+
label: t('Settings'),
|
|
105
|
+
key: 'settings',
|
|
106
|
+
onClick: () => handleNavigate(getRedirectLink(`/app/view/settings`))
|
|
107
|
+
}] : []),
|
|
108
|
+
// Always show logout
|
|
77
109
|
{
|
|
78
|
-
label: (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<h4>{user?.company?.name || ''}</h4>
|
|
82
|
-
<p>{user?.firstName || ''} {user?.lastName || ''}</p>
|
|
83
|
-
</div>
|
|
84
|
-
<div className='list'>
|
|
85
|
-
{user.company && !isDemoEnv && canViewUsers && !isAdmin ?
|
|
86
|
-
<div className='list-item' onClick={() => {
|
|
87
|
-
changeNotificationState({ onYes: () => navigate?.(`/app/users`) });
|
|
88
|
-
}}>
|
|
89
|
-
{t('Users')}
|
|
90
|
-
</div>
|
|
91
|
-
: null}
|
|
92
|
-
|
|
93
|
-
{canViewSettings && !isAppNavigation && !isAdmin ? (
|
|
94
|
-
<div className='list-item' onClick={() => {
|
|
95
|
-
changeNotificationState({ onYes: () => navigate?.(`/app/view/settings`) });
|
|
96
|
-
}}>
|
|
97
|
-
{t('Settings')}
|
|
98
|
-
</div>
|
|
99
|
-
) : null}
|
|
100
|
-
|
|
101
|
-
<div className='list-item' onClick={() => {
|
|
102
|
-
changeNotificationState({ onYes: () => logOut() });
|
|
103
|
-
}}>
|
|
104
|
-
{t('Log out')}
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
</>
|
|
108
|
-
),
|
|
109
|
-
key: 'userMenu'
|
|
110
|
+
label: t('Log out'),
|
|
111
|
+
key: 'logout',
|
|
112
|
+
onClick: handleLogout
|
|
110
113
|
}
|
|
111
|
-
]
|
|
114
|
+
],
|
|
115
|
+
// Add the header as a separate component
|
|
116
|
+
onClick: (info) => {
|
|
117
|
+
// This will be called when any menu item is clicked
|
|
118
|
+
console.log('Menu item clicked:', info.key);
|
|
119
|
+
}
|
|
112
120
|
}}
|
|
121
|
+
dropdownRender={(menu) => (
|
|
122
|
+
<div>
|
|
123
|
+
<div className="drop-header">
|
|
124
|
+
<h4>{user?.company?.name || ''}</h4>
|
|
125
|
+
<p>{user?.firstName || ''} {user?.lastName || ''}</p>
|
|
126
|
+
</div>
|
|
127
|
+
<div className='list'>
|
|
128
|
+
{React.cloneElement(menu)}
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
)}
|
|
113
132
|
>
|
|
114
133
|
<div className="d-flex flex-column justify-content-center">
|
|
115
134
|
<UserIcon companyLogo={companyLogo} />
|
|
@@ -16,6 +16,7 @@ import MobileDrawer from "./components/MobileDrawer/index.js";
|
|
|
16
16
|
import Notifications from "./components/Notifications/index.js";
|
|
17
17
|
import LoginPopup from "./components/LoginPopup/index.js";
|
|
18
18
|
import { NotificationsProvider } from "./components/Notifications/context/index.js";
|
|
19
|
+
import { StorageManager } from "../../../helpers/StorageManager.js";
|
|
19
20
|
import './index.scss';
|
|
20
21
|
|
|
21
22
|
const { Content } = Layout;
|
|
@@ -64,11 +65,11 @@ function AppLayout({
|
|
|
64
65
|
selectedProject,
|
|
65
66
|
|
|
66
67
|
// Navigation (injected from app)
|
|
67
|
-
|
|
68
|
+
goTo = () => {},
|
|
68
69
|
location,
|
|
69
70
|
matchPath,
|
|
70
71
|
Outlet,
|
|
71
|
-
getRedirectLink,
|
|
72
|
+
getRedirectLink = () => {},
|
|
72
73
|
isDatastake,
|
|
73
74
|
|
|
74
75
|
// Others
|
|
@@ -144,10 +145,9 @@ function AppLayout({
|
|
|
144
145
|
}, [getUserPreference]);
|
|
145
146
|
|
|
146
147
|
const setIsCollapse = (val = false) => {
|
|
147
|
-
|
|
148
|
+
console.log('setIsCollapse called with:', val); // Debug
|
|
149
|
+
StorageManager.set('is_collapsed', val ? 'true' : 'false');
|
|
148
150
|
setIsCollapsed(val);
|
|
149
|
-
|
|
150
|
-
// Also call the parent's onCollapse callback
|
|
151
151
|
if (onCollapse && typeof onCollapse === 'function') {
|
|
152
152
|
onCollapse(val);
|
|
153
153
|
}
|
|
@@ -167,7 +167,7 @@ function AppLayout({
|
|
|
167
167
|
user?.modules[module].status === 'approved';
|
|
168
168
|
|
|
169
169
|
useEffect(() => {
|
|
170
|
-
if (
|
|
170
|
+
if (StorageManager.get('previous')) {
|
|
171
171
|
setPrevious(true);
|
|
172
172
|
}
|
|
173
173
|
}, [user?.language]);
|
|
@@ -205,7 +205,7 @@ function AppLayout({
|
|
|
205
205
|
if (Object.keys(user?.modules || {}).length <= 1) {
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
|
-
changeNotificationState({ onYes: () =>
|
|
208
|
+
changeNotificationState({ onYes: () => goTo(getRedirectLink('/app')) });
|
|
209
209
|
};
|
|
210
210
|
|
|
211
211
|
return (
|
|
@@ -244,7 +244,7 @@ function AppLayout({
|
|
|
244
244
|
isCollapsed={isCollapsed}
|
|
245
245
|
user={user}
|
|
246
246
|
sidenavConfig={sidenavConfig}
|
|
247
|
-
|
|
247
|
+
goTo={goTo}
|
|
248
248
|
location={location}
|
|
249
249
|
matchPath={matchPath}
|
|
250
250
|
t={t}
|
|
@@ -271,17 +271,20 @@ function AppLayout({
|
|
|
271
271
|
])}
|
|
272
272
|
>
|
|
273
273
|
<div className="d-flex left-sidebar right-sidebar">
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
274
|
+
<div className="desktop">
|
|
275
|
+
{isAppNavigation ? null : React.createElement(
|
|
276
|
+
isCollapsed ? MenuUnfoldOutlined : MenuFoldOutlined,
|
|
277
|
+
{
|
|
278
|
+
className: 'trigger',
|
|
279
|
+
onClick: () => {
|
|
280
|
+
console.log('Trigger clicked! Current isCollapsed:', isCollapsed);
|
|
281
|
+
const newValue = !isCollapsed;
|
|
282
|
+
console.log('Setting to:', newValue);
|
|
283
|
+
setIsCollapse(newValue);
|
|
284
|
+
},
|
|
285
|
+
}
|
|
286
|
+
)}
|
|
287
|
+
</div>
|
|
285
288
|
<div className="mobile" onClick={toggleDrawer}>
|
|
286
289
|
<img src={collapsedAppLogo} alt="logo" />
|
|
287
290
|
</div>
|
|
@@ -311,7 +314,8 @@ function AppLayout({
|
|
|
311
314
|
userPreferences={userPreferences}
|
|
312
315
|
module={module}
|
|
313
316
|
t={t}
|
|
314
|
-
|
|
317
|
+
goTo={goTo}
|
|
318
|
+
getRedirectLink={getRedirectLink}
|
|
315
319
|
appName={appName}
|
|
316
320
|
/>
|
|
317
321
|
),
|
|
@@ -335,7 +339,7 @@ function AppLayout({
|
|
|
335
339
|
<Select
|
|
336
340
|
className="ln-22 dark-select language-select"
|
|
337
341
|
style={{ color: 'white', height: '30px' }}
|
|
338
|
-
defaultValue={
|
|
342
|
+
defaultValue={StorageManager.get('datastakeLng') || 'en'}
|
|
339
343
|
bordered={false}
|
|
340
344
|
onChange={lng => updateLanguage?.(lng)}
|
|
341
345
|
popupClassName={formatClassname(['dark-select-popup language-select', appName])}
|
|
@@ -367,7 +371,8 @@ function AppLayout({
|
|
|
367
371
|
settingsDrawerOpened={settingsDrawerOpened}
|
|
368
372
|
notificationMode={notificationMode}
|
|
369
373
|
isAppNavigation={isAppNavigation}
|
|
370
|
-
|
|
374
|
+
goTo={goTo}
|
|
375
|
+
getRedirectLink={getRedirectLink}
|
|
371
376
|
changeNotificationState={changeNotificationState}
|
|
372
377
|
isUserApproved={isUserApproved}
|
|
373
378
|
t={t}
|
|
@@ -395,7 +400,7 @@ function AppLayout({
|
|
|
395
400
|
drawerOpened={drawerOpened}
|
|
396
401
|
user={user}
|
|
397
402
|
sidenavConfig={sidenavConfig}
|
|
398
|
-
navigate={
|
|
403
|
+
navigate={goTo}
|
|
399
404
|
t={t}
|
|
400
405
|
checkPermission={checkPermission}
|
|
401
406
|
logOut={logOut}
|