@banch0u/core-project-test-repository 1.8.3 → 1.9.0

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.
Files changed (69) hide show
  1. package/dist/assets/css/antd.css +836 -0
  2. package/dist/assets/css/variables.css +6 -0
  3. package/dist/assets/icons/index.js +424 -1
  4. package/dist/components/Button/index.module.scss +14 -2
  5. package/dist/components/Delete/Delete.js +22 -0
  6. package/dist/components/Delete/Delete.module.scss +22 -0
  7. package/dist/components/DeleteModal/DeleteModal.js +31 -0
  8. package/dist/components/DeleteModal/DeleteModal.module.scss +11 -0
  9. package/dist/components/Filter/index.js +1 -1
  10. package/dist/components/Input/index.js +1 -2
  11. package/dist/components/Input/index.module.scss +21 -12
  12. package/dist/components/ProfileOptions/index.js +109 -66
  13. package/dist/components/ProfileOptions/index.module.scss +144 -12
  14. package/dist/components/Success/Success.js +19 -0
  15. package/dist/components/Success/Success.module.scss +26 -0
  16. package/dist/components/Table/index.js +4 -2
  17. package/dist/components/ViewModal/index.js +30 -0
  18. package/dist/helpers/paginationLength.js +3 -0
  19. package/dist/helpers/querySearch.js +22 -0
  20. package/dist/index.js +6 -0
  21. package/dist/layout/Header/AppSelect/index.js +107 -0
  22. package/dist/layout/Header/AppSelect/index.module.scss +68 -0
  23. package/dist/layout/Header/index.js +6 -84
  24. package/dist/layout/Header/index.module.scss +8 -12
  25. package/dist/layout/Portal/index.js +23 -0
  26. package/dist/layout/QuestionnairesLayout/index.js +17 -0
  27. package/dist/layout/QuestionnairesLayout/index.module.scss +0 -0
  28. package/dist/layout/QuestionnairesSidebar/index.js +126 -0
  29. package/dist/layout/QuestionnairesSidebar/index.module.scss +76 -0
  30. package/dist/layout/Sidebar/index.js +147 -0
  31. package/dist/layout/Sidebar/index.module.scss +50 -0
  32. package/dist/pages/Platform/constant.js +29 -2
  33. package/dist/pages/Platform/index.js +19 -30
  34. package/dist/pages/Platform/index.module.scss +20 -5
  35. package/dist/pages/Questionnnaires/Questionnaires.module.scss +194 -0
  36. package/dist/pages/Questionnnaires/QuestionnairesApplicationFormContent/constant.js +58 -0
  37. package/dist/pages/Questionnnaires/QuestionnairesApplicationFormContent/index.js +255 -0
  38. package/dist/pages/Questionnnaires/QuestionnairesCountriesContent/constant.js +58 -0
  39. package/dist/pages/Questionnnaires/QuestionnairesCountriesContent/index.js +247 -0
  40. package/dist/pages/Questionnnaires/QuestionnairesDeliveryMethodContent/constant.js +58 -0
  41. package/dist/pages/Questionnnaires/QuestionnairesDeliveryMethodContent/index.js +247 -0
  42. package/dist/pages/Questionnnaires/QuestionnairesDocumentRecieveMethodsContent/constant.js +58 -0
  43. package/dist/pages/Questionnnaires/QuestionnairesDocumentRecieveMethodsContent/index.js +258 -0
  44. package/dist/pages/Questionnnaires/QuestionnairesDocumentTypeContent/constant.js +58 -0
  45. package/dist/pages/Questionnnaires/QuestionnairesDocumentTypeContent/index.js +284 -0
  46. package/dist/pages/Questionnnaires/QuestionnairesDocumentWhomContent/constant.js +82 -0
  47. package/dist/pages/Questionnnaires/QuestionnairesDocumentWhomContent/index.js +331 -0
  48. package/dist/pages/Questionnnaires/QuestionnairesExecutionRulesContent/constant.js +58 -0
  49. package/dist/pages/Questionnnaires/QuestionnairesExecutionRulesContent/index.js +258 -0
  50. package/dist/pages/Questionnnaires/QuestionnairesMarginNoteTextsContent/constant.js +58 -0
  51. package/dist/pages/Questionnnaires/QuestionnairesMarginNoteTextsContent/index.js +249 -0
  52. package/dist/pages/Questionnnaires/QuestionnairesOrganizationsContent/constant.js +88 -0
  53. package/dist/pages/Questionnnaires/QuestionnairesOrganizationsContent/index.js +320 -0
  54. package/dist/pages/Questionnnaires/QuestionnairesStreetsContent/constant.js +58 -0
  55. package/dist/pages/Questionnnaires/QuestionnairesStreetsContent/index.js +240 -0
  56. package/dist/pages/Questionnnaires/QuestionnairesStructuresContent/constant.js +58 -0
  57. package/dist/pages/Questionnnaires/QuestionnairesStructuresContent/index.js +247 -0
  58. package/dist/pages/Questionnnaires/QuestionnairesSubtopicContent/constant.js +58 -0
  59. package/dist/pages/Questionnnaires/QuestionnairesSubtopicContent/index.js +317 -0
  60. package/dist/pages/Questionnnaires/QuestionnairesTopicContent/constant.js +58 -0
  61. package/dist/pages/Questionnnaires/QuestionnairesTopicContent/index.js +271 -0
  62. package/dist/pages/Questionnnaires/index.js +5 -0
  63. package/dist/routes/QuestionnaireRoutes.js +108 -0
  64. package/dist/store/slices/global/index.js +96 -3
  65. package/dist/store/slices/questionnaire/index.js +2500 -0
  66. package/dist/store/slices/questionnaire/service.js +1557 -0
  67. package/dist/store/store.js +2 -1
  68. package/dist/utils/path.js +30 -1
  69. package/package.json +2 -2
