-
Notifications
You must be signed in to change notification settings - Fork 16
PM- 1502 Scorecards filtering and listing UI #1184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a826cad
74595fc
c6d6c32
6138ea4
63af3a0
d978668
cf00e0c
f473d90
6480aba
12ea744
96f77b1
05a2c77
6462088
578cb10
8e2377e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,18 +6,49 @@ | |
justify-content: flex-end; | ||
align-items: center; | ||
padding: 16px 0; | ||
gap: $sp-4; | ||
gap: $sp-2; | ||
|
||
.pageNumbers button, | ||
.previous, | ||
.disabled, | ||
.first, | ||
.last, | ||
.next { | ||
box-shadow: none; | ||
border: 1px solid #E9ECEF; | ||
border-radius: 4px; | ||
color: #0A0A0A; | ||
font-weight: 400; | ||
font-size: 14px; | ||
} | ||
|
||
.previous, | ||
.first, | ||
.last, | ||
.next { | ||
padding: 7px 11px; | ||
|
||
&:disabled { | ||
background-color: #E9ECEF !important; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of |
||
} | ||
} | ||
|
||
|
||
.pageNumbers { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
gap: $sp-1; | ||
gap: $sp-2; | ||
|
||
button { | ||
padding: 3px 12px; | ||
} | ||
|
||
button.active { | ||
color: $black-60; | ||
pointer-events: none; | ||
box-shadow: inset 0 0 0 2px #{$black-60}; | ||
background-color: $teal-160; | ||
color: white; | ||
} | ||
} | ||
|
||
|
@@ -35,4 +66,8 @@ | |
@media (max-width: #{$mobile-max}) { | ||
justify-content: center; | ||
} | ||
|
||
:global(.btn-style-secondary) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid using |
||
box-shadow: none !important; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,7 +74,6 @@ const Pagination: FC<PaginationProps> = (props: PaginationProps) => { | |
size='md' | ||
icon={IconOutline.ChevronDoubleLeftIcon} | ||
iconToLeft | ||
label='FIRST' | ||
disabled={props.page === 1 || props.disabled} | ||
className={styles.first} | ||
/> | ||
|
@@ -84,7 +83,6 @@ const Pagination: FC<PaginationProps> = (props: PaginationProps) => { | |
size='md' | ||
icon={IconOutline.ChevronLeftIcon} | ||
iconToLeft | ||
label='PREVIOUS' | ||
disabled={props.page === 1 || props.disabled} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
className={styles.previous} | ||
/> | ||
|
@@ -93,7 +91,6 @@ const Pagination: FC<PaginationProps> = (props: PaginationProps) => { | |
<Button | ||
key={`page-${i}`} | ||
secondary | ||
variant='round' | ||
label={`${i}`} | ||
onClick={createHandlePageClick(i)} | ||
className={i === props.page ? styles.active : ''} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
@@ -107,7 +104,6 @@ const Pagination: FC<PaginationProps> = (props: PaginationProps) => { | |
size='md' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
icon={IconOutline.ChevronRightIcon} | ||
iconToRight | ||
label='NEXT' | ||
disabled={props.page === totalPages || props.disabled} | ||
className={styles.next} | ||
/> | ||
|
@@ -118,7 +114,6 @@ const Pagination: FC<PaginationProps> = (props: PaginationProps) => { | |
size='md' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
icon={IconOutline.ChevronDoubleRightIcon} | ||
iconToRight | ||
label='LAST' | ||
disabled={props.page === totalPages || props.disabled} | ||
className={styles.last} | ||
/> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ import { | |
FC, | ||
SetStateAction, | ||
useCallback, | ||
useContext, | ||
useEffect, | ||
useMemo, | ||
useRef, | ||
useState, | ||
|
@@ -13,23 +15,35 @@ import classNames from 'classnames' | |
|
||
import { useClickOutside } from '~/libs/shared/lib/hooks' | ||
|
||
import { getTabIdFromPathName, TabsConfig } from './config' | ||
import { ReviewAppContext } from '../../contexts' | ||
import { ReviewAppContextModel } from '../../models' | ||
|
||
import { getTabIdFromPathName, getTabsConfig } from './config' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function |
||
import styles from './NavTabs.module.scss' | ||
|
||
const NavTabs: FC = () => { | ||
const navigate: NavigateFunction = useNavigate() | ||
const [isOpen, setIsOpen] = useState<boolean>(false) | ||
const triggerRef = useRef<HTMLDivElement>(null) | ||
const { pathname }: { pathname: string } = useLocation() | ||
|
||
const { loginUserInfo }: ReviewAppContextModel = useContext(ReviewAppContext) | ||
const userRoles = useMemo(() => loginUserInfo?.roles || [], [loginUserInfo?.roles]) | ||
const tabs = useMemo(() => getTabsConfig(userRoles), [userRoles]) | ||
|
||
const activeTabPathName: string = useMemo<string>( | ||
() => getTabIdFromPathName(pathname), | ||
[pathname], | ||
() => getTabIdFromPathName(pathname, userRoles), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function |
||
[pathname, userRoles], | ||
) | ||
const [activeTab, setActiveTab]: [ | ||
string, | ||
Dispatch<SetStateAction<string>> | ||
] = useState<string>(activeTabPathName) | ||
|
||
useEffect(() => { | ||
setActiveTab(activeTabPathName) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
}, [activeTabPathName]) | ||
|
||
const handleTabChange = useCallback( | ||
(tabId: string) => { | ||
setActiveTab(tabId) | ||
|
@@ -58,7 +72,7 @@ const NavTabs: FC = () => { | |
Review | ||
</div> | ||
<ul className={styles.tab}> | ||
{TabsConfig.map(tab => ( | ||
{tabs.map(tab => ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable |
||
<li | ||
key={tab.id} | ||
className={ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,25 +5,37 @@ import { | |
activeReviewAssigmentsRouteId, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable name |
||
openOpportunitiesRouteId, | ||
pastReviewAssignmentsRouteId, | ||
scorecardRouteId, | ||
} from '~/apps/review/src/config/routes.config' | ||
|
||
export const TabsConfig: TabsNavItem[] = [ | ||
{ | ||
id: activeReviewAssigmentsRouteId, | ||
title: 'Active Review Assignments', | ||
}, | ||
{ | ||
id: openOpportunitiesRouteId, | ||
title: 'Open Opportunities', | ||
}, | ||
{ | ||
id: pastReviewAssignmentsRouteId, | ||
title: 'Past Review Assignments', | ||
}, | ||
] | ||
export function getTabsConfig(userRoles: string[]): TabsNavItem[] { | ||
const tabs: TabsNavItem[] = [ | ||
{ | ||
id: activeReviewAssigmentsRouteId, | ||
title: 'Active Review Assignments', | ||
}, | ||
{ | ||
id: openOpportunitiesRouteId, | ||
title: 'Open Opportunities', | ||
}, | ||
{ | ||
id: pastReviewAssignmentsRouteId, | ||
title: 'Past Review Assignments', | ||
}, | ||
] | ||
|
||
export function getTabIdFromPathName(pathname: string): string { | ||
const matchItem = _.find(TabsConfig, item => pathname.includes(`/${item.id}`)) | ||
if (userRoles.includes('administrator')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider checking for null or undefined values for |
||
tabs.push({ | ||
id: scorecardRouteId, | ||
title: 'Scorecards', | ||
}) | ||
} | ||
|
||
return tabs | ||
} | ||
|
||
export function getTabIdFromPathName(pathname: string, userRoles: string[]): string { | ||
const matchItem = _.find(getTabsConfig(userRoles), item => pathname.includes(`/${item.id}`)) | ||
|
||
if (matchItem) { | ||
return matchItem.id | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
@import '@libs/ui/styles/includes'; | ||
|
||
.filtersContainer { | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 1rem; | ||
margin-top: 32px; | ||
align-items: flex-end; | ||
padding: 20px; | ||
background-color: #E0E4E84D; | ||
justify-content: center; | ||
align-items: center; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The property |
||
|
||
.inputWrapper { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
gap: $sp-1; | ||
flex: 5; | ||
min-width: 355px; | ||
width: 100%; | ||
margin-bottom: 0; | ||
justify-content: end; | ||
|
||
label { | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: space-between; | ||
} | ||
} | ||
|
||
.inputText { | ||
color: $black-60; | ||
box-sizing: border-box; | ||
border: 0; | ||
width: 100%; | ||
padding: 0; | ||
margin: 0; | ||
height: auto; | ||
border-radius: 0; | ||
|
||
&:focus { | ||
box-shadow: none; | ||
border: none; | ||
outline: none; | ||
color: $black-100; | ||
} | ||
|
||
&::placeholder { | ||
color: $black-60; | ||
opacity: 1; | ||
text-transform: none; | ||
} | ||
} | ||
|
||
.inputIcon { | ||
color: $black-60; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
} | ||
|
||
|
||
|
||
.searchInput { | ||
flex: 5; | ||
min-width: 355px; | ||
width: 100%; | ||
margin-bottom: 0; | ||
|
||
} | ||
|
||
.typeSelect { | ||
flex: 2; | ||
margin-bottom: 0; | ||
|
||
> div:first-child { | ||
padding: 3px 16px 4px 16px; | ||
} | ||
} | ||
|
||
.projectTypeSelect { | ||
flex: 1.5; | ||
margin-bottom: 0; | ||
|
||
> div:first-child { | ||
padding: 3px 16px 4px 16px; | ||
} | ||
} | ||
|
||
.categorySelect { | ||
flex: 1.5; | ||
margin-bottom: 0; | ||
|
||
> div:first-child { | ||
padding: 3px 16px 4px 16px; | ||
} | ||
} | ||
|
||
.statusSelect { | ||
flex: 1; | ||
margin-bottom: 0; | ||
|
||
> div:first-child { | ||
padding: 3px 16px 4px 16px; | ||
} | ||
} | ||
|
||
.clearButton { | ||
flex: 0.5; | ||
color: #767676; | ||
text-transform: capitalize; | ||
border-radius: 4px; | ||
border: 1px #A8A8A8 solid; | ||
box-shadow: none; | ||
font-weight: 700; | ||
} | ||
|
||
} | ||
|
||
@media (max-width: 768px) { | ||
.filtersContainer { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a comment to explain the purpose of the |
||
flex-wrap: wrap; | ||
justify-content: center; | ||
gap: 1rem; | ||
|
||
.inputWrapper { | ||
flex: 1 1 100%; | ||
min-width: 0 !important; | ||
} | ||
|
||
// Two filters per row | ||
.typeSelect, | ||
.projectTypeSelect, | ||
.categorySelect, | ||
.statusSelect, | ||
.clearButton { | ||
flex: 1 1 calc(50% - 0.5rem); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment |
||
min-width: 0; | ||
} | ||
} | ||
} | ||
|
||
@media (max-width: 1285px) and (min-width: 769px) { | ||
|
||
.filtersContainer { | ||
|
||
.typeSelect, | ||
.projectTypeSelect, | ||
.categorySelect, | ||
.statusSelect { | ||
flex: 1 1 20%; | ||
min-width: 0; | ||
|
||
> div:first-child { | ||
white-space: normal; | ||
min-width: 0; | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
@media (max-width: 500px) { | ||
.filtersContainer > * { | ||
flex: 1 1 100%; | ||
} | ||
} | ||
|
||
:global(.input-el) { | ||
margin-bottom: 0; | ||
padding: 3px 16px 3px 16px; | ||
} | ||
|
||
:global(.input-wrapper) { | ||
height: 38px; | ||
} | ||
|
||
:global(.btn-size-lg) { | ||
padding: 6px 24px; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider verifying if changing the gap from
$sp-4
to$sp-2
aligns with the overall design consistency and spacing guidelines of the application.