hi-tm 0.5.1 → 0.5.2
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,4 +1,85 @@
|
|
|
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
|
+
*/
|
|
3
84
|
declare const HeaderLayout: React.FC<HeaderLayoutProps>;
|
|
4
85
|
export default HeaderLayout;
|
|
@@ -42,7 +42,88 @@ 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
|
-
|
|
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
|
+
const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, userLastName, logOutText, logOutHandler, modalData, modalItemOnClickHandler, iconsSRC, cdnURL, userBranchesData, selectBranchHandler, sidebarData, searchIconSRC, searchItemHandler, refreshPageHandler, brandNameText, languages, changeLanguageHandler, onLogoClickHandler, }) => {
|
|
46
127
|
const [isShowModalSearch, setIsShowModalSearch] = (0, react_1.useState)(false);
|
|
47
128
|
const [isOpenModal, setIsOpenModal] = (0, react_1.useState)(false);
|
|
48
129
|
const [isOpenModalBranches, setIsOpenModalBranches] = (0, react_1.useState)(false);
|
|
@@ -51,6 +132,7 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
51
132
|
id: 0,
|
|
52
133
|
name: "",
|
|
53
134
|
urlName: "",
|
|
135
|
+
imageName: "",
|
|
54
136
|
logoName: "",
|
|
55
137
|
});
|
|
56
138
|
const modalCloseRefPC = (0, react_1.useRef)(null);
|
|
@@ -63,7 +145,7 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
63
145
|
setIsOpenModal(!isOpenModal);
|
|
64
146
|
};
|
|
65
147
|
const handleModalShowBranches = () => {
|
|
66
|
-
if (userBranchesData && userBranchesData.length > 1) {
|
|
148
|
+
if (userBranchesData !== undefined && userBranchesData.length > 1) {
|
|
67
149
|
setIsOpenModalBranches(!isOpenModalBranches);
|
|
68
150
|
}
|
|
69
151
|
};
|
|
@@ -71,14 +153,16 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
71
153
|
setIsOpenLanguageModal(!isOpenLanguageModal);
|
|
72
154
|
};
|
|
73
155
|
(0, react_1.useEffect)(() => {
|
|
74
|
-
if (userBranchesData
|
|
156
|
+
if (userBranchesData !== undefined) {
|
|
75
157
|
setBranchNameSelected(userBranchesData[0]);
|
|
76
158
|
}
|
|
77
159
|
}, [userBranchesData]);
|
|
78
160
|
const selectItemBranchHandler = (branch) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
161
|
+
if (userBranchesData !== undefined && userBranchesData.length > 1) {
|
|
162
|
+
setBranchNameSelected(branch);
|
|
163
|
+
selectBranchHandler(branch);
|
|
164
|
+
setIsOpenModalBranches(false);
|
|
165
|
+
}
|
|
82
166
|
};
|
|
83
167
|
const selectLanguageHandler = (language) => {
|
|
84
168
|
changeLanguageHandler(language);
|
|
@@ -137,16 +221,18 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
137
221
|
appVersion,
|
|
138
222
|
")"),
|
|
139
223
|
react_1.default.createElement("p", { className: "text-nowrap" }, brandNameText)),
|
|
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:
|
|
224
|
+
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: () => {
|
|
225
|
+
onLogoClickHandler();
|
|
226
|
+
} }))),
|
|
141
227
|
react_1.default.createElement("div", { ref: modalCloseRefuserBranchesPC, className: `relative bg-inherit ${branchNameSelected?.id === 0 ? "hidden" : "flex"}` },
|
|
142
228
|
react_1.default.createElement("div", { onClick: handleModalShowBranches, className: "select-none-custom flex flex-row items-center justify-center gap-3" },
|
|
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
|
|
229
|
+
react_1.default.createElement(image_1.default, { src: `${baseUrlCDN}/${branchName}/${branchNameSelected.logoName}`, alt: "logo.svg", width: 24, height: 24, className: `rounded-md ${userBranchesData !== undefined && userBranchesData.length === 1
|
|
144
230
|
? "cursor-default"
|
|
145
231
|
: "cursor-pointer"}` }),
|
|
146
|
-
react_1.default.createElement("p", { className: `${userBranchesData && userBranchesData.length
|
|
232
|
+
react_1.default.createElement("p", { className: `${userBranchesData !== undefined && userBranchesData.length === 1
|
|
147
233
|
? "cursor-default"
|
|
148
234
|
: "cursor-pointer"}` }, branchNameSelected.name),
|
|
149
|
-
react_1.default.createElement(image_1.default, { src: iconsSRC.arrowSRC, alt: "arrow.svg", width: 16, height: 16, className: `customTransition ${userBranchesData && userBranchesData.length
|
|
235
|
+
react_1.default.createElement(image_1.default, { src: iconsSRC.arrowSRC, alt: "arrow.svg", width: 16, height: 16, className: `customTransition ${userBranchesData !== undefined && userBranchesData.length === 1
|
|
150
236
|
? "hidden"
|
|
151
237
|
: isOpenModalBranches
|
|
152
238
|
? "flex rotate-180 cursor-pointer"
|
|
@@ -154,13 +240,14 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
154
240
|
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
|
|
155
241
|
? "scale-y-100 opacity-100"
|
|
156
242
|
: "scale-y-0 opacity-0"} origin-top` },
|
|
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
|
|
158
|
-
react_1.default.createElement(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
243
|
+
react_1.default.createElement("ul", { className: "flex h-auto w-full flex-col items-start justify-center gap-3 bg-inherit p-3" }, userBranchesData &&
|
|
244
|
+
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" },
|
|
245
|
+
react_1.default.createElement(image_1.default, { src: branchNameSelected.logoName === " " ||
|
|
246
|
+
branchNameSelected.logoName === null ||
|
|
247
|
+
branchNameSelected.logoName === undefined
|
|
248
|
+
? "/defaultImage.jpg"
|
|
249
|
+
: `${baseUrlCDN}/${branchName}/${branchNameSelected.logoName}`, alt: "logo.svg", width: 16, height: 16, className: "rounded-xl" }),
|
|
250
|
+
react_1.default.createElement("p", { className: "select-none-custom cursor-pointer text-nowrap text-sm font-normal text-text-color-primary" }, item.name))))))),
|
|
164
251
|
react_1.default.createElement("div", { ref: modalCloseRefPC, className: "flex h-full flex-row-reverse items-center justify-center gap-4" },
|
|
165
252
|
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" },
|
|
166
253
|
react_1.default.createElement("div", { className: "flex flex-row items-center justify-center gap-1" },
|
|
@@ -171,12 +258,13 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
171
258
|
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"}` })),
|
|
172
259
|
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` },
|
|
173
260
|
react_1.default.createElement("ul", { className: "flex h-full w-full flex-col items-start justify-center gap-3 p-3" },
|
|
174
|
-
modalData
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
261
|
+
modalData &&
|
|
262
|
+
modalData.map((item) => (react_1.default.createElement("li", { onClick: () => {
|
|
263
|
+
handleModalShow();
|
|
264
|
+
modalItemOnClickHandler(item);
|
|
265
|
+
}, 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" },
|
|
266
|
+
react_1.default.createElement("p", null, item.title),
|
|
267
|
+
react_1.default.createElement(image_1.default, { src: item.iconSrc, alt: "user-square.svg", width: 16, height: 16 })))),
|
|
180
268
|
react_1.default.createElement("li", { onClick: () => {
|
|
181
269
|
logOutHandler();
|
|
182
270
|
handleModalShow();
|
|
@@ -184,7 +272,9 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
184
272
|
react_1.default.createElement("p", { className: "text-nowrap" }, logOutText),
|
|
185
273
|
react_1.default.createElement(image_1.default, { src: iconsSRC.logOutIconSRC, alt: "logOutIcon.svg", width: 16, height: 16 }))))),
|
|
186
274
|
react_1.default.createElement("div", { className: "flex flex-row items-center gap-2" },
|
|
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: () =>
|
|
275
|
+
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: () => {
|
|
276
|
+
setIsShowModalSearch(!isShowModalSearch);
|
|
277
|
+
} }),
|
|
188
278
|
react_1.default.createElement("button", { className: "customTransition hover:scale-105 cursor-pointer" },
|
|
189
279
|
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" })),
|
|
190
280
|
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" }),
|
|
@@ -194,7 +284,7 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
194
284
|
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
|
|
195
285
|
? "scale-y-100 opacity-100"
|
|
196
286
|
: "scale-y-0 opacity-0"} origin-top` },
|
|
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
|
|
287
|
+
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" },
|
|
198
288
|
react_1.default.createElement(image_1.default, { src: language.flagIcon, alt: `${language.showName}-flag`, width: 16, height: 16, className: "rounded-sm" }),
|
|
199
289
|
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)))))))))),
|
|
200
290
|
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" },
|
|
@@ -202,28 +292,27 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
202
292
|
react_1.default.createElement(image_1.default, { src: iconsSRC.menuIconSRC, alt: "menu.svg", width: 20, height: 20, className: "h-full w-full" })),
|
|
203
293
|
react_1.default.createElement("div", { ref: modalCloseRefuserBranchesMobile, className: `relative bg-inherit ${branchNameSelected?.id === 0 ? "hidden" : "flex"}` },
|
|
204
294
|
react_1.default.createElement("div", { onClick: handleModalShowBranches, className: "select-none-custom flex flex-row items-center justify-center gap-3" },
|
|
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
|
|
295
|
+
react_1.default.createElement(image_1.default, { src: `${baseUrlCDN}/${branchName}/${branchNameSelected.logoName}`, alt: "logo.svg", width: 24, height: 24, className: `rounded-md ${userBranchesData !== undefined && userBranchesData.length === 1
|
|
206
296
|
? "cursor-default"
|
|
207
297
|
: "cursor-pointer"}` }),
|
|
208
|
-
react_1.default.createElement("p", { className: `${userBranchesData && userBranchesData.length
|
|
298
|
+
react_1.default.createElement("p", { className: `${userBranchesData !== undefined && userBranchesData.length === 1
|
|
209
299
|
? "cursor-default"
|
|
210
300
|
: "cursor-pointer"}` }, branchNameSelected.name),
|
|
211
|
-
react_1.default.createElement(image_1.default, { src: iconsSRC.arrowSRC, alt: "arrow.svg", width: 16, height: 16, className: `${userBranchesData && userBranchesData.length
|
|
301
|
+
react_1.default.createElement(image_1.default, { src: iconsSRC.arrowSRC, alt: "arrow.svg", width: 16, height: 16, className: `${userBranchesData !== undefined && userBranchesData.length === 1
|
|
212
302
|
? "hidden"
|
|
213
303
|
: "flex cursor-pointer"}` })),
|
|
214
304
|
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
|
|
215
305
|
? "scale-y-100 opacity-100"
|
|
216
306
|
: "scale-y-0 opacity-0"} origin-top` },
|
|
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
|
|
218
|
-
react_1.default.createElement(
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
? defaultLogoImage
|
|
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))))))),
|
|
307
|
+
react_1.default.createElement("ul", { className: "flex h-auto w-full flex-col items-start justify-center gap-3 bg-inherit p-3" }, userBranchesData &&
|
|
308
|
+
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" },
|
|
309
|
+
react_1.default.createElement(image_1.default, { src: `${baseUrlCDN}/${branchName}/${item.logoName}`, alt: "logo.svg", width: 16, height: 16, className: "rounded-xl" }),
|
|
310
|
+
react_1.default.createElement("p", { className: "select-none-custom cursor-pointer text-nowrap text-sm font-normal text-text-color-primary" }, item.name))))))),
|
|
224
311
|
react_1.default.createElement("div", { ref: modalCloseRefMobile, className: "flex flex-row items-center justify-center gap-2" },
|
|
225
312
|
react_1.default.createElement("div", { className: "flex flex-row items-center justify-center gap-2" },
|
|
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: () =>
|
|
313
|
+
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: () => {
|
|
314
|
+
setIsShowModalSearch(!isShowModalSearch);
|
|
315
|
+
} }),
|
|
227
316
|
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" })),
|
|
228
317
|
react_1.default.createElement("div", { ref: modalCloseRefLanguageMobile, className: "relative" },
|
|
229
318
|
react_1.default.createElement("div", { className: "customTransition mr-2 cursor-pointer hover:scale-125", onClick: handleLanguageModalShow },
|
|
@@ -231,20 +320,21 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
|
|
|
231
320
|
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
|
|
232
321
|
? "scale-y-100 opacity-100"
|
|
233
322
|
: "scale-y-0 opacity-0"} origin-top` },
|
|
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
|
|
323
|
+
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" },
|
|
235
324
|
react_1.default.createElement(image_1.default, { src: language.flagIcon, alt: `${language.showName}-flag`, width: 16, height: 16, className: "rounded-sm" }),
|
|
236
325
|
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))))))),
|
|
237
326
|
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" },
|
|
238
327
|
react_1.default.createElement(image_1.default, { src: iconsSRC.iconProfileUserSRC, alt: "profile.svg", width: 18, height: 18 })),
|
|
239
328
|
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` },
|
|
240
329
|
react_1.default.createElement("ul", { className: "flex h-full w-full flex-col items-start justify-center gap-3 p-3" },
|
|
241
|
-
modalData
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
react_1.default.createElement("
|
|
247
|
-
|
|
330
|
+
modalData.length > 0 &&
|
|
331
|
+
modalData.map((item) => (react_1.default.createElement("li", { onClick: () => {
|
|
332
|
+
handleModalShow();
|
|
333
|
+
modalItemOnClickHandler(item);
|
|
334
|
+
}, key: item?.id, className: "w-full cursor-pointer text-xs" },
|
|
335
|
+
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" },
|
|
336
|
+
react_1.default.createElement("p", { className: "text-xs text-nowrap" }, item.title),
|
|
337
|
+
react_1.default.createElement(image_1.default, { src: item.iconSrc, alt: "user-square.svg", width: 16, height: 16 }))))),
|
|
248
338
|
react_1.default.createElement("li", { onClick: () => {
|
|
249
339
|
logOutHandler();
|
|
250
340
|
handleModalShow();
|
|
@@ -22,7 +22,6 @@ export interface HeaderLayoutProps {
|
|
|
22
22
|
languages: LanguageDataType[];
|
|
23
23
|
changeLanguageHandler: (language: LanguageDataType) => void;
|
|
24
24
|
onLogoClickHandler: () => void;
|
|
25
|
-
defaultLogoImage: string;
|
|
26
25
|
}
|
|
27
26
|
export interface iconsSRC {
|
|
28
27
|
logoSRC: string;
|
|
@@ -46,6 +45,7 @@ export interface userBranchesDataType {
|
|
|
46
45
|
id: number;
|
|
47
46
|
name: string;
|
|
48
47
|
urlName: string;
|
|
48
|
+
imageName: string;
|
|
49
49
|
logoName: string;
|
|
50
50
|
}
|
|
51
51
|
interface SelectBranchHeaderModalDataItem {
|