@@ -0,0 +1,68 @@
1
+ .accordion {
2
+ background: var(--blue);
3
+ width: 270px;
4
+ }
5
+
6
+ .accordionHeader {
7
+ display: flex;
8
+ align-items: center;
9
+ gap: 10px;
10
+ span {
11
+ font-size: 18px;
12
+ font-weight: 500;
13
+ color: var(--white);
14
+ height: auto;
15
+ }
16
+ div {
17
+ height: 30px;
18
+ filter: brightness(0) invert(1) !important;
19
+ }
20
+ svg {
21
+ width: 30px !important;
22
+ height: 30px !important;
23
+ }
24
+ }
25
+
26
+ .accordionBody {
27
+ display: flex;
28
+ flex-direction: column;
29
+ gap: 8px;
30
+ background-color: var(--blue);
31
+ padding: 10px;
32
+ top: 81px !important;
33
+ width: 250px !important;
34
+ border-radius: 0 0 6px 6px;
35
+ }
36
+
37
+ .accordionOption {
38
+ background-color: var(--white);
39
+ color: var(--blue);
40
+ display: flex;
41
+ align-items: center;
42
+ padding: 10px;
43
+ border-radius: 6px;
44
+ gap: 10px;
45
+ font-size: 16px;
46
+ font-weight: 500;
47
+ font-size: 16px;
48
+ line-height: 100%;
49
+ letter-spacing: 0%;
50
+
51
+ cursor: pointer;
52
+ text-decoration: none;
53
+ transition: background 0.2s ease;
54
+
55
+ svg {
56
+ width: 26px;
57
+ height: 26px;
58
+ }
59
+
60
+ &:hover {
61
+ background-color: var(--lightBlue);
62
+ }
63
+ &:hover {
64
+ span {
65
+ color: var(--blue);
66
+ }
67
+ }
68
+ }
@@ -1,104 +1,26 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- import React, { useEffect, useState, useCallback } from "react";
2
+ import React, { useEffect, useState } from "react";
5
3
  import style from "./index.module.scss";
6
- import { DsgLogo } from "../../assets/icons";
7
4
  import ProfileOptions from "../../components/ProfileOptions";
