Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
fongsean committed Jun 5, 2024
1 parent 0304d3e commit 0e7e69a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ function ViewExistingResponsesButton() {
navigate('/dashboard/responses');
}

let responseMessage;
if (isFetching && selectedQuestionnaire) {
responseMessage = 'Loading responses';
} else if (existingResponses.length === 0) {
responseMessage = 'No responses found';
} else {
responseMessage = 'View responses';
}

const buttonIsDisabled = !selectedQuestionnaire || existingResponses.length === 0 || isFetching;

return (
Expand All @@ -70,11 +79,7 @@ function ViewExistingResponsesButton() {
color={buttonIsDisabled ? 'text.disabled' : 'primary'}
textAlign="center"
sx={{ mt: -0.5, mb: 0.5 }}>
{isFetching && selectedQuestionnaire
? 'Loading responses'
: existingResponses.length === 0
? 'No responses found'
: 'View responses'}
{responseMessage}
</Typography>
</Stack>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,21 @@ export function getResponseToolBarColors(
selectedQuestionnaire: Questionnaire | null,
existingResponses: QuestionnaireResponse[]
) {
return {
...(selected
? {
color: 'primary.main',
bgcolor: 'pale.primary'
}
: selectedQuestionnaire && existingResponses.length > 0
? {
color: 'secondary.main',
bgcolor: 'pale.secondary'
}
: null)
};
if (selected) {
return {
color: 'primary.main',
bgcolor: 'pale.primary'
};
}

if (selectedQuestionnaire && existingResponses.length > 0) {
return {
color: 'secondary.main',
bgcolor: 'pale.secondary'
};
}

return {};
}

export function getQuestionnaireToolBarColors(selected: Questionnaire | null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import {
StyledRoot
} from '../../QuestionnairePage/TableComponents/QuestionnaireListToolbar.styles.ts';
import ResponseListToolbarButtons from './ResponseListToolbarButtons.tsx';
import type { QuestionnaireResponse } from 'fhir/r4';
import type { Questionnaire } from 'fhir/r4';
import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
import ResponseListToolbarLeftSection from './ResponseListToolbarLeftSection.tsx';
import useSelectedQuestionnaire from '../../../../hooks/useSelectedQuestionnaire.ts';

Expand Down

0 comments on commit 0e7e69a

Please sign in to comment.