Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 44 additions & 24 deletions web-ui/src/components/reviews/periods/ReviewPeriods.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Copy link
Collaborator Author

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.

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';

Expand Down Expand Up @@ -135,6 +139,20 @@ const ReviewPeriods = ({ onPeriodSelected, mode }) => {
const userProfile = selectUserProfile(state);
const isAdmin = userProfile?.role?.includes('ADMIN');

useQueryParameters([
{
name: 'add',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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]
Expand Down Expand Up @@ -199,7 +217,8 @@ const ReviewPeriods = ({ onPeriodSelected, mode }) => {
periodId => {
if (mode === 'self') {
if (
selectReviewPeriod(state, periodId)?.reviewStatus === ReviewStatus.OPEN
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prettier did this.

selectReviewPeriod(state, periodId)?.reviewStatus ===
ReviewStatus.OPEN
) {
if (
!selfReviews ||
Expand Down Expand Up @@ -446,7 +465,8 @@ const ReviewPeriods = ({ onPeriodSelected, mode }) => {
key={`period-lit-${id}`}
onClick={() => onPeriodClick(id)}
primary={
name + (reviewStatus === ReviewStatus.OPEN ? ' - Open' : '')
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prettier did this.

name +
(reviewStatus === ReviewStatus.OPEN ? ' - Open' : '')
}
secondary={getSecondaryLabel(id)}
/>
Expand Down