@asaleh37/ui-base 25.12.10 → 25.12.17

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.
@@ -27,6 +27,7 @@ import AttachmentImageViewer from "../components/templates/attachment/Attachment
27
27
  import NotificationButton from "./NotificationButton";
28
28
  import { useState } from "react";
29
29
  import ChangePasswordPanel from "../components/administration/admin/ChangePasswordPanel";
30
+ import { AppInfo } from "../redux/features/common/AppInfoSlice";
30
31
 
31
32
  interface AppBarProps extends MuiAppBarProps {
32
33
  open?: boolean;
@@ -35,6 +36,7 @@ interface AppBarProps extends MuiAppBarProps {
35
36
  const AppBar = styled(MuiAppBar, {
36
37
  shouldForwardProp: (prop) => prop !== "open",
37
38
  })<AppBarProps>(({ theme }) => {
39
+ const AppInfo: AppInfo = useSelector((state: any) => state.AppInfo.value);
38
40
  const AppLayout = useSelector((state: any) => state.AppLayout);
39
41
  const isMobile = useIsMobile();
40
42
  return {
@@ -109,40 +111,49 @@ const TopBar: React.FC = () => {
109
111
  };
110
112
  return (
111
113
  <>
112
- <ChangePasswordWindow>
113
- <ChangePasswordPanel
114
- selectedPerson={UserSession.value}
115
- isSelfService={true}
116
- onSuccessCallBk={() => {
117
- setChangePasswordWindow(false);
118
- }}
119
- />
120
- </ChangePasswordWindow>
121
- <Menu
122
- sx={{ mt: "45px" }}
123
- id="menu-appbar"
124
- anchorEl={anchorElUser}
125
- anchorOrigin={{
126
- vertical: "top",
127
- horizontal: "right",
128
- }}
129
- keepMounted
130
- transformOrigin={{
131
- vertical: "top",
132
- horizontal: "right",
133
- }}
134
- open={Boolean(anchorElUser)}
135
- onClose={handleCloseUserMenu}
136
- >
137
- <MenuItem
138
- onClick={() => {
139
- setChangePasswordWindow(true);
140
- handleCloseUserMenu();
141
- }}
142
- >
143
- <Typography sx={{ textAlign: "center" }}>Change Password</Typography>
144
- </MenuItem>
145
- </Menu>
114
+ {AppInfo.isUserProfileManaged ? (
115
+ <>
116
+ <ChangePasswordWindow>
117
+ <ChangePasswordPanel
118
+ selectedPerson={UserSession.value}
119
+ isSelfService={true}
120
+ onSuccessCallBk={() => {
121
+ setChangePasswordWindow(false);
122
+ }}
123
+ />
124
+ </ChangePasswordWindow>
125
+ <Menu
126
+ sx={{ mt: "45px" }}
127
+ id="menu-appbar"
128
+ anchorEl={anchorElUser}
129
+ anchorOrigin={{
130
+ vertical: "top",
131
+ horizontal: "right",
132
+ }}
133
+ keepMounted
134
+ transformOrigin={{
135
+ vertical: "top",
136
+ horizontal: "right",
137
+ }}
138
+ open={Boolean(anchorElUser)}
139
+ onClose={handleCloseUserMenu}
140
+ >
141
+ <MenuItem
142
+ onClick={() => {
143
+ setChangePasswordWindow(true);
144
+ handleCloseUserMenu();
145
+ }}
146
+ >
147
+ <Typography sx={{ textAlign: "center" }}>
148
+ Change Password
149
+ </Typography>
150
+ </MenuItem>
151
+ </Menu>
152
+ </>
153
+ ) : (
154
+ <></>
155
+ )}
156
+
146
157
  <ChangeOrgWindow>
147
158
  <ChangeOrgForm
148
159
  successChangeCallBackFn={() => {
@@ -199,6 +210,7 @@ const TopBar: React.FC = () => {
199
210
  }
200
211
  >
201
212
  <IconButton
213
+ sx={{ mx: 1 }}
202
214
  color="inherit"
203
215
  onClick={() => {
204
216
  dispatch(
@@ -219,28 +231,33 @@ const TopBar: React.FC = () => {
219
231
  )}
220
232
  </IconButton>
221
233
  </Tooltip>
222
- <Tooltip
223
- title={
224
- i18n.language === "ar"
225
- ? "Change Language To English"
226
- : "Change Language To Arabic"
227
- }
228
- >
229
- <IconButton
230
- color="inherit"
231
- onClick={() => {
232
- let nextLanguage = i18n.language === "ar" ? "en" : "ar";
233
- changeLanguage(nextLanguage);
234
- dispatch(
235
- AppLayoutActions.setAppDirection(
236
- nextLanguage === "ar" ? "rtl" : "ltr"
237
- )
238
- );
239
- }}
234
+ {AppInfo.isLocalizationEnabled ? (
235
+ <Tooltip
236
+ title={
237
+ i18n.language === "ar"
238
+ ? "Change Language To English"
239
+ : "Change Language To Arabic"
240
+ }
240
241
  >
241
- <FontAwesomeIcon icon="language" />
242
- </IconButton>
243
- </Tooltip>
242
+ <IconButton
243
+ color="inherit"
244
+ onClick={() => {
245
+ let nextLanguage = i18n.language === "ar" ? "en" : "ar";
246
+ changeLanguage(nextLanguage);
247
+ dispatch(
248
+ AppLayoutActions.setAppDirection(
249
+ nextLanguage === "ar" ? "rtl" : "ltr"
250
+ )
251
+ );
252
+ }}
253
+ >
254
+ <FontAwesomeIcon icon="language" />
255
+ </IconButton>
256
+ </Tooltip>
257
+ ) : (
258
+ <></>
259
+ )}
260
+
244
261
  {UserSession.value?.userOrganizations &&
245
262
  UserSession.value?.userOrganizations.length > 1 ? (
246
263
  <Tooltip title="Change Current Organization">
package/src/main.tsx CHANGED
@@ -7,11 +7,12 @@ createRoot(document.getElementById("root")!).render(
7
7
  enableUINotifications={false}
8
8
  appLogo={"/logo.png"}
9
9
  appName="UI Base Library"
10
+ isUserProfileManaged={false}
10
11
  loginScreenStyle={{
11
12
  themeMode: "dark",
12
13
  backgroundImageNameInPublicFolder: "bg.jpg",
13
14
  }}
14
- appVersion="25.11.6"
15
+ appVersion="25.12.12"
15
16
  authenticationMethod="APP"
16
17
  azureConfiguration={{
17
18
  frontEndClientId: "c3bbbdbd-f392-4459-b3dd-2351cb07f924",
@@ -47,7 +47,7 @@ export const adminNavigationItems: TreeViewBaseItem<ExtendedTreeItemProps>[] = [
47
47
  children: [
48
48
  {
49
49
  id: "development_admin.organization.modules",
50
- label: "Subscriped Modules",
50
+ label: "Subscribed Modules",
51
51
  icon: "layer-group",
52
52
  authority: "ORGANIZATION_ADMIN",
53
53
  action: "NAVIGATION",
@@ -15,6 +15,8 @@ export type AppInfo = {
15
15
  appName: string | null;
16
16
  appVersion: string | null;
17
17
  appLogo: any | null;
18
+ isUserProfileManaged?: boolean;
19
+ isLocalizationEnabled?: boolean;
18
20
  businessLocals?: {
19
21
  ar: { [key: string]: string };
20
22
  en: { [key: string]: string };
@@ -54,6 +56,8 @@ const initialState: AppInfoProp = {
54
56
  documentTitle: null,
55
57
  apiBaseUrl: null,
56
58
  authenticationMethod: "APP",
59
+ isUserProfileManaged: true,
60
+ isLocalizationEnabled: false,
57
61
  appName: null,
58
62
  appVersion: null,
59
63
  appLogo: null,