Skip to content

Commit

Permalink
fix: Fix various titles and filters (#1133)
Browse files Browse the repository at this point in the history
* fix: Fix various titles and filters

* only show questionnaire editor when in all projects

* remove console logs
  • Loading branch information
DanielBohme authored Sep 3, 2024
1 parent 68f2751 commit 053c755
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
7 changes: 5 additions & 2 deletions frontend/src/components/ActionTable/ActionTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { barrierToString, organizationToString } from '../../utils/EnumToString'
import { getFusionProjectName } from '../../utils/helpers'
import PriorityIndicator from '../Action/PriorityIndicator'
import { PersonDetails } from '@equinor/fusion-react-person'
import { useAppContext } from '../../context/AppContext'

const { Row, Cell } = Table

Expand Down Expand Up @@ -47,10 +48,12 @@ interface Props {
}

const ActionTable = ({ onClickAction, actionsWithAdditionalInfo, personDetailsList, showEvaluations = false, projects }: Props) => {
const {currentProject} = useAppContext()

const columns = columnOptions.filter(
col =>
(col.name === 'Evaluation' && showEvaluations) ||
(col.name === 'Project' && projects) ||
(col.name === 'Project' && !currentProject) ||
(col.name !== 'Evaluation' && col.name !== 'Project')
)

Expand Down Expand Up @@ -117,7 +120,7 @@ const ActionTable = ({ onClickAction, actionsWithAdditionalInfo, personDetailsLi
>
{action.title}
</Cell>
{projects && <Cell>{getFusionProjectName(projects, action.question.evaluation.project.fusionProjectId)}</Cell>}
{!currentProject && <Cell>{getFusionProjectName(projects, action.question.evaluation.project.fusionProjectId)}</Cell>}
{showEvaluations && <Cell>{action.question.evaluation.name}</Cell>}
<Cell>{barrierToString(barrier)}</Cell>
<Cell>{organizationToString(organization)}</Cell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const CategoryHeader = ({

const projectCategoryOptions = [
{
title: 'All project categories',
title: 'All questionnaire templates',
id: 'all',
},
]
Expand Down Expand Up @@ -87,7 +87,7 @@ const CategoryHeader = ({
<Box flexGrow={1}>
<Box ml={4} width={'250px'}>
<SearchableDropdown
label="Project Category"
label="Questionnaire Template"
value={projectCategoryOptions.find(option => option.id === selectedProjectCategory)?.title}
onSelect={option => {
const selectedOption = (option as any).nativeEvent.detail.selected[0]
Expand All @@ -105,11 +105,11 @@ const CategoryHeader = ({
<Box alignSelf={'center'}>
<Button variant="outlined" onClick={() => setIsInCreateProjectCategoryMode(true)} data-testid="addProjectCategory">
<Icon data={add}></Icon>
Add project category
Add questionnaire template
</Button>
</Box>
<Box mr={4} ml={1} alignSelf={'center'}>
<Tooltip placement="bottom" title={'Delete selected project category'}>
<Tooltip placement="bottom" title={'Delete selected questionnaire template'}>
<Button
data-testid="deleteProjectCategory"
variant="ghost"
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/views/Project/Dashboard/DashboardView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ const MapTableSelectionToText: React.FC<MapTableSelectionToTextProps> = ({ table
return (
<>
<Icon data={visibility} size={16} />
{`Project hidden evaluations`}
{`Hidden project evaluations`}
</>
)
}
case 'HIDDEN_USER': {
return (
<>
<Icon data={visibility} size={16} />
{`My hidden evaluations`}
{`Hidden evaluations`}
</>
)
}
Expand Down Expand Up @@ -159,6 +159,7 @@ const DashboardView = ({ project }: Props) => {
if (
(!userIsAdmin && value === TableSelection.HiddenProject) ||
(value === TableSelection.HiddenUser && currentContext) ||
(currentContext && value === TableSelection.Portfolio) ||
(!currentContext && (value === TableSelection.Project || value === TableSelection.HiddenProject || value === TableSelection.HiddenUserProject)) ||
(value === TableSelection.User && currentContext && evaluationsByUserProject.length === 0) ||
(value === TableSelection.User && !currentContext && evaluationsByUser.length === 0) ||
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/Project/ProjectTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const ProjectTabs = ({ match }: RouteComponentProps<Params>) => {
<List>
<Tab>Evaluations</Tab>
<Tab>My actions</Tab>
{isAdmin ? <Tab>Questionnaire editor</Tab> : <></>}
{isAdmin && !currentContext ? <Tab>Questionnaire editor</Tab> : <></>}
</List>
</Grid>
</Grid>
Expand Down

0 comments on commit 053c755

Please sign in to comment.