@banch0u/core-project-test-repository 1.3.2 → 1.4.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.
@@ -0,0 +1,70 @@
1
+ .settingsWrapper {
2
+ padding-right: 8px;
3
+ }
4
+
5
+ .sectionTitle {
6
+ margin-bottom: 16px;
7
+ font-weight: 600;
8
+ color: #1f1f1f;
9
+ }
10
+
11
+ .settingGroupTitle {
12
+ margin: 12px 0 8px;
13
+ font-size: 16px;
14
+ color: #888;
15
+ font-weight: 500;
16
+ display: block;
17
+ }
18
+
19
+ .formLabel {
20
+ font-weight: 500;
21
+ font-size: 14px;
22
+ }
23
+
24
+ .inlineSwitch {
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: space-between;
28
+ margin-bottom: 12px;
29
+
30
+ .ant-form-item-label {
31
+ flex: 1;
32
+ margin: 0;
33
+ }
34
+
35
+ .ant-form-item-control {
36
+ flex-shrink: 0;
37
+ margin-left: 16px;
38
+ }
39
+
40
+ .ant-switch {
41
+ margin-left: auto;
42
+ }
43
+ }
44
+ .modal_select > div {
45
+ padding: 5px 16px !important;
46
+ // border-color: #bdbdbd !important;
47
+ border-radius: 6px !important;
48
+ height: 48px;
49
+ }
50
+ .modal_select {
51
+ width: 100%;
52
+ height: auto;
53
+ height: 48px;
54
+ span {
55
+ font-size: 16px !important;
56
+ font-weight: 500 !important;
57
+ line-height: 24px !important;
58
+ text-align: left !important;
59
+ }
60
+ }
61
+ .next_buttons_ {
62
+ display: flex;
63
+ justify-content: flex-end;
64
+ gap: 20px;
65
+ margin-top: 10px;
66
+ button {
67
+ border-radius: 6px;
68
+ padding: 9px 19px;
69
+ }
70
+ }
@@ -0,0 +1,131 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import React, { useEffect, useState } from "react";
3
+ import { Badge, Dropdown, Menu, Tooltip } from "antd";
4
+ import { SunOutlined, MoonOutlined } from "@ant-design/icons";
5
+ import style from "./index.module.scss";
6
+ import { BellOutlined, BellFilled, NotificationOutlined } from "@ant-design/icons";
7
+ import { useDispatch, useSelector } from "react-redux";
8
+ import { Link } from "react-router-dom";
9
+ import { getProfileInfo, scopes } from "../../store/slices/auth";
10
+ import { entryData } from "../../pages/Platform/constant";
11
+ import { CategoryIcon, UserIcon } from "../../assets/icons";
12
+ import { getNotifications } from "../../store/slices/notification";
13
+ import NotificationDropdown from "../NotificationDropdown";
14
+ var ProfileOptions = function ProfileOptions() {
15
+ var dispatch = useDispatch();
16
+ var _useSelector = useSelector(function (state) {
17
+ return state.auth;
18
+ }),
19
+ scopesData = _useSelector.scopesData;
20
+ var profileInfo = useSelector(function (state) {
21
+ return state.auth.profileInfo;
22
+ });
23
+ var _useSelector2 = useSelector(function (state) {
24
+ return state.global;
25
+ }),
26
+ notificationsRender = _useSelector2.notificationsRender;
27
+ var _useState = useState(20),
28
+ _useState2 = _slicedToArray(_useState, 2),
29
+ size = _useState2[0],
30
+ setSize = _useState2[1];
31
+ var _useState3 = useState(1),
32
+ _useState4 = _slicedToArray(_useState3, 2),
33
+ page = _useState4[0],
34
+ setPage = _useState4[1];
35
+ var notifications = useSelector(function (state) {
36
+ return state.notification.notifications;
37
+ });
38
+ console.log(notificationsRender);
39
+ var _useState5 = useState(localStorage.getItem("theme") || "light"),
40
+ _useState6 = _slicedToArray(_useState5, 2),
41
+ theme = _useState6[0],
42
+ setTheme = _useState6[1];
43
+ var toggleTheme = function toggleTheme() {
44
+ var newTheme = theme === "light" ? "dark" : "light";
45
+ setTheme(newTheme);
46
+ localStorage.setItem("theme", newTheme);
47
+ document.documentElement.setAttribute("data-theme", newTheme);
48
+ window.dispatchEvent(new Event("themeChange"));
49
+ };
50
+ var NotificationIcon = function NotificationIcon() {
51
+ return /*#__PURE__*/React.createElement(Badge, {
52
+ count: notifications === null || notifications === void 0 ? void 0 : notifications.notReadenCount,
53
+ style: {
54
+ fontSize: "10px",
55
+ height: "16px",
56
+ minWidth: "16px",
57
+ lineHeight: "16px",
58
+ padding: "0 4px"
59
+ }
60
+ }, /*#__PURE__*/React.createElement(BellOutlined, {
61
+ style: {
62
+ fontSize: "20px"
63
+ }
64
+ }));
65
+ };
66
+ useEffect(function () {
67
+ dispatch(scopes());
68
+ dispatch(getProfileInfo());
69
+ }, [dispatch]);
70
+ useEffect(function () {
71
+ dispatch(getNotifications({
72
+ size: size,
73
+ page: page
74
+ }));
75
+ }, [dispatch, size, page, notificationsRender]);
76
+ useEffect(function () {
77
+ console.log("notificationsRender:", notificationsRender);
78
+ }, [notificationsRender]);
79
+ var rootUrl = window.location.origin;
80
+ var menu1 = /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement("div", {
81
+ className: style.links
82
+ }, entryData === null || entryData === void 0 ? void 0 : entryData.map(function (item) {
83
+ return scopesData === "*" || scopesData !== null && scopesData !== void 0 && scopesData.includes(item.scopes) ? /*#__PURE__*/React.createElement(Link, {
84
+ to: item === null || item === void 0 ? void 0 : item.pathname,
85
+ key: item === null || item === void 0 ? void 0 : item.id
86
+ }, item === null || item === void 0 ? void 0 : item.icon, item === null || item === void 0 ? void 0 : item.value) : /*#__PURE__*/React.createElement("div", {
87
+ className: style.disableMenu,
88
+ key: item === null || item === void 0 ? void 0 : item.id
89
+ }, item === null || item === void 0 ? void 0 : item.icon, item === null || item === void 0 ? void 0 : item.value);
90
+ }), /*#__PURE__*/React.createElement(Link, {
91
+ to: "".concat(rootUrl, "/accounts")
92
+ }, /*#__PURE__*/React.createElement(UserIcon, null), "\u015E\u0259xsi kabinet")));
93
+ return /*#__PURE__*/React.createElement("div", {
94
+ className: style.profile
95
+ }, /*#__PURE__*/React.createElement(Tooltip, {
96
+ title: theme === "dark" ? "Gündüz modu" : "Gecə modu"
97
+ }, /*#__PURE__*/React.createElement("button", {
98
+ onClick: toggleTheme,
99
+ "data-no-invert": true,
100
+ className: style.button
101
+ }, theme === "dark" ? /*#__PURE__*/React.createElement(SunOutlined, null) : /*#__PURE__*/React.createElement(MoonOutlined, null))), /*#__PURE__*/React.createElement(Dropdown, {
102
+ overlay: /*#__PURE__*/React.createElement(NotificationDropdown, {
103
+ size: size,
104
+ page: page,
105
+ setSize: setSize,
106
+ setPage: setPage
107
+ }),
108
+ trigger: ["click"],
109
+ placement: "bottomRight",
110
+ overlayClassName: style.notificationDropdown
111
+ }, /*#__PURE__*/React.createElement(Tooltip, {
112
+ title: "Bildirişlər"
113
+ }, /*#__PURE__*/React.createElement("button", {
114
+ "data-no-invert": true,
115
+ className: style.button
116
+ }, /*#__PURE__*/React.createElement(NotificationIcon, null)))), /*#__PURE__*/React.createElement(Dropdown, {
117
+ overlay: menu1,
118
+ trigger: ["click"]
119
+ }, /*#__PURE__*/React.createElement("div", {
120
+ className: style.category,
121
+ "data-no-invert-1": true
122
+ }, /*#__PURE__*/React.createElement(CategoryIcon, null))), /*#__PURE__*/React.createElement("div", {
123
+ className: style.dropdown
124
+ }, /*#__PURE__*/React.createElement("div", {
125
+ className: style.pp,
126
+ "data-no-invert": true
127
+ }, profileInfo === null || profileInfo === void 0 ? void 0 : profileInfo.name[0]), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
128
+ className: style.name
129
+ }, profileInfo === null || profileInfo === void 0 ? void 0 : profileInfo.name, " ", profileInfo === null || profileInfo === void 0 ? void 0 : profileInfo.surname))));
130
+ };
131
+ export default ProfileOptions;
@@ -0,0 +1,131 @@
1
+ .profile {
2
+ display: flex;
3
+ gap: 12px;
4
+ align-items: center;
5
+ .category {
6
+ display: flex;
7
+ align-items: center;
8
+ margin-top: 4px;
9
+ cursor: pointer;
10
+ svg {
11
+ width: 30px;
12
+ height: 30px;
13
+ }
14
+ }
15
+ .button {
16
+ background: transparent;
17
+ border: none;
18
+ display: flex;
19
+ align-items: center;
20
+ cursor: pointer;
21
+ svg {
22
+ width: 20px;
23
+ margin-top: 3.5px;
24
+ }
25
+ }
26
+ .dropdown {
27
+ display: flex;
28
+ align-items: center;
29
+ cursor: pointer;
30
+ gap: 8px;
31
+ img {
32
+ width: 39px;
33
+ height: 39px;
34
+ border-radius: 50%;
35
+ border: 1px solid #bebebe;
36
+ }
37
+ .pp {
38
+ width: 39px;
39
+ height: 39px;
40
+ border-radius: 50%;
41
+ // border: 1px solid #bebebe;
42
+ background: var(--darkBlueColor);
43
+ color: white;
44
+ display: flex;
45
+ justify-content: center;
46
+ align-items: center;
47
+ }
48
+ .name {
49
+ font-family: Inter;
50
+ font-size: 12px;
51
+ font-weight: 400;
52
+ line-height: 16px;
53
+ text-align: left;
54
+ margin-bottom: 4px;
55
+ color: #324054;
56
+ }
57
+ .email {
58
+ font-family: Inter;
59
+ font-size: 12px;
60
+ font-weight: 400;
61
+ line-height: 14px;
62
+ text-align: left;
63
+ color: #71839b;
64
+ }
65
+ }
66
+ }
67
+
68
+ .links {
69
+ display: flex;
70
+ justify-content: space-between;
71
+ gap: 30px;
72
+ padding: 20px;
73
+ a {
74
+ display: flex;
75
+ flex-direction: column;
76
+ justify-content: flex-end;
77
+ align-items: center;
78
+ gap: 15px;
79
+ width: 133px;
80
+ // height: 133px;
81
+ padding: 20px 5px;
82
+ padding-top: 40px;
83
+ border-radius: 20px;
84
+ background: #f8f8f8;
85
+ font-family: Inter;
86
+ font-size: 14px;
87
+ font-weight: 500;
88
+ line-height: 16.94px;
89
+ text-align: center;
90
+ cursor: pointer;
91
+ text-align: center;
92
+ text-decoration: none;
93
+ color: var(--darkBlueColor);
94
+ svg {
95
+ width: 40px;
96
+ height: 40px;
97
+ }
98
+ }
99
+ }
100
+ .disableMenu {
101
+ display: flex;
102
+ flex-direction: column;
103
+ justify-content: flex-end;
104
+ align-items: center;
105
+ gap: 15px;
106
+ width: 133px;
107
+ // height: 133px;
108
+ padding: 20px 5px;
109
+ padding-top: 40px;
110
+ border-radius: 20px;
111
+ background: #f8f8f8;
112
+ font-family: Inter;
113
+ font-size: 14px;
114
+ font-weight: 500;
115
+ line-height: 16.94px;
116
+ text-align: center;
117
+ cursor: pointer;
118
+ text-align: center;
119
+ text-decoration: none;
120
+ color: var(--darkBlueColor);
121
+ svg {
122
+ width: 40px;
123
+ height: 40px;
124
+ }
125
+ color: #979797;
126
+ svg {
127
+ path {
128
+ fill: #979797;
129
+ }
130
+ }
131
+ }
@@ -1,17 +1,10 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- // hooks/useNotification.js
3
- import { useEffect, useState } from "react";
1
+ import { useEffect } from "react";
4
2
  import * as signalR from "@microsoft/signalr";
