-
Notifications
You must be signed in to change notification settings - Fork 6
story 2310: added use of query parameters in ReviewPeriods.jsx #2325
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
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,28 +6,32 @@ import DeleteIcon from '@mui/icons-material/Delete'; | |
| import UnarchiveIcon from '@mui/icons-material/Unarchive'; | ||
| import WorkIcon from '@mui/icons-material/Work'; | ||
|
|
||
| import Box from '@mui/material/Box'; | ||
| import Avatar from '@mui/material/Avatar'; | ||
| import Button from '@mui/material/Button'; | ||
| import Dialog from '@mui/material/Dialog'; | ||
| import DialogActions from '@mui/material/DialogActions'; | ||
| import DialogContent from '@mui/material/DialogContent'; | ||
| import DialogContentText from '@mui/material/DialogContentText'; | ||
| import DialogTitle from '@mui/material/DialogTitle'; | ||
| import FormControl from '@mui/material/FormControl'; | ||
| import IconButton from '@mui/material/IconButton'; | ||
| import InputLabel from '@mui/material/InputLabel'; | ||
| import List from '@mui/material/List'; | ||
| import ListItem from '@mui/material/ListItem'; | ||
| import ListItemText from '@mui/material/ListItemText'; | ||
| import ListItemAvatar from '@mui/material/ListItemAvatar'; | ||
| import MenuItem from '@mui/material/MenuItem'; | ||
| import Modal from '@mui/material/Modal'; | ||
| import Select from '@mui/material/Select'; | ||
| import Skeleton from '@mui/material/Skeleton'; | ||
| import TextField from '@mui/material/TextField'; | ||
| import Tooltip from '@mui/material/Tooltip'; | ||
| import Typography from '@mui/material/Typography'; | ||
| import { | ||
| Avatar, | ||
| Box, | ||
| Button, | ||
| Dialog, | ||
| DialogActions, | ||
| DialogContent, | ||
| DialogContentText, | ||
| DialogTitle, | ||
| FormControl, | ||
| IconButton, | ||
| InputLabel, | ||
| List, | ||
| ListItem, | ||
| ListItemText, | ||
| ListItemAvatar, | ||
| MenuItem, | ||
| Modal, | ||
| Select, | ||
| Skeleton, | ||
| TextField, | ||
| Tooltip, | ||
| Typography | ||
| } from '@mui/material'; | ||
|
|
||
| import { useQueryParameters } from '../../../helpers/query-parameters'; | ||
|
|
||
| import { styled } from '@mui/material/styles'; | ||
|
|
||
|
|
@@ -135,6 +139,20 @@ const ReviewPeriods = ({ onPeriodSelected, mode }) => { | |
| const userProfile = selectUserProfile(state); | ||
| const isAdmin = userProfile?.role?.includes('ADMIN'); | ||
|
|
||
| useQueryParameters([ | ||
| { | ||
| name: 'add', | ||
|
Collaborator
Author
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 only state I see that we can track with query parameters on this page is whether the "ADD REVIEW PERIOD" button was clicked. |
||
| default: false, | ||
| value: reviewStatus, | ||
| setter(open) { | ||
| setReviewStatus(open ? ReviewStatus.OPEN : ReviewStatus.CLOSED); | ||
| }, | ||
| toQP(reviewStatus) { | ||
| return reviewStatus === ReviewStatus.OPEN; | ||
| } | ||
| } | ||
| ]); | ||
|
|
||
| const handleOpen = useCallback( | ||
| () => setReviewStatus(ReviewStatus.OPEN), | ||
| [setReviewStatus] | ||
|
|
@@ -199,7 +217,8 @@ const ReviewPeriods = ({ onPeriodSelected, mode }) => { | |
| periodId => { | ||
| if (mode === 'self') { | ||
| if ( | ||
| selectReviewPeriod(state, periodId)?.reviewStatus === ReviewStatus.OPEN | ||
|
Collaborator
Author
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. Prettier did this. |
||
| selectReviewPeriod(state, periodId)?.reviewStatus === | ||
| ReviewStatus.OPEN | ||
| ) { | ||
| if ( | ||
| !selfReviews || | ||
|
|
@@ -446,7 +465,8 @@ const ReviewPeriods = ({ onPeriodSelected, mode }) => { | |
| key={`period-lit-${id}`} | ||
| onClick={() => onPeriodClick(id)} | ||
| primary={ | ||
| name + (reviewStatus === ReviewStatus.OPEN ? ' - Open' : '') | ||
|
Collaborator
Author
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. Prettier did this. |
||
| name + | ||
| (reviewStatus === ReviewStatus.OPEN ? ' - Open' : '') | ||
| } | ||
| secondary={getSecondaryLabel(id)} | ||
| /> | ||
|
|
||
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.
I combined these imports into one.