8
- import { Link } from "react-router-dom";
9
- import { PLATFORM_PATH } from "../../utils/path";
10
- import { useDispatch, useSelector } from "react-redux";
11
- import { getCompanyInfo } from "../../store/slices/companyInfo";
12
- import api from "../../utils/axios";
5
+ import AppSelect from "./AppSelect";
13
6
  var Header = function Header() {
14
7
  var _useState = useState(localStorage.getItem("theme") || "light"),
15
8
  _useState2 = _slicedToArray(_useState, 2),
16
9
  theme = _useState2[0],
17
10
  setTheme = _useState2[1];
18
- var _useState3 = useState(null),
19
- _useState4 = _slicedToArray(_useState3, 2),
20
- imageSrc = _useState4[0],
21
- setImageSrc = _useState4[1];
22
- var dispatch = useDispatch();
23
- var companyInfo = useSelector(function (state) {
24
- return state.companyInfo.companyInfo;
25
- });
26
11
  var updateTheme = function updateTheme() {
27
12
  var newTheme = localStorage.getItem("theme") || "light";
28
13
  setTheme(newTheme);
29
14
  };
30
- var getBase64FromURL = useCallback(/*#__PURE__*/function () {
31
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(url) {
32
- var res;
33
- return _regeneratorRuntime.wrap(function _callee$(_context) {
34
- while (1) switch (_context.prev = _context.next) {
35
- case 0:
36
- _context.prev = 0;
37
- _context.next = 3;
38
- return api.get(url);
39
- case 3:
40
- res = _context.sent;
41
- return _context.abrupt("return", res === null || res === void 0 ? void 0 : res.data);
42
- case 7:
43
- _context.prev = 7;
44
- _context.t0 = _context["catch"](0);
45
- console.error("Error loading logo:", _context.t0);
46
- return _context.abrupt("return", null);
47
- case 11:
48
- case "end":
49
- return _context.stop();
50
- }
51
- }, _callee, null, [[0, 7]]);
52
- }));
53
- return function (_x) {
54
- return _ref.apply(this, arguments);
55
- };
56
- }(), []);
57
15
  useEffect(function () {
58
- dispatch(getCompanyInfo());
59
16
  window.addEventListener("themeChange", updateTheme);
60
17
  return function () {
61
18
  return window.removeEventListener("themeChange", updateTheme);
62
19
  };
63
- }, [dispatch]);
64
- useEffect(function () {
65
- var fetchImage = /*#__PURE__*/function () {
66
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
67
- var _companyInfo$;
68
- var base64;
69
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
70
- while (1) switch (_context2.prev = _context2.next) {
71
- case 0:
72
- if (!(companyInfo !== null && companyInfo !== void 0 && (_companyInfo$ = companyInfo[0]) !== null && _companyInfo$ !== void 0 && _companyInfo$.filePath)) {
73
- _context2.next = 5;
74
- break;
75
- }
76
- _context2.next = 3;
77
- return getBase64FromURL(companyInfo[0].filePath);
78
- case 3:
79
- base64 = _context2.sent;
80
- setImageSrc(base64);
81
- case 5:
82
- case "end":
83
- return _context2.stop();
84
- }
85
- }, _callee2);
86
- }));
87
- return function fetchImage() {
88
- return _ref2.apply(this, arguments);
89
- };
90
- }();
91
- fetchImage();
92
- }, [companyInfo, getBase64FromURL]);
20
+ }, []);
93
21
  return /*#__PURE__*/React.createElement("header", {
94
- className: style.header
95
- }, /*#__PURE__*/React.createElement(Link, {
96
- to: PLATFORM_PATH
97
- }, imageSrc ? /*#__PURE__*/React.createElement("img", {
98
- src: imageSrc,
99
- alt: "Company Logo"
100
- }) : theme === "dark" ? /*#__PURE__*/React.createElement(DsgLogo, {
101
- dark: true
102
- }) : /*#__PURE__*/React.createElement(DsgLogo, null)), /*#__PURE__*/React.createElement(ProfileOptions, null));
22
+ className: style.header,
23
+ "data-no-invert": true
24
+ }, /*#__PURE__*/React.createElement(AppSelect, null), /*#__PURE__*/React.createElement(ProfileOptions, null));
103
25
  };
104
26
  export default Header;
@@ -1,19 +1,15 @@
1
1
  .header {
2
- height: 84px;
3
- background: #fff;
2
+ height: 81px;
3
+ background: var(--blue);
4
4
  align-items: center;
5
5
  display: flex;
6
6
  align-items: center;
7
7
  justify-content: space-between;
8
- padding: 0 20px;
9
- border-bottom: 1px solid #c4c4c4;
8
+ padding: 0 17px;
10
9
  z-index: 1;
11
- svg {
12
- width: 123px;
13
- height: auto;
14
- }
15
- img {
16
- width: 95px;
17
- height: auto;
18
- }
10
+ position: relative;
11
+ overflow: visible; // ✅ allows dropdowns to escape
12
+ // z-index: 10;
13
+ }
14
+ .header {
19
15
  }
@@ -0,0 +1,23 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ // src/components/Portal.js
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { createPortal } from "react-dom";
5
+ var Portal = function Portal(_ref) {
6
+ var children = _ref.children;
7
+ var elRef = useRef(null);
8
+ var _useState = useState(false),
9
+ _useState2 = _slicedToArray(_useState, 2),
10
+ mounted = _useState2[0],
11
+ setMounted = _useState2[1];
12
+ useEffect(function () {
13
+ var el = document.createElement("div");
14
+ elRef.current = el;
15
+ document.body.appendChild(el);
16
+ setMounted(true);
17
+ return function () {
18
+ document.body.removeChild(el);
19
+ };
20
+ }, []);
21
+ return mounted ? /*#__PURE__*/createPortal(children, elRef.current) : null;
22
+ };
23
+ export default Portal;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { Layout } from "antd";
3
+ import { Outlet } from "react-router-dom";
4
+ import QuestionnairesSidebar from "../QuestionnairesSidebar";
5
+ import style from "./index.module.scss";
6
+ var Content = Layout.Content;
7
+ var QuestionnairesLayout = function QuestionnairesLayout(_ref) {
8
+ var allowed = _ref.allowed;
9
+ return /*#__PURE__*/React.createElement(Layout, {
10
+ className: style.layout
11
+ }, /*#__PURE__*/React.createElement(QuestionnairesSidebar, {
12
+ allowed: allowed
13
+ }), /*#__PURE__*/React.createElement(Content, {
14
+ className: style.content
15
+ }, /*#__PURE__*/React.createElement(Outlet, null)));
16
+ };
17
+ export default QuestionnairesLayout;
@@ -0,0 +1,126 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import React, { useState } from "react";
3
+ import { Link, useLocation } from "react-router-dom";
4
+ import style from "./index.module.scss";
5
+ import { Layout, Menu, Input } from "antd";
6
+ import { DOCUMENT_CIRCULATION_QUESTIONNAIRES_APPLICATION_FORMS, DOCUMENT_CIRCULATION_QUESTIONNAIRES_COUNTRIES, DOCUMENT_CIRCULATION_QUESTIONNAIRES_DOCUMENT_RECIEVE_METHODS, DOCUMENT_CIRCULATION_QUESTIONNAIRES_DOCUMENT_TYPES, DOCUMENT_CIRCULATION_QUESTIONNAIRES_DOCUMENT_WHOM, DOCUMENT_CIRCULATION_QUESTIONNAIRES_EXECUTION_RULES, DOCUMENT_CIRCULATION_QUESTIONNAIRES_MARGIN_NOTE_TEXTS, DOCUMENT_CIRCULATION_QUESTIONNAIRES_ORGANIZATIONS, DOCUMENT_CIRCULATION_QUESTIONNAIRES_STREETS, DOCUMENT_CIRCULATION_QUESTIONNAIRES_STRUCTURES, DOCUMENT_CIRCULATION_QUESTIONNAIRES_SUBTOPIC, DOCUMENT_CIRCULATION_QUESTIONNAIRES_TOPIC, SETTINGS_QUESTIONNAIRES_APPLICATION_FORMS, SETTINGS_QUESTIONNAIRES_COUNTRIES, SETTINGS_QUESTIONNAIRES_DOCUMENT_RECIEVE_METHODS, SETTINGS_QUESTIONNAIRES_DOCUMENT_TYPES, SETTINGS_QUESTIONNAIRES_DOCUMENT_WHOM, SETTINGS_QUESTIONNAIRES_EXECUTION_RULES, SETTINGS_QUESTIONNAIRES_MARGIN_NOTE_TEXTS, SETTINGS_QUESTIONNAIRES_ORGANIZATIONS, SETTINGS_QUESTIONNAIRES_STREETS, SETTINGS_QUESTIONNAIRES_STRUCTURES, SETTINGS_QUESTIONNAIRES_SUBTOPIC, SETTINGS_QUESTIONNAIRES_TOPIC } from "../../utils/path";
7
+ import { SearchIcon } from "../../assets/icons";
8
+ var Sider = Layout.Sider;
9
+ var SubMenu = Menu.SubMenu;
10
+ var QuestionnairesSidebar = function QuestionnairesSidebar(_ref) {
11
+ var selectedKey = _ref.selectedKey,
12
+ _ref$allowed = _ref.allowed,
13
+ allowed = _ref$allowed === void 0 ? [] : _ref$allowed;
14
+ var _useState = useState(""),
15
+ _useState2 = _slicedToArray(_useState, 2),
16
+ searchQuery = _useState2[0],
17
+ setSearchQuery = _useState2[1];
18
+ var location = useLocation();
19
+ var mainPath = "/".concat(location.pathname.split("/")[1]);
20
+ var items = [{
21
+ key: "topic",
22
+ label: "Mövzular",
23
+ link: mainPath === "/settings" ? SETTINGS_QUESTIONNAIRES_TOPIC : DOCUMENT_CIRCULATION_QUESTIONNAIRES_TOPIC
24
+ }, {
25
+ key: "subtopic",
26
+ label: "Alt mövzular",
27
+ link: mainPath === "/settings" ? SETTINGS_QUESTIONNAIRES_SUBTOPIC : DOCUMENT_CIRCULATION_QUESTIONNAIRES_SUBTOPIC
28
+ }, {
29
+ key: "executionRules",
30
+ label: "İcra qaydaları",
31
+ link: mainPath === "/settings" ? SETTINGS_QUESTIONNAIRES_EXECUTION_RULES : DOCUMENT_CIRCULATION_QUESTIONNAIRES_EXECUTION_RULES
32
+ }, {
33
+ key: "document-recieve-methods",
34
+ label: "Daxil olma yolları",
35
+ link: mainPath === "/settings" ? SETTINGS_QUESTIONNAIRES_DOCUMENT_RECIEVE_METHODS : DOCUMENT_CIRCULATION_QUESTIONNAIRES_DOCUMENT_RECIEVE_METHODS
36
+ }, {
37
+ key: "documentType",
38
+ label: "Sənəd Növləri",
39
+ link: mainPath === "/settings" ? SETTINGS_QUESTIONNAIRES_DOCUMENT_TYPES : DOCUMENT_CIRCULATION_QUESTIONNAIRES_DOCUMENT_TYPES
40
+ }, {
41
+ key: "country",
42
+ label: "Ölkələr",
43
+ link: mainPath === "/settings" ? SETTINGS_QUESTIONNAIRES_COUNTRIES : DOCUMENT_CIRCULATION_QUESTIONNAIRES_COUNTRIES
44
+ }, {
45
+ key: "street",
46
+ label: "Küçələr",
47
+ link: mainPath === "/settings" ? SETTINGS_QUESTIONNAIRES_STREETS : DOCUMENT_CIRCULATION_QUESTIONNAIRES_STREETS
48
+ }, {
49
+ key: "organization",
50
+ label: "Təşkilatlar",
51
+ link: mainPath === "/settings" ? SETTINGS_QUESTIONNAIRES_ORGANIZATIONS : DOCUMENT_CIRCULATION_QUESTIONNAIRES_ORGANIZATIONS
52
+ }, {
53
+ key: "structure",
54
+ label: "Strukturlar",
55
+ link: mainPath === "/settings" ? SETTINGS_QUESTIONNAIRES_STRUCTURES : DOCUMENT_CIRCULATION_QUESTIONNAIRES_STRUCTURES
56
+ }, {
57
+ key: "application_form",
58
+ label: "Müraciət formaları",
59
+ link: mainPath === "/settings" ? SETTINGS_QUESTIONNAIRES_APPLICATION_FORMS : DOCUMENT_CIRCULATION_QUESTIONNAIRES_APPLICATION_FORMS
60
+ }, {
61
+ key: "document_whom",
62
+ label: "Şəxslər",
63
+ link: mainPath === "/settings" ? SETTINGS_QUESTIONNAIRES_DOCUMENT_WHOM : DOCUMENT_CIRCULATION_QUESTIONNAIRES_DOCUMENT_WHOM
64
+ }, {
65
+ key: "margin_note_texts",
66
+ label: "Dərkənar mətni",
67
+ link: mainPath === "/settings" ? SETTINGS_QUESTIONNAIRES_MARGIN_NOTE_TEXTS : DOCUMENT_CIRCULATION_QUESTIONNAIRES_MARGIN_NOTE_TEXTS
68
+ }, {
69
+ key: "brands",
70
+ label: "Brendlər",
71
+ link: mainPath === "/settings" ? SETTINGS_QUESTIONNAIRES_MARGIN_NOTE_TEXTS : DOCUMENT_CIRCULATION_QUESTIONNAIRES_MARGIN_NOTE_TEXTS
72
+ }];
73
+ var sortedItems = items.sort(function (a, b) {
74
+ return a.label.localeCompare(b.label);
75
+ });
76
+ var filteredItems = sortedItems.filter(function (item) {
77
+ return item.label.toLowerCase().includes(searchQuery.toLowerCase()) && allowed[item.key];
78
+ } // ✅ Check if allowed true
79
+ );
80
+ var defaultOpenKeys = items.filter(function (item) {
81
+ return item.children && item.children.some(function (child) {
82
+ return child.key === selectedKey;
83
+ });
84
+ }).map(function (item) {
85
+ return item.key;
86
+ });
87
+ var renderMenuItems = function renderMenuItems(items) {
88
+ return items.map(function (item) {
89
+ return /*#__PURE__*/React.createElement(Menu.Item, {
90
+ key: item.key,
91
+ icon: item.icon
92
+ }, /*#__PURE__*/React.createElement(Link, {
93
+ to: item.link
94
+ }, item.label));
95
+ });
96
+ };
97
+ return /*#__PURE__*/React.createElement(Sider, {
98
+ width: 256,
99
+ className: style.sidebar
100
+ }, /*#__PURE__*/React.createElement("div", {
101
+ className: style.logo
102
+ }, /*#__PURE__*/React.createElement("h2", null, "Soraq\xE7alar")), /*#__PURE__*/React.createElement("div", {
103
+ className: style.search
104
+ }, /*#__PURE__*/React.createElement(Input, {
105
+ onChange: function onChange(e) {
106
+ var _e$target;
107
+ return setSearchQuery(e === null || e === void 0 || (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value);
108
+ },
109
+ placeholder: "Axtar",
110
+ className: style.search_input,
111
+ suffix: /*#__PURE__*/React.createElement("div", {
112
+ className: style.search_icon
113
+ }, /*#__PURE__*/React.createElement(SearchIcon, null))
114
+ })), /*#__PURE__*/React.createElement("div", {
115
+ className: "questionnaires_menu",
116
+ style: {
117
+ overflowY: "auto",
118
+ maxHeight: "calc(100vh - 325px)"
119
+ }
120
+ }, /*#__PURE__*/React.createElement(Menu, {
121
+ defaultSelectedKeys: [selectedKey],
122
+ defaultOpenKeys: defaultOpenKeys,
123
+ className: style.menu
124
+ }, renderMenuItems(filteredItems))));
125
+ };
126
+ export default QuestionnairesSidebar;
@@ -0,0 +1,76 @@
1
+ .sidebar {
2
+ background: #fff !important;
3
+ border-radius: 12px;
4
+ border: none;
5
+ position: relative;
6
+ margin: 20px;
7
+ margin-right: 0;
8
+ .logo {
9
+ margin-top: 20px;
10
+ margin-bottom: 18px;
11
+ text-align: center;
12
+ h2 {
13
+ font-family: Inter;
14
+ font-size: 24px;
15
+ font-weight: 600;
16
+ line-height: 20px;
17
+ text-align: center;
18
+ color: var(--darkBlueColor);
19
+ }
20
+ }
21
+ .search {
22
+ padding: 0 14px;
23
+ margin-bottom: 6px;
24
+ .search_input {
25
+ width: 100%;
26
+ margin: 0 auto;
27
+ display: flex;
28
+ justify-content: center;
29
+ height: 36px;
30
+ font-size: 16px !important;
31
+ font-weight: 500 !important;
32
+ line-height: 24px !important;
33
+ text-align: left !important;
34
+ border-radius: 6px;
35
+ padding: 6px 10px !important;
36
+ .search_icon {
37
+ display: flex;
38
+ align-items: center;
39
+ cursor: pointer;
40
+ svg {
41
+ path {
42
+ transition: 250ms;
43
+ }
44
+ }
45
+ svg:hover {
46
+ path {
47
+ stroke: var(--darkBlueColor);
48
+ transition: 250ms;
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ .menu {
55
+ background: #fff;
56
+ border: none;
57
+ border-right: 0;
58
+ border-radius: 12px 12px 0 0;
59
+ margin-top: 0px;
60
+ li {
61
+ margin-inline: 14px;
62
+ width: 90%;
63
+ border-radius: 4px;
64
+ color: #828282;
65
+ // background: #f2f2f2;
66
+ font-family: Inter;
67
+ font-size: 18px;
68
+ font-weight: 500;
69
+ text-align: left;
70
+ height: 42px;
71
+ span {
72
+ margin-left: 8px;
73
+ }
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,147 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ import React, { useEffect, useState, useCallback } from "react";
5
+ import { Link, useLocation } from "react-router-dom";
6
+ import Cookies from "js-cookie";
7
+ import style from "./index.module.scss";
8
+ import { Layout, Menu } from "antd";
9
+ import { DsgLogo, DsgLogoEmblem } from "../../assets/icons";
10
+ import { PLATFORM_PATH } from "../../utils/path";
11
+ import { useDispatch, useSelector } from "react-redux";
12
+ import { getCompanyInfo } from "../../store/slices/companyInfo";
13
+ import api from "../../utils/axios";
14
+ var Sider = Layout.Sider;
15
+ var Sidebar = function Sidebar(_ref) {
16
+ var _items$flatMap$find;
17
+ var _ref$items = _ref.items,
18
+ items = _ref$items === void 0 ? [] : _ref$items;
19
+ var location = useLocation();
20
+ var dispatch = useDispatch();
21
+ var companyInfo = useSelector(function (state) {
22
+ return state.companyInfo.companyInfo;
23
+ });
24
+ var _useState = useState(false),
25
+ _useState2 = _slicedToArray(_useState, 2),
26
+ collapsed = _useState2[0],
27
+ setCollapsed = _useState2[1];
28
+ var _useState3 = useState(null),
29
+ _useState4 = _slicedToArray(_useState3, 2),
30
+ imageSrc = _useState4[0],
31
+ setImageSrc = _useState4[1];
32
+ var _useState5 = useState(localStorage.getItem("theme") === "dark"),
33
+ _useState6 = _slicedToArray(_useState5, 2),
34
+ isDark = _useState6[0],
35
+ setIsDark = _useState6[1];
36
+ var handleCollapse = function handleCollapse() {
37
+ var newState = !collapsed;
38
+ setCollapsed(newState);
39
+ Cookies.set("sidebarCollapsed", newState, {
40
+ expires: 7
41
+ });
42
+ };
43
+ var getBase64FromURL = useCallback(/*#__PURE__*/function () {
44
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(url) {
45
+ var res;
46
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
47
+ while (1) switch (_context.prev = _context.next) {
48
+ case 0:
49
+ _context.prev = 0;
50
+ _context.next = 3;
51
+ return api.get(url);
52
+ case 3:
53
+ res = _context.sent;
54
+ return _context.abrupt("return", res === null || res === void 0 ? void 0 : res.data);
55
+ case 7:
56
+ _context.prev = 7;
57
+ _context.t0 = _context["catch"](0);
58
+ console.error("Error loading logo:", _context.t0);
59
+ return _context.abrupt("return", null);
60
+ case 11:
61
+ case "end":
62
+ return _context.stop();
63
+ }
64
+ }, _callee, null, [[0, 7]]);
65
+ }));
66
+ return function (_x) {
67
+ return _ref2.apply(this, arguments);
68
+ };
69
+ }(), []);
70
+ useEffect(function () {
71
+ var sidebarState = Cookies.get("sidebarCollapsed") === "true";
72
+ setCollapsed(sidebarState);
73
+ dispatch(getCompanyInfo());
74
+ }, [dispatch]);
75
+ console.log(companyInfo);
76
+ useEffect(function () {
77
+ var fetchLogo = /*#__PURE__*/function () {
78
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
79
+ var _companyInfo$;
80
+ var base64;
81
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
82
+ while (1) switch (_context2.prev = _context2.next) {
83
+ case 0:
84
+ if (!(companyInfo !== null && companyInfo !== void 0 && (_companyInfo$ = companyInfo[0]) !== null && _companyInfo$ !== void 0 && _companyInfo$.filePath)) {
85
+ _context2.next = 5;
86
+ break;
87
+ }
88
+ _context2.next = 3;
89
+ return getBase64FromURL(companyInfo[0].filePath);
90
+ case 3:
91
+ base64 = _context2.sent;
92
+ setImageSrc(base64);
93
+ case 5:
94
+ case "end":
95
+ return _context2.stop();
96
+ }
97
+ }, _callee2);
98
+ }));
99
+ return function fetchLogo() {
100
+ return _ref3.apply(this, arguments);
101
+ };
102
+ }();
103
+ fetchLogo();
104
+ }, [companyInfo, getBase64FromURL]);
105
+ useEffect(function () {
106
+ var handleThemeChange = function handleThemeChange() {
107
+ setIsDark(localStorage.getItem("theme") === "dark");
108
+ };
109
+ window.addEventListener("themeChange", handleThemeChange);
110
+ return function () {
111
+ window.removeEventListener("themeChange", handleThemeChange);
112
+ };
113
+ }, []);
114
+ var selectedKey = (_items$flatMap$find = items.flatMap(function (item) {
115
+ return item.children ? item.children : item;
116
+ }).find(function (item) {
117
+ return location.pathname.includes(item.key);
118
+ })) === null || _items$flatMap$find === void 0 ? void 0 : _items$flatMap$find.key;
119
+ return /*#__PURE__*/React.createElement(Sider, {
120
+ width: 270,
121
+ collapsible: true,
122
+ collapsed: collapsed,
123
+ collapsedWidth: 64,
124
+ trigger: null,
125
+ className: style.sidebar
126
+ }, /*#__PURE__*/React.createElement("div", {
127
+ className: "sideBar"
128
+ }, /*#__PURE__*/React.createElement(Menu, {
129
+ mode: "inline",
130
+ items: items,
131
+ selectedKeys: [selectedKey],
132
+ className: style.menu
133
+ })), /*#__PURE__*/React.createElement(Link, {
134
+ to: PLATFORM_PATH,
135
+ className: style.buttons
136
+ }, collapsed ? /*#__PURE__*/React.createElement(DsgLogoEmblem, null) : imageSrc ? /*#__PURE__*/React.createElement("img", {
137
+ src: imageSrc,
138
+ alt: "Company Logo"
139
+ }) : isDark ? /*#__PURE__*/React.createElement(DsgLogo, {
140
+ dark: true
141
+ }) : /*#__PURE__*/React.createElement(DsgLogo, null)), /*#__PURE__*/React.createElement("div", {
142
+ "data-no-invert": true,
143
+ className: style.collapseButton,
144
+ onClick: handleCollapse
145
+ }, collapsed ? "->" : "<-"));
146
+ };
147
+ export default Sidebar;
@@ -0,0 +1,50 @@
1
+ .sidebar {
2
+ background: #fff !important;
3
+ border: none;
4
+ position: relative;
5
+ box-shadow: 0px 0px 8px 0px #00000025;
6
+ height: calc(100vh - 85px);
7
+ border-radius: 0px 0px 12px 0px;
8
+ svg {
9
+ vertical-align: middle;
10
+ }
11
+ .menu {
12
+ margin-top: 10px;
13
+ padding: 0 6px;
14
+ li {
15
+ span {
16
+ margin-left: 8px;
17
+ font-size: 16px;
18
+ font-weight: 500;
19
+ line-height: 20px;
20
+ text-align: left;
21
+ }
22
+ }
23
+ }
24
+ .buttons {
25
+ position: absolute;
26
+ left: 15px;
27
+ bottom: 16px;
28
+ svg {
29
+ width: 100%;
30
+ height: auto;
31
+ padding-right: 15px;
32
+ }
33
+ img {
34
+ width: 100%;
35
+ height: auto;
36
+ padding-right: 15px;
37
+ }
38
+ }
39
+ .collapseButton {
40
+ position: absolute;
41
+ right: -12px;
42
+ top: 50%;
43
+ transform: translateY(-100%);
44
+ padding: 5px;
45
+ background: var(--blue);
46
+ border-radius: 50%;
47
+ color: var(--white);
48
+ cursor: pointer;
49
+ }
50
+ }