5
3
  import { infoMessageBottomRight } from "../utils/message";
4
+ import { setNotificationsRender } from "../store/slices/global";
5
+ import store from "../store/store"; // ⬅️ Import your Redux store explicitly
6
+
6
7
  var useNotification = function useNotification() {
7
- var _useState = useState(function () {
8
- // localStorage'dan bildirimi başlat
9
- var savedNotifications = localStorage.getItem("notifications");
10
- return savedNotifications ? JSON.parse(savedNotifications) : [];
11
- }),
12
- _useState2 = _slicedToArray(_useState, 2),
13
- notifications = _useState2[0],
14
- setNotifications = _useState2[1];
15
8
  useEffect(function () {
16
9
  var token = localStorage.getItem("token");
17
10
  var baseUrl;
@@ -33,6 +26,7 @@ var useNotification = function useNotification() {
33
26
  console.log("SignalR bağlantısı quruldu.");
34
27
  connection.on("receive", function (message) {
35
28
  console.log("Yeni bildiriş:", message);
29
+ store.dispatch(setNotificationsRender());
36
30
  infoMessageBottomRight(message);
37
31
  });
38
32
  })["catch"](function (err) {
@@ -43,6 +37,5 @@ var useNotification = function useNotification() {
43
37
  console.log("SignalR bağlantısı bağlandı.");
44
38
  };
45
39
  }, []);
46
- return notifications;
47
40
  };
48
41
  export default useNotification;
package/dist/index.js CHANGED
@@ -1,6 +1,4 @@
1
- // Export the Button component from the components directory as a named export
2
- import "./assets/fonts/fonts.css";
3
- import "./assets/css/variables.css";
1
+ import React from "react";
4
2
  export { default as Button } from "./components/Button";
5
3
  export { default as ColSort } from "./components/ColSort";
6
4
  export { default as Filter } from "./components/Filter";
@@ -8,5 +6,16 @@ export { default as Loading } from "./components/Loading";
8
6
  export { default as Pagination } from "./components/Pagination";
9
7
  export { default as useNotification } from "./hooks/useNotification";
10
8
  export { default as message } from "./utils/message";
11
- export { default as Login } from "./pages/Login";
12
- export { default as Platform } from "./pages/Platform";
9
+ import LoginPage from "./pages/Login";
10
+ import PlatformPage from "./pages/Platform";
11
+ import HeaderLayout from "./layout/Header";
12
+ import { CoreProvider } from "./store/coreProvider";
13
+ export var Login = function Login() {
14
+ return /*#__PURE__*/React.createElement(CoreProvider, null, /*#__PURE__*/React.createElement(LoginPage, null));
15
+ };
16
+ export var Platform = function Platform() {
17
+ return /*#__PURE__*/React.createElement(CoreProvider, null, /*#__PURE__*/React.createElement(PlatformPage, null));
18
+ };
19
+ export var Header = function Header() {
20
+ return /*#__PURE__*/React.createElement(CoreProvider, null, /*#__PURE__*/React.createElement(HeaderLayout, null));
21
+ };
@@ -0,0 +1,36 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import React, { useEffect, useState } from "react";
3
+ import style from "./index.module.scss";
4
+ import { DsgLogo } from "../../assets/icons";
5
+ import ProfileOptions from "../../components/ProfileOptions";
6
+ import { Link } from "react-router-dom";
7
+ import { PLATFORM_PATH } from "../../utils/path";
8
+ import Logo from "../../assets/balakhaniLogo.png";
9
+ var Header = function Header() {
10
+ var currentUrl = window.location.href;
11
+ var _useState = useState(localStorage.getItem("theme") || "light"),
12
+ _useState2 = _slicedToArray(_useState, 2),
13
+ theme = _useState2[0],
14
+ setTheme = _useState2[1];
15
+ var updateTheme = function updateTheme() {
16
+ var newTheme = localStorage.getItem("theme") || "light";
17
+ setTheme(newTheme);
18
+ };
19
+ useEffect(function () {
20
+ window.addEventListener("themeChange", updateTheme);
21
+ return function () {
22
+ return window.removeEventListener("themeChange", updateTheme);
23
+ };
24
+ }, []);
25
+ return /*#__PURE__*/React.createElement("header", {
26
+ className: style.header
27
+ }, /*#__PURE__*/React.createElement(Link, {
28
+ to: PLATFORM_PATH
29
+ }, currentUrl.includes("balakhanioc") ? /*#__PURE__*/React.createElement("img", {
30
+ src: Logo,
31
+ alt: "Balakhani Logo"
32
+ }) : theme === "dark" ? /*#__PURE__*/React.createElement(DsgLogo, {
33
+ dark: true
34
+ }) : /*#__PURE__*/React.createElement(DsgLogo, null)), /*#__PURE__*/React.createElement(ProfileOptions, null));
35
+ };
36
+ export default Header;
@@ -0,0 +1,19 @@
1
+ .header {
2
+ height: 84px;
3
+ background: #fff;
4
+ align-items: center;
5
+ display: flex;
6
+ align-items: center;
7
+ justify-content: space-between;
8
+ padding: 0 20px;
9
+ border-bottom: 1px solid #c4c4c4;
10
+
11
+ svg {
12
+ width: 123px;
13
+ height: auto;
14
+ }
15
+ img {
16
+ width: 95px;
17
+ height: auto;
18
+ }
19
+ }
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { Provider } from "react-redux";
3
+ import store from "./store";
4
+ export var CoreProvider = function CoreProvider(_ref) {
5
+ var children = _ref.children;
6
+ return /*#__PURE__*/React.createElement(Provider, {
7
+ store: store
8
+ }, children);
9
+ };
@@ -1,6 +1,7 @@
1
1
  import { createSlice } from "@reduxjs/toolkit";
2
2
  var initialState = {
3
- loading: false
3
+ loading: false,
4
+ notificationsRender: false
4
5
  };
5
6
  export var global = createSlice({
6
7
  name: "global",
@@ -9,8 +10,13 @@ export var global = createSlice({
9
10
  setLoading: function setLoading(state, _ref) {
10
11
  var payload = _ref.payload;
11
12
  state.loading = payload;
13
+ },
14
+ setNotificationsRender: function setNotificationsRender(state) {
15
+ state.notificationsRender = !state.notificationsRender;
12
16
  }
13
17
  }
14
18
  });
15
- var setLoading = global.actions.setLoading;
16
- export { setLoading };
19
+ var _global$actions = global.actions,
20
+ setLoading = _global$actions.setLoading,
21
+ setNotificationsRender = _global$actions.setNotificationsRender;
22
+ export { setLoading, setNotificationsRender };