hi-tm 0.5.0 → 0.5.1
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.
|
@@ -1,85 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { HeaderLayoutProps } from "../../../types/Layout/Headers/HeaderLayout";
|
|
3
|
-
/**
|
|
4
|
-
* The component accepts the following props:
|
|
5
|
-
* @param branchName - User's branch name to use in the logo URL.
|
|
6
|
-
* @param brandNameText - The name of the brand to display in the header.(next to the logo image)
|
|
7
|
-
* @param userFirstName - The first name of the user to display in the profile section.
|
|
8
|
-
* @param userLastName - The last name of the user to display in the profile section.
|
|
9
|
-
* @param logOutText - Logout text to display in the modal.
|
|
10
|
-
* @param logOutHandler - Function to handle the logout action when the user clicks the logout button.
|
|
11
|
-
* @param modalData - Array of modal data items to display in the profile dropdown menu.
|
|
12
|
-
* @type
|
|
13
|
-
* ```typescript
|
|
14
|
-
* {
|
|
15
|
-
* id: number;
|
|
16
|
-
* title: string;
|
|
17
|
-
* link: string;
|
|
18
|
-
* iconSrc: string;
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
* @param modalItemOnClickHandler - Function Called when the item is clicked.
|
|
22
|
-
* ```typescript
|
|
23
|
-
* {
|
|
24
|
-
* id: number;
|
|
25
|
-
* title: string;
|
|
26
|
-
* link: string;
|
|
27
|
-
* iconSrc: string;
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @param iconsSRC - Object containing paths to various icon sources used in the header.
|
|
32
|
-
* ```typescript
|
|
33
|
-
* {
|
|
34
|
-
logoSRC: string,
|
|
35
|
-
iconProfileUserSRC: string,
|
|
36
|
-
logOutIconSRC: string,
|
|
37
|
-
arrowSRC: string,
|
|
38
|
-
refreshIconSRC: string,
|
|
39
|
-
notificationIconSRC: string,
|
|
40
|
-
languageIconSRC: string,
|
|
41
|
-
menuIconSRC: string,
|
|
42
|
-
trashIconSRC: string,
|
|
43
|
-
closeIconSRC: string,
|
|
44
|
-
}
|
|
45
|
-
* ```
|
|
46
|
-
* @param cdnURL - The base URL for CDN resources.
|
|
47
|
-
* @param userBranchesData - Array of user branch data for branch selection.
|
|
48
|
-
* @param selectBranchHandler - Function to handle branch selection ( Void OR It returns the following type).
|
|
49
|
-
* @type
|
|
50
|
-
* ```typescript
|
|
51
|
-
* {
|
|
52
|
-
* id: number;
|
|
53
|
-
* name: string;
|
|
54
|
-
* urlName: string;
|
|
55
|
-
* imageName: string;
|
|
56
|
-
* logoName: string;
|
|
57
|
-
* }
|
|
58
|
-
* ```
|
|
59
|
-
* @param sidebarData - Array of sidebar data for search in header.
|
|
60
|
-
* @type
|
|
61
|
-
* ```typescript
|
|
62
|
-
* {
|
|
63
|
-
* id: number;
|
|
64
|
-
* imgSrc: string;
|
|
65
|
-
* name: string;
|
|
66
|
-
* keyNameLang: string;
|
|
67
|
-
* FirstSubsets?: FirstSubset[];
|
|
68
|
-
* }
|
|
69
|
-
* ```
|
|
70
|
-
* @param searchIconSRC - The path to the search icon source => type:string.
|
|
71
|
-
* @param searchItemHandler - When the user searches for an item and clicks on a search result,
|
|
72
|
-
* the clicked item is returned with the following type:
|
|
73
|
-
* ```typescript
|
|
74
|
-
* {
|
|
75
|
-
* id: number;
|
|
76
|
-
* name: string;
|
|
77
|
-
* routeURL: string;
|
|
78
|
-
* iconSRC: string;
|
|
79
|
-
* keyNameLang: string;
|
|
80
|
-
* }
|
|
81
|
-
* ```
|
|
82
|
-
* @param refreshPageHandler - Function to refresh the page when the refresh icon is clicked.
|
|
83
|
-
*/
|
|
84
3
|
declare const HeaderLayout: React.FC<HeaderLayoutProps>;
|
|
85
4
|
export default HeaderLayout;
|
|
@@ -42,87 +42,6 @@ const link_1 = __importDefault(require("next/link"));
|
|
|
42
42
|
const react_1 = __importStar(require("react"));
|
|
43
43
|
const ModalProvider_1 = __importDefault(require("../../sections/components/Modals/ModalProvider"));
|
|
44
44
|
const ModalSearchContentInHeader_1 = __importDefault(require("../../sections/components/Modals/ModalSearchContentInHeader"));
|
|
45
|
-
/**
|
|
46
|
-
* The component accepts the following props:
|
|
47
|
-
* @param branchName - User's branch name to use in the logo URL.
|
|
48
|
-
* @param brandNameText - The name of the brand to display in the header.(next to the logo image)
|
|
49
|
-
* @param userFirstName - The first name of the user to display in the profile section.
|
|
50
|
-
* @param userLastName - The last name of the user to display in the profile section.
|
|
51
|
-
* @param logOutText - Logout text to display in the modal.
|
|
52
|
-
* @param logOutHandler - Function to handle the logout action when the user clicks the logout button.
|
|
53
|
-
* @param modalData - Array of modal data items to display in the profile dropdown menu.
|
|
54
|
-
* @type
|
|
55
|
-
* ```typescript
|
|
56
|
-
* {
|
|
57
|
-
* id: number;
|
|
58
|
-
* title: string;
|
|
59
|
-
* link: string;
|
|
60
|
-
* iconSrc: string;
|
|
61
|
-
* }
|
|
62
|
-
* ```
|
|
63
|
-
* @param modalItemOnClickHandler - Function Called when the item is clicked.
|
|
64
|
-
* ```typescript
|
|
65
|
-
* {
|
|
66
|
-
* id: number;
|
|
67
|
-
* title: string;
|
|
68
|
-
* link: string;
|
|
69
|
-
* iconSrc: string;
|
|
70
|
-
* }
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* @param iconsSRC - Object containing paths to various icon sources used in the header.
|
|
74
|
-
* ```typescript
|
|
75
|
-
* {
|
|
76
|
-
logoSRC: string,
|
|
77
|
-
iconProfileUserSRC: string,
|
|
78
|
-
logOutIconSRC: string,
|
|
79
|
-
arrowSRC: string,
|
|
80
|
-
refreshIconSRC: string,
|
|
81
|
-
notificationIconSRC: string,
|
|
82
|
-
languageIconSRC: string,
|
|
83
|
-
menuIconSRC: string,
|
|
84
|
-
trashIconSRC: string,
|
|
85
|
-
closeIconSRC: string,
|
|
86
|
-
}
|
|
87
|
-
* ```
|
|
88
|
-
* @param cdnURL - The base URL for CDN resources.
|
|
89
|
-
* @param userBranchesData - Array of user branch data for branch selection.
|
|
90
|
-
* @param selectBranchHandler - Function to handle branch selection ( Void OR It returns the following type).
|
|
91
|
-
* @type
|
|
92
|
-
* ```typescript
|
|
93
|
-
* {
|
|
94
|
-
* id: number;
|
|
95
|
-
* name: string;
|
|
96
|
-
* urlName: string;
|
|
97
|
-
* imageName: string;
|
|
98
|
-
* logoName: string;
|
|
99
|
-
* }
|
|
100
|
-
* ```
|
|
101
|
-
* @param sidebarData - Array of sidebar data for search in header.
|
|
102
|
-
* @type
|
|
103
|
-
* ```typescript
|
|
104
|
-
* {
|
|
105
|
-
* id: number;
|
|
106
|
-
* imgSrc: string;
|
|
107
|
-
* name: string;
|
|
108
|
-
* keyNameLang: string;
|
|
109
|
-
* FirstSubsets?: FirstSubset[];
|
|
110
|
-
* }
|
|
111
|
-
* ```
|
|
112
|
-
* @param searchIconSRC - The path to the search icon source => type:string.
|
|
113
|
-
* @param searchItemHandler - When the user searches for an item and clicks on a search result,
|
|
114
|
-
* the clicked item is returned with the following type:
|
|
115
|
-
* ```typescript
|
|
116
|
-
* {
|
|
117
|
-
* id: number;
|
|
118
|
-
* name: string;
|
|
119
|
-
* routeURL: string;
|
|
120
|
-
* iconSRC: string;
|
|
121
|
-
* keyNameLang: string;
|
|
122
|
-
* }
|
|
123
|
-
* ```
|
|
124
|
-
* @param refreshPageHandler - Function to refresh the page when the refresh icon is clicked.
|
|
125
|
-
*/
|
|
126
45
|
const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, userLastName, logOutText, logOutHandler, modalData, modalItemOnClickHandler, iconsSRC, cdnURL, userBranchesData, selectBranchHandler, sidebarData, searchIconSRC, searchItemHandler, refreshPageHandler, brandNameText, languages, changeLanguageHandler, onLogoClickHandler, defaultLogoImage, }) => {
|
|
127
46
|
const [isShowModalSearch, setIsShowModalSearch] = (0, react_1.useState)(false);
|
|
128
47
|
const [isOpenModal, setIsOpenModal] = (0, react_1.useState)(false);
|
|
@@ -144,7 +63,7 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
144
63
|
setIsOpenModal(!isOpenModal);
|
|
145
64
|
};
|
|
146
65
|
const handleModalShowBranches = () => {
|
|
147
|
-
if (userBranchesData
|
|
66
|
+
if (userBranchesData && userBranchesData.length > 1) {
|
|
148
67
|
setIsOpenModalBranches(!isOpenModalBranches);
|
|
149
68
|
}
|
|
150
69
|
};
|
|
@@ -152,27 +71,19 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
152
71
|
setIsOpenLanguageModal(!isOpenLanguageModal);
|
|
153
72
|
};
|
|
154
73
|
(0, react_1.useEffect)(() => {
|
|
155
|
-
if (userBranchesData) {
|
|
156
|
-
setBranchNameSelected(
|
|
157
|
-
id: userBranchesData.id,
|
|
158
|
-
name: userBranchesData.name,
|
|
159
|
-
urlName: userBranchesData.urlName,
|
|
160
|
-
logoName: userBranchesData.logoName || "",
|
|
161
|
-
});
|
|
74
|
+
if (userBranchesData && userBranchesData.length > 0) {
|
|
75
|
+
setBranchNameSelected(userBranchesData[0]);
|
|
162
76
|
}
|
|
163
77
|
}, [userBranchesData]);
|
|
164
78
|
const selectItemBranchHandler = (branch) => {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
setIsOpenModalBranches(false);
|
|
169
|
-
}
|
|
79
|
+
setBranchNameSelected(branch);
|
|
80
|
+
selectBranchHandler(branch);
|
|
81
|
+
setIsOpenModalBranches(false);
|
|
170
82
|
};
|
|
171
83
|
const selectLanguageHandler = (language) => {
|
|
172
84
|
changeLanguageHandler(language);
|
|
173
85
|
setIsOpenLanguageModal(false);
|
|
174
86
|
};
|
|
175
|
-
console.log("ddddddddddddddddd", userBranchesData);
|
|
176
87
|
(0, react_1.useEffect)(() => {
|
|
177
88
|
const handleClickOutside = (event) => {
|
|
178
89
|
if (modalCloseRefPC.current &&
|
|
@@ -226,18 +137,16 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
226
137
|
appVersion,
|
|
227
138
|
")"),
|
|
228
139
|
react_1.default.createElement("p", { className: "text-nowrap" }, brandNameText)),
|
|
229
|
-
react_1.default.createElement(image_1.default, { src: iconsSRC.logoSRC, alt: "logo", width: 40, height: 40, className: "select-none-custom h-10 w-10", onClick:
|
|
230
|
-
onLogoClickHandler();
|
|
231
|
-
} }))),
|
|
140
|
+
react_1.default.createElement(image_1.default, { src: iconsSRC.logoSRC, alt: "logo", width: 40, height: 40, className: "select-none-custom h-10 w-10", onClick: onLogoClickHandler }))),
|
|
232
141
|
react_1.default.createElement("div", { ref: modalCloseRefuserBranchesPC, className: `relative bg-inherit ${branchNameSelected?.id === 0 ? "hidden" : "flex"}` },
|
|
233
142
|
react_1.default.createElement("div", { onClick: handleModalShowBranches, className: "select-none-custom flex flex-row items-center justify-center gap-3" },
|
|
234
|
-
react_1.default.createElement(image_1.default, { src: `${baseUrlCDN}/${branchName}/${branchNameSelected.logoName}`, alt: "logo.svg", width: 24, height: 24, className: `rounded-md ${userBranchesData
|
|
143
|
+
react_1.default.createElement(image_1.default, { src: `${baseUrlCDN}/${branchName}/${branchNameSelected.logoName}`, alt: "logo.svg", width: 24, height: 24, className: `rounded-md ${userBranchesData && userBranchesData.length <= 1
|
|
235
144
|
? "cursor-default"
|
|
236
145
|
: "cursor-pointer"}` }),
|
|
237
|
-
react_1.default.createElement("p", { className: `${userBranchesData
|
|
146
|
+
react_1.default.createElement("p", { className: `${userBranchesData && userBranchesData.length <= 1
|
|
238
147
|
? "cursor-default"
|
|
239
148
|
: "cursor-pointer"}` }, branchNameSelected.name),
|
|
240
|
-
react_1.default.createElement(image_1.default, { src: iconsSRC.arrowSRC, alt: "arrow.svg", width: 16, height: 16, className: `customTransition ${userBranchesData
|
|
149
|
+
react_1.default.createElement(image_1.default, { src: iconsSRC.arrowSRC, alt: "arrow.svg", width: 16, height: 16, className: `customTransition ${userBranchesData && userBranchesData.length <= 1
|
|
241
150
|
? "hidden"
|
|
242
151
|
: isOpenModalBranches
|
|
243
152
|
? "flex rotate-180 cursor-pointer"
|
|
@@ -245,13 +154,13 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
245
154
|
react_1.default.createElement("div", { className: `customShadowBox customTransition absolute left-0 top-[30px] z-60 w-auto rounded-lg bg-white-color p-tiny ${isOpenModalBranches
|
|
246
155
|
? "scale-y-100 opacity-100"
|
|
247
156
|
: "scale-y-0 opacity-0"} origin-top` },
|
|
248
|
-
react_1.default.createElement("ul", { className: "flex h-auto w-full flex-col items-start justify-center gap-3 bg-inherit p-3" }, userBranchesData
|
|
249
|
-
react_1.default.createElement(image_1.default, { src:
|
|
250
|
-
|
|
251
|
-
|
|
157
|
+
react_1.default.createElement("ul", { className: "flex h-auto w-full flex-col items-start justify-center gap-3 bg-inherit p-3" }, userBranchesData?.map((item) => (react_1.default.createElement("li", { onClick: () => selectItemBranchHandler(item), key: item.id, className: "customTransition flex w-full flex-row items-center justify-end gap-2 rounded-tiny px-5 py-2 text-text-color-primary hover:bg-gray-primary" },
|
|
158
|
+
react_1.default.createElement(image_1.default, { src: item.logoName === " " ||
|
|
159
|
+
item.logoName === null ||
|
|
160
|
+
item.logoName === undefined
|
|
252
161
|
? defaultLogoImage
|
|
253
|
-
: `${baseUrlCDN}/${branchName}/${
|
|
254
|
-
react_1.default.createElement("p", { className: "select-none-custom cursor-pointer text-nowrap text-sm font-normal text-text-color-primary" },
|
|
162
|
+
: `${baseUrlCDN}/${branchName}/${item.logoName}`, alt: "logo.svg", width: 16, height: 16, className: "rounded-xl" }),
|
|
163
|
+
react_1.default.createElement("p", { className: "select-none-custom cursor-pointer text-nowrap text-sm font-normal text-text-color-primary" }, item.name))))))),
|
|
255
164
|
react_1.default.createElement("div", { ref: modalCloseRefPC, className: "flex h-full flex-row-reverse items-center justify-center gap-4" },
|
|
256
165
|
react_1.default.createElement("div", { onClick: handleModalShow, className: "border-primaryBorderColor relative flex cursor-pointer flex-row items-center justify-center gap-1 rounded-lg border border-solid p-tiny" },
|
|
257
166
|
react_1.default.createElement("div", { className: "flex flex-row items-center justify-center gap-1" },
|
|
@@ -262,13 +171,12 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
262
171
|
react_1.default.createElement(image_1.default, { src: iconsSRC.arrowSRC, alt: "arrow-down.svg", width: 10, height: 10, className: `select-none-custom customTransition ${isOpenModal ? "rotate-180" : "rotate-0"}` })),
|
|
263
172
|
react_1.default.createElement("div", { className: `customShadowBox customTransition absolute left-2 top-[40px] z-60 w-[216px] rounded-lg bg-white-color p-tiny ${isOpenModal ? "scale-y-100 opacity-100" : "scale-y-0 opacity-0"} origin-top` },
|
|
264
173
|
react_1.default.createElement("ul", { className: "flex h-full w-full flex-col items-start justify-center gap-3 p-3" },
|
|
265
|
-
modalData
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
react_1.default.createElement(image_1.default, { src: item.iconSrc, alt: "user-square.svg", width: 16, height: 16 })))),
|
|
174
|
+
modalData?.map((item) => (react_1.default.createElement("li", { onClick: () => {
|
|
175
|
+
handleModalShow();
|
|
176
|
+
modalItemOnClickHandler(item);
|
|
177
|
+
}, key: item.id, className: "customTransition flex w-full flex-row-reverse items-center justify-end gap-1 rounded-xl p-2 text-text-color-primary hover:bg-gray-primary" },
|
|
178
|
+
react_1.default.createElement("p", null, item.title),
|
|
179
|
+
react_1.default.createElement(image_1.default, { src: item.iconSrc, alt: "user-square.svg", width: 16, height: 16 })))),
|
|
272
180
|
react_1.default.createElement("li", { onClick: () => {
|
|
273
181
|
logOutHandler();
|
|
274
182
|
handleModalShow();
|
|
@@ -276,9 +184,7 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
276
184
|
react_1.default.createElement("p", { className: "text-nowrap" }, logOutText),
|
|
277
185
|
react_1.default.createElement(image_1.default, { src: iconsSRC.logOutIconSRC, alt: "logOutIcon.svg", width: 16, height: 16 }))))),
|
|
278
186
|
react_1.default.createElement("div", { className: "flex flex-row items-center gap-2" },
|
|
279
|
-
react_1.default.createElement(image_1.default, { src: searchIconSRC, alt: "search.svg", width: 24, height: 24, className: "select-none-custom customTransition cursor-pointer hover:scale-105", onClick: () =>
|
|
280
|
-
setIsShowModalSearch(!isShowModalSearch);
|
|
281
|
-
} }),
|
|
187
|
+
react_1.default.createElement(image_1.default, { src: searchIconSRC, alt: "search.svg", width: 24, height: 24, className: "select-none-custom customTransition cursor-pointer hover:scale-105", onClick: () => setIsShowModalSearch(!isShowModalSearch) }),
|
|
282
188
|
react_1.default.createElement("button", { className: "customTransition hover:scale-105 cursor-pointer" },
|
|
283
189
|
react_1.default.createElement(image_1.default, { onClick: refreshPageHandler, src: iconsSRC.refreshIconSRC, alt: "refreshIcon", width: 22, height: 22, className: "customTransition h-5 w-5 cursor-pointer" })),
|
|
284
190
|
react_1.default.createElement(image_1.default, { src: iconsSRC.notificationIconSRC, alt: "notification.svg", width: 22, height: 22, className: "h-5 w-5 cursor-default opacity-50" }),
|
|
@@ -288,7 +194,7 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
288
194
|
react_1.default.createElement("div", { className: `customShadowBox customTransition absolute -right-[38px] top-[35px] z-[80000] w-fit rounded-lg bg-white-color p-tiny ${isOpenLanguageModal
|
|
289
195
|
? "scale-y-100 opacity-100"
|
|
290
196
|
: "scale-y-0 opacity-0"} origin-top` },
|
|
291
|
-
react_1.default.createElement("ul", { className: "flex h-auto w-full flex-col items-start justify-end gap-3 p-3" }, languages.map((language) => (react_1.default.createElement("li", { key: language
|
|
197
|
+
react_1.default.createElement("ul", { className: "flex h-auto w-full flex-col items-start justify-end gap-3 p-3" }, languages.map((language) => (react_1.default.createElement("li", { key: language.id, onClick: () => selectLanguageHandler(language), className: "customTransition flex w-full flex-row items-center justify-between gap-2 rounded-tiny px-5 py-2 text-text-color-primary hover:bg-gray-primary" },
|
|
292
198
|
react_1.default.createElement(image_1.default, { src: language.flagIcon, alt: `${language.showName}-flag`, width: 16, height: 16, className: "rounded-sm" }),
|
|
293
199
|
react_1.default.createElement("p", { className: "select-none-custom w-full cursor-pointer text-nowrap text-sm font-normal text-text-color-primary" }, language.showName)))))))))),
|
|
294
200
|
react_1.default.createElement("header", { style: { zIndex: 100 }, className: "flex h-11 w-full flex-row items-center justify-between bg-back-ground-color-primary px-5 xl:hidden fixed top-0 z-layout" },
|
|
@@ -296,30 +202,28 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
296
202
|
react_1.default.createElement(image_1.default, { src: iconsSRC.menuIconSRC, alt: "menu.svg", width: 20, height: 20, className: "h-full w-full" })),
|
|
297
203
|
react_1.default.createElement("div", { ref: modalCloseRefuserBranchesMobile, className: `relative bg-inherit ${branchNameSelected?.id === 0 ? "hidden" : "flex"}` },
|
|
298
204
|
react_1.default.createElement("div", { onClick: handleModalShowBranches, className: "select-none-custom flex flex-row items-center justify-center gap-3" },
|
|
299
|
-
react_1.default.createElement(image_1.default, { src: `${baseUrlCDN}/${branchName}/${branchNameSelected.logoName}`, alt: "logo.svg", width: 24, height: 24, className: `rounded-md ${userBranchesData
|
|
205
|
+
react_1.default.createElement(image_1.default, { src: `${baseUrlCDN}/${branchName}/${branchNameSelected.logoName}`, alt: "logo.svg", width: 24, height: 24, className: `rounded-md ${userBranchesData && userBranchesData.length <= 1
|
|
300
206
|
? "cursor-default"
|
|
301
207
|
: "cursor-pointer"}` }),
|
|
302
|
-
react_1.default.createElement("p", { className: `${userBranchesData
|
|
208
|
+
react_1.default.createElement("p", { className: `${userBranchesData && userBranchesData.length <= 1
|
|
303
209
|
? "cursor-default"
|
|
304
210
|
: "cursor-pointer"}` }, branchNameSelected.name),
|
|
305
|
-
react_1.default.createElement(image_1.default, { src: iconsSRC.arrowSRC, alt: "arrow.svg", width: 16, height: 16, className: `${userBranchesData
|
|
211
|
+
react_1.default.createElement(image_1.default, { src: iconsSRC.arrowSRC, alt: "arrow.svg", width: 16, height: 16, className: `${userBranchesData && userBranchesData.length <= 1
|
|
306
212
|
? "hidden"
|
|
307
213
|
: "flex cursor-pointer"}` })),
|
|
308
214
|
react_1.default.createElement("div", { className: `customShadowBox customTransition absolute left-0 top-[40px] z-60 w-auto rounded-lg bg-white-color p-tiny ${isOpenModalBranches
|
|
309
215
|
? "scale-y-100 opacity-100"
|
|
310
216
|
: "scale-y-0 opacity-0"} origin-top` },
|
|
311
|
-
react_1.default.createElement("ul", { className: "flex h-auto w-full flex-col items-start justify-center gap-3 bg-inherit p-3" }, userBranchesData
|
|
312
|
-
react_1.default.createElement(image_1.default, { src:
|
|
313
|
-
|
|
314
|
-
|
|
217
|
+
react_1.default.createElement("ul", { className: "flex h-auto w-full flex-col items-start justify-center gap-3 bg-inherit p-3" }, userBranchesData?.map((item) => (react_1.default.createElement("li", { onClick: () => selectItemBranchHandler(item), key: item.id, className: "customTransition flex w-full flex-row items-center justify-end gap-2 rounded-tiny px-5 py-2 text-text-color-primary hover:bg-gray-primary" },
|
|
218
|
+
react_1.default.createElement(image_1.default, { src: item.logoName === " " ||
|
|
219
|
+
item.logoName === null ||
|
|
220
|
+
item.logoName === undefined
|
|
315
221
|
? defaultLogoImage
|
|
316
|
-
: `${baseUrlCDN}/${branchName}/${
|
|
317
|
-
react_1.default.createElement("p", { className: "select-none-custom cursor-pointer text-nowrap text-sm font-normal text-text-color-primary" },
|
|
222
|
+
: `${baseUrlCDN}/${branchName}/${item.logoName}`, alt: "logo.svg", width: 16, height: 16, className: "rounded-xl" }),
|
|
223
|
+
react_1.default.createElement("p", { className: "select-none-custom cursor-pointer text-nowrap text-sm font-normal text-text-color-primary" }, item.name))))))),
|
|
318
224
|
react_1.default.createElement("div", { ref: modalCloseRefMobile, className: "flex flex-row items-center justify-center gap-2" },
|
|
319
225
|
react_1.default.createElement("div", { className: "flex flex-row items-center justify-center gap-2" },
|
|
320
|
-
react_1.default.createElement(image_1.default, { src: searchIconSRC, alt: "search.svg", width: 24, height: 24, className: "select-none-custom customTransition cursor-pointer hover:scale-105", onClick: () =>
|
|
321
|
-
setIsShowModalSearch(!isShowModalSearch);
|
|
322
|
-
} }),
|
|
226
|
+
react_1.default.createElement(image_1.default, { src: searchIconSRC, alt: "search.svg", width: 24, height: 24, className: "select-none-custom customTransition cursor-pointer hover:scale-105", onClick: () => setIsShowModalSearch(!isShowModalSearch) }),
|
|
323
227
|
react_1.default.createElement(image_1.default, { src: iconsSRC.notificationIconSRC, alt: "notification.svg", width: 20, height: 20, className: "h-5 w-5 cursor-default opacity-50" })),
|
|
324
228
|
react_1.default.createElement("div", { ref: modalCloseRefLanguageMobile, className: "relative" },
|
|
325
229
|
react_1.default.createElement("div", { className: "customTransition mr-2 cursor-pointer hover:scale-125", onClick: handleLanguageModalShow },
|
|
@@ -327,21 +231,20 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
327
231
|
react_1.default.createElement("div", { className: `customShadowBox customTransition absolute -right-[29px] top-[40px] z-[80000] w-fit rounded-lg bg-white-color p-tiny ${isOpenLanguageModal
|
|
328
232
|
? "scale-y-100 opacity-100"
|
|
329
233
|
: "scale-y-0 opacity-0"} origin-top` },
|
|
330
|
-
react_1.default.createElement("ul", { className: "flex h-auto w-full flex-col items-start justify-center gap-3 p-3" }, languages.map((language) => (react_1.default.createElement("li", { key: language
|
|
234
|
+
react_1.default.createElement("ul", { className: "flex h-auto w-full flex-col items-start justify-center gap-3 p-3" }, languages.map((language) => (react_1.default.createElement("li", { key: language.id, onClick: () => selectLanguageHandler(language), className: "customTransition flex w-full flex-row items-center justify-between gap-2 rounded-tiny px-5 py-2 text-text-color-primary hover:bg-gray-primary" },
|
|
331
235
|
react_1.default.createElement(image_1.default, { src: language.flagIcon, alt: `${language.showName}-flag`, width: 16, height: 16, className: "rounded-sm" }),
|
|
332
236
|
react_1.default.createElement("p", { className: "select-none-custom w-full cursor-pointer text-nowrap text-sm font-normal text-text-color-primary" }, language.showName))))))),
|
|
333
237
|
react_1.default.createElement("div", { onClick: handleModalShow, className: "mr-2 flex h-8 w-10 cursor-pointer flex-row items-center justify-center rounded-lg border border-solid border-border-color-primary bg-inherit" },
|
|
334
238
|
react_1.default.createElement(image_1.default, { src: iconsSRC.iconProfileUserSRC, alt: "profile.svg", width: 18, height: 18 })),
|
|
335
239
|
react_1.default.createElement("div", { className: `customShadowBox customTransition absolute left-4 top-10 z-60 w-[182px] rounded-lg bg-white-color p-tiny ${isOpenModal ? "scale-y-100 opacity-100" : "scale-y-0 opacity-0"} origin-top` },
|
|
336
240
|
react_1.default.createElement("ul", { className: "flex h-full w-full flex-col items-start justify-center gap-3 p-3" },
|
|
337
|
-
modalData.
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
react_1.default.createElement("
|
|
343
|
-
|
|
344
|
-
react_1.default.createElement(image_1.default, { src: item.iconSrc, alt: "user-square.svg", width: 16, height: 16 }))))),
|
|
241
|
+
modalData?.map((item) => (react_1.default.createElement("li", { onClick: () => {
|
|
242
|
+
handleModalShow();
|
|
243
|
+
modalItemOnClickHandler(item);
|
|
244
|
+
}, key: item.id, className: "w-full cursor-pointer text-xs" },
|
|
245
|
+
react_1.default.createElement("div", { className: "customTransition flex w-full flex-row-reverse items-center justify-end gap-1 rounded-xl p-2 text-text-color-primary hover:bg-gray-primary" },
|
|
246
|
+
react_1.default.createElement("p", { className: "text-xs text-nowrap" }, item.title),
|
|
247
|
+
react_1.default.createElement(image_1.default, { src: item.iconSrc, alt: "user-square.svg", width: 16, height: 16 }))))),
|
|
345
248
|
react_1.default.createElement("li", { onClick: () => {
|
|
346
249
|
logOutHandler();
|
|
347
250
|
handleModalShow();
|
|
@@ -12,12 +12,7 @@ export interface HeaderLayoutProps {
|
|
|
12
12
|
iconsSRC: iconsSRC;
|
|
13
13
|
cdnURL: string | undefined;
|
|
14
14
|
imageDefaultSRC: string;
|
|
15
|
-
userBranchesData:
|
|
16
|
-
id: number;
|
|
17
|
-
name: string;
|
|
18
|
-
urlName: string;
|
|
19
|
-
logoName: string;
|
|
20
|
-
};
|
|
15
|
+
userBranchesData: userBranchesDataType[];
|
|
21
16
|
selectBranchHandler: (item: userBranchesDataType) => void | userBranchesDataType;
|
|
22
17
|
sidebarData: SideBarItem[];
|
|
23
18
|
searchIconSRC: string;
|