Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions web-ui/src/components/guild-results/EditGuildModal.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ const testGuild = {
guildMembers: [
{ id: 125, name: 'Guild Member' },
{ id: 126, name: 'Other Member' }
]
],
active: true,
};

const emptyGuild = {
name: 'Test Guild',
description: 'A guild used for testing.'
description: 'A guild used for testing.',
active: true,
};

const currentUserProfile = {
Expand Down
4 changes: 2 additions & 2 deletions web-ui/src/components/kudos_dialog/KudosDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { AppContext } from '../../context/AppContext';
import {
selectCsrfToken,
selectCurrentUser,
selectNormalizedTeams,
selectActiveTeams,
selectOrderedCurrentMemberProfiles,
selectProfile
} from '../../context/selectors';
Expand Down Expand Up @@ -65,7 +65,7 @@ const KudosDialog = ({ open, recipient, teamId, onClose }) => {
);

const currentUser = selectCurrentUser(state);
const teams = selectNormalizedTeams(state, '');
const teams = selectActiveTeams(state);
const memberProfiles = selectOrderedCurrentMemberProfiles(state);

const handleSubmit = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ import { AppContext } from '../../../context/AppContext';
import {
selectCsrfToken,
selectCurrentMembers,
selectGuilds,
selectActiveGuilds,
selectMappedUserRoles,
selectRoles,
selectSkills,
selectSubordinates,
selectSupervisors,
selectTeamMembersBySupervisorId,
selectTeams
selectActiveTeams,
} from '../../../context/selectors';
import { UPDATE_TOAST } from '../../../context/actions';
import { getMembersByTeam } from '../../../api/team';
Expand Down Expand Up @@ -172,14 +172,14 @@ const MemberSelectorDialog = ({
const getFilterOptions = () => {
switch (filterType) {
case FilterType.TEAM:
const teams = selectTeams(state);
const teams = selectActiveTeams(state);
return {
options: teams,
label: team => team.name,
equals: (team1, team2) => team1.id === team2.id
};
case FilterType.GUILD:
const guilds = selectGuilds(state);
const guilds = selectActiveGuilds(state);
return {
options: guilds,
label: guild => guild.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const testGuild = {
name: 'Test Guild',
description: 'A guild used for testing.',
guildLeads: [{ id: 124, name: managerProfile.name }],
guildMembers: []
guildMembers: [],
active: true,
};

const initialState = {
Expand Down
21 changes: 18 additions & 3 deletions web-ui/src/components/team-results/TeamSummaryCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import {
DialogContent,
DialogContentText,
DialogTitle,
Tooltip
Tooltip,
Typography,
} from '@mui/material';
import PropTypes from 'prop-types';
import { updateTeam } from '../../api/team.js';
Expand All @@ -34,7 +35,8 @@ const StyledCard = styled(Card)({
width: '340px',
display: 'flex',
flexDirection: 'column',
justifyContent: 'space-between'
justifyContent: 'space-between',
position: 'relative',
},
[`& .${classes.header}`]: {
width: '100%'
Expand All @@ -46,6 +48,11 @@ const StyledCard = styled(Card)({
}
});

const inactiveStyle = {
'color': 'var(--action-disabled)',
'font-size': '0.75em',
};

const propTypes = {
team: PropTypes.shape({
id: PropTypes.string,
Expand Down Expand Up @@ -101,7 +108,7 @@ const TeamSummaryCard = ({ team, index, onTeamSelect, selectedTeamId }) => {
title: classes.title,
subheader: classes.title
}}
title={team.name + (team.active ? ' (Active)' : ' (Inactive)')}
title={team.name}
subheader={
<Tooltip
open={tooltipIsOpen}
Expand All @@ -116,6 +123,14 @@ const TeamSummaryCard = ({ team, index, onTeamSelect, selectedTeamId }) => {
}
/>
<CardContent>
{!team.active && (
<Typography sx={{ position: 'absolute', top: 10, right: 10,
...inactiveStyle,
}}
>
Inactive
</Typography>
)}
{team.teamMembers == null ? (
<React.Fragment key={`empty-team-${team.name}`}>
<strong>Team Leads: </strong>None Assigned
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`renders correctly 1`] = `
<div>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root TeamSummaryCard-card css-2bwzc-MuiPaper-root-MuiCard-root"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root TeamSummaryCard-card css-55zgp6-MuiPaper-root-MuiCard-root"
>
<div
class="MuiCardHeader-root css-185gdzj-MuiCardHeader-root"
Expand All @@ -14,7 +14,7 @@ exports[`renders correctly 1`] = `
<span
class="MuiTypography-root MuiTypography-h5 MuiCardHeader-title TeamSummaryCard-title css-1qvr50w-MuiTypography-root"
>
string (Inactive)
string
</span>
<span
class="MuiTypography-root MuiTypography-body1 MuiCardHeader-subheader TeamSummaryCard-title css-nrdprl-MuiTypography-root"
Expand All @@ -32,6 +32,11 @@ exports[`renders correctly 1`] = `
<div
class="MuiCardContent-root css-46bh2p-MuiCardContent-root"
>
<p
class="MuiTypography-root MuiTypography-body1 css-19pemnp-MuiTypography-root"
>
Inactive
</p>
<strong>
Team Leads:
</strong>
Expand All @@ -52,7 +57,7 @@ exports[`renders correctly 1`] = `
exports[`renders correctly for ADMIN 1`] = `
<div>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root TeamSummaryCard-card css-2bwzc-MuiPaper-root-MuiCard-root"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root TeamSummaryCard-card css-55zgp6-MuiPaper-root-MuiCard-root"
>
<div
class="MuiCardHeader-root css-185gdzj-MuiCardHeader-root"
Expand All @@ -63,7 +68,7 @@ exports[`renders correctly for ADMIN 1`] = `
<span
class="MuiTypography-root MuiTypography-h5 MuiCardHeader-title TeamSummaryCard-title css-1qvr50w-MuiTypography-root"
>
string (Inactive)
string
</span>
<span
class="MuiTypography-root MuiTypography-body1 MuiCardHeader-subheader TeamSummaryCard-title css-nrdprl-MuiTypography-root"
Expand All @@ -81,6 +86,11 @@ exports[`renders correctly for ADMIN 1`] = `
<div
class="MuiCardContent-root css-46bh2p-MuiCardContent-root"
>
<p
class="MuiTypography-root MuiTypography-body1 css-19pemnp-MuiTypography-root"
>
Inactive
</p>
<strong>
Team Leads:
</strong>
Expand Down Expand Up @@ -142,7 +152,7 @@ exports[`renders correctly for ADMIN 1`] = `
exports[`renders correctly for team lead 1`] = `
<div>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root TeamSummaryCard-card css-2bwzc-MuiPaper-root-MuiCard-root"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root TeamSummaryCard-card css-55zgp6-MuiPaper-root-MuiCard-root"
>
<div
class="MuiCardHeader-root css-185gdzj-MuiCardHeader-root"
Expand All @@ -153,7 +163,7 @@ exports[`renders correctly for team lead 1`] = `
<span
class="MuiTypography-root MuiTypography-h5 MuiCardHeader-title TeamSummaryCard-title css-1qvr50w-MuiTypography-root"
>
stuff (Inactive)
stuff
</span>
<span
class="MuiTypography-root MuiTypography-body1 MuiCardHeader-subheader TeamSummaryCard-title css-nrdprl-MuiTypography-root"
Expand All @@ -169,6 +179,11 @@ exports[`renders correctly for team lead 1`] = `
<div
class="MuiCardContent-root css-46bh2p-MuiCardContent-root"
>
<p
class="MuiTypography-root MuiTypography-body1 css-19pemnp-MuiTypography-root"
>
Inactive
</p>
<strong>
Team Leads:
</strong>
Expand Down
14 changes: 12 additions & 2 deletions web-ui/src/context/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,11 +686,21 @@ export const selectNormalizedTeams = createSelector(
})
);

export const selectActiveTeams = createSelector(
selectTeams,
(teams, searchText) => teams?.filter(team => team.active)
);

export const selectActiveGuilds = createSelector(
selectGuilds,
(guilds, searchText) => guilds?.filter(guild => guild.active)
);

export const selectMyGuilds = createSelector(
selectCurrentUserId,
selectGuilds,
(id, guilds) =>
guilds?.filter(guild =>
guilds?.filter(guild => guild.active &&
guild.guildMembers?.some(member => member.memberId === id)
)
);
Expand All @@ -699,7 +709,7 @@ export const selectMyTeams = createSelector(
selectCurrentUserId,
selectTeams,
(id, teams) =>
teams?.filter(team =>
teams?.filter(team => team.active &&
team.teamMembers?.some(member => member.memberId === id)
)
);
Expand Down