1- import { useState , useEffect , useMemo , React , useRef } from 'react' ;
2- import { ENDPOINTS } from '~/utils/URL' ;
31import axios from 'axios' ;
4- import { getWeeklySummaries } from '~/actions/weeklySummaries ' ;
5- import { Link , useLocation , useHistory } from 'react-router-dom ' ;
2+ import PropTypes from 'prop-types ' ;
3+ import { useEffect , useMemo , useRef , useState } from 'react' ;
64import { connect , useDispatch } from 'react-redux' ;
5+ import { Link , useHistory , useLocation } from 'react-router-dom' ;
6+ import { toast } from 'react-toastify' ;
77import {
8+ Button ,
9+ Card ,
810 Collapse ,
9- Navbar ,
10- NavbarToggler ,
11- Nav ,
12- NavItem ,
13- NavLink ,
14- UncontrolledDropdown ,
15- DropdownToggle ,
16- DropdownMenu ,
1711 DropdownItem ,
12+ DropdownMenu ,
13+ DropdownToggle ,
1814 Modal ,
19- ModalHeader ,
2015 ModalBody ,
2116 ModalFooter ,
22- Button ,
23- Card ,
17+ ModalHeader ,
18+ Nav ,
19+ Navbar ,
20+ NavItem ,
21+ NavLink ,
22+ UncontrolledDropdown
2423} from 'reactstrap' ;
24+ import { getWeeklySummaries } from '~/actions/weeklySummaries' ;
2525import PopUpBar from '~/components/PopUpBar' ;
2626import { fetchTaskEditSuggestions } from '~/components/TaskEditSuggestions/thunks' ;
27- import { toast } from 'react-toastify ' ;
27+ import { ENDPOINTS } from '~/utils/URL ' ;
2828import { getHeaderData } from '../../actions/authActions' ;
29+ import {
30+ getUnreadUserNotifications ,
31+ resetNotificationError ,
32+ } from '../../actions/notificationAction' ;
2933import { getAllRoles } from '../../actions/role' ;
30- import Timer from '../Timer/Timer ' ;
31- import OwnerMessage from '../OwnerMessage/OwnerMessage ' ;
34+ import { getUserProfile } from '../../actions/userProfile ' ;
35+ import '../../App.module.css ' ;
3236import {
33- DASHBOARD ,
34- TIMELOG ,
35- REPORTS ,
36- WEEKLY_SUMMARIES_REPORT ,
37- TEAM_LOCATIONS ,
38- OTHER_LINKS ,
39- USER_MANAGEMENT ,
37+ ACTUAL_COST_BREAKDOWN ,
4038 BADGE_MANAGEMENT ,
41- PROJECTS ,
42- TEAMS ,
43- WELCOME ,
44- VIEW_PROFILE ,
45- UPDATE_PASSWORD ,
39+ BLUE_SQUARE_EMAIL_MANAGEMENT ,
40+ DASHBOARD ,
41+ JOB_ANALYTICS_REPORT ,
4642 LOGOUT ,
43+ OTHER_LINKS ,
4744 PERMISSIONS_MANAGEMENT ,
45+ PR_PROMOTIONS ,
46+ PROJECTS ,
47+ REPORTS ,
4848 SEND_EMAILS ,
49+ TEAM_LOCATIONS ,
50+ TEAMS ,
51+ TIMELOG ,
52+ TOTAL_CONSTRUCTION_SUMMARY ,
4953 TOTAL_ORG_SUMMARY ,
5054 TOTAL_ORG_SUMMARY_EMAIL ,
51- TOTAL_CONSTRUCTION_SUMMARY ,
52- PR_PROMOTIONS ,
53- ACTUAL_COST_BREAKDOWN ,
54- BLUE_SQUARE_EMAIL_MANAGEMENT ,
55- JOB_ANALYTICS_REPORT ,
55+ UPDATE_PASSWORD ,
56+ USER_MANAGEMENT ,
57+ VIEW_PROFILE ,
58+ WEEKLY_SUMMARIES_REPORT ,
59+ WELCOME ,
5660} from '../../languages/en/ui' ;
57- import Logout from '../Logout/Logout' ;
58- import '../../App.module.css' ;
59- import styles from './Header.module.css' ;
6061import hasPermission , { cantUpdateDevAdminDetails } from '../../utils/permissions' ;
61- import {
62- getUnreadUserNotifications ,
63- resetNotificationError ,
64- } from '../../actions/notificationAction' ;
65- import NotificationCard from '../Notification/notificationCard' ;
66- import DarkModeButton from './DarkModeButton' ;
67- import BellNotification from './BellNotification' ;
68- import { getUserProfile } from '../../actions/userProfile' ;
6962import PermissionWatcher from '../Auth/PermissionWatcher' ;
63+ import Logout from '../Logout/Logout' ;
64+ import NotificationCard from '../Notification/notificationCard' ;
65+ import OwnerMessage from '../OwnerMessage/OwnerMessage' ;
7066import DisplayBox from '../PRPromotions/DisplayBox' ;
71- import PropTypes from 'prop-types' ;
67+ import Timer from '../Timer/Timer' ;
68+ import BellNotification from './BellNotification' ;
69+ import DarkModeButton from './DarkModeButton' ;
70+ import styles from './Header.module.css' ;
7271
7372export function Header ( props ) {
7473 const location = useLocation ( ) ;
@@ -157,6 +156,9 @@ export function Header(props) {
157156
158157 // Blue Square Email Management
159158 const canAccessBlueSquareEmailManagement = props . hasPermission ( 'resendBlueSquareAndSummaryEmails' , ! isAuthUser ) ;
159+ // PR Dashboard
160+ const canAccessPRDashboard = props . hasPermission ( 'accessPRTeamDashboard' , ! isAuthUser ) ;
161+
160162
161163 const userId = user . userid ;
162164 const [ isModalVisible , setModalVisible ] = useState ( false ) ;
@@ -442,6 +444,7 @@ export function Header(props) {
442444 darkMode ? styles . darkMenuDropdown : styles . mobileMenuDropdown
443445 } `}
444446 >
447+
445448 < DropdownItem
446449 tag = { Link }
447450 to = { `/userprofile/${ displayUserId } ` }
@@ -756,7 +759,39 @@ export function Header(props) {
756759 </ DropdownItem >
757760 </ >
758761 ) }
759- < DropdownItem divider className = { styles . hideInMobile } />
762+ { canAccessBlueSquareEmailManagement && (
763+ < DropdownItem
764+ tag = { Link }
765+ to = "/bluesquare-email-management"
766+ className = { fontColor }
767+ disabled = { headerDisabled }
768+ >
769+ { BLUE_SQUARE_EMAIL_MANAGEMENT }
770+ </ DropdownItem >
771+ ) }
772+ </ DropdownMenu >
773+ </ UncontrolledDropdown >
774+ ) }
775+
776+ { canAccessPRDashboard && (
777+ < UncontrolledDropdown nav inNavbar >
778+ < DropdownToggle nav caret >
779+ < span > PR Dashboard</ span >
780+ </ DropdownToggle >
781+ < DropdownMenu
782+ className = { `${ styles . noMaxHeight } ${
783+ darkMode ? styles . darkMenuDropdown : styles . mobileMenuDropdown
784+ } `}
785+ >
786+ < DropdownItem
787+ tag = { Link }
788+ to = "/pr-dashboard"
789+ className = { fontColor }
790+ disabled = { headerDisabled }
791+ >
792+ PR Team Analysis Dashboard
793+ </ DropdownItem >
794+ < DropdownItem divider />
760795 < DropdownItem
761796 tag = { Link }
762797 to = "/pr-dashboard/analytics"
@@ -773,24 +808,40 @@ export function Header(props) {
773808 >
774809 PR Analytics
775810 </ DropdownItem >
776- { canAccessBlueSquareEmailManagement && (
777- < DropdownItem
778- tag = { Link }
779- to = "/bluesquare-email-management"
780- className = { fontColor }
781- disabled = { headerDisabled }
782- >
783- { BLUE_SQUARE_EMAIL_MANAGEMENT }
784- </ DropdownItem >
785- ) }
811+ < DropdownItem
812+ tag = { Link }
813+ to = "/pr-dashboard/promotion-eligibility"
814+ className = { fontColor }
815+ disabled = { headerDisabled }
816+ >
817+ Promotion Eligibility
818+ </ DropdownItem >
819+ < DropdownItem
820+ tag = { Link }
821+ to = "/pr-dashboard/top-reviewed-prs"
822+ className = { fontColor }
823+ disabled = { headerDisabled }
824+ >
825+ Top Reviewed PRs
826+ </ DropdownItem >
827+ < DropdownItem
828+ tag = { Link }
829+ to = "/pr-dashboard/details"
830+ className = { fontColor }
831+ disabled = { headerDisabled }
832+ >
833+ PR Details
834+ </ DropdownItem >
786835 </ DropdownMenu >
787836 </ UncontrolledDropdown >
788837 ) }
789-
838+
790839 < NavItem className = { styles . hideInMobile } >
791840 < BellNotification userId = { displayUserId } />
792841 </ NavItem >
793842
843+
844+
794845 < NavItem className = { styles . hideInMobile } >
795846 < NavLink tag = { Link } to = { `/userprofile/${ displayUserId } ` } >
796847 < div
@@ -954,3 +1005,4 @@ export default connect(mapStateToProps, {
9541005 getWeeklySummaries,
9551006 getUserProfile,
9561007} ) ( Header ) ;
1008+
0 commit comments