Skip to content

Commit 0752ec1

Browse files
authored
feat: add results view without any evaluation (#522)
1 parent c673b0f commit 0752ec1

File tree

5 files changed

+42
-2
lines changed

5 files changed

+42
-2
lines changed

src/config/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const DEFAULT_BOT_USERNAME = 'GraaspBot';
5151
export const SHORT_TIME_LIMIT = 10; // seconds
5252
export const DEFAULT_LANG = 'en';
5353

54-
export const DEFAULT_EVALUATION_TYPE = EvaluationType.Vote;
54+
export const DEFAULT_EVALUATION_TYPE = EvaluationType.None;
5555

5656
export const HIGHLIGHT_RESPONSE_TIME_MS = 2000;
5757

src/interfaces/evaluation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export enum EvaluationType {
2+
None = 'none',
23
Rate = 'rate',
34
Vote = 'vote',
45
Rank = 'rank',
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { FC } from 'react';
2+
import Grid from '@mui/material/Grid';
3+
import Response from '@/modules/common/response/Response';
4+
import Stack from '@mui/material/Stack';
5+
import { useActivityContext } from '../context/ActivityContext';
6+
import ExportResponsesButton from '../common/ExportRepsonsesButton';
7+
8+
interface NoEvaluationResultsProps {}
9+
10+
const NoEvaluationResults: FC<NoEvaluationResultsProps> = () => {
11+
const { allResponses } = useActivityContext();
12+
return (
13+
<Stack
14+
direction="column"
15+
justifyItems="center"
16+
alignItems="center"
17+
spacing={2}
18+
>
19+
<Grid container spacing={2}>
20+
{allResponses
21+
? allResponses.map((response) => (
22+
<Grid item key={response.id} xl={2} sm={4} xs={6}>
23+
<Response response={response} />
24+
</Grid>
25+
))
26+
: ''}
27+
</Grid>
28+
<ExportResponsesButton responses={allResponses} />
29+
</Stack>
30+
);
31+
};
32+
33+
export default NoEvaluationResults;

src/modules/results/ResultsView.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Pausable from '../common/Pausable';
88
import { RatingsProvider } from '../context/RatingsContext';
99
import { VoteProvider } from '../context/VoteContext';
1010
import VoteResults from './VoteResults';
11+
import NoEvaluationResults from './NoEvaluationResults';
1112

1213
interface ResultsViewProps {}
1314

@@ -31,7 +32,7 @@ const ResultsView = (props: ResultsViewProps): JSX.Element => {
3132
</RatingsProvider>
3233
);
3334
default:
34-
return null;
35+
return <NoEvaluationResults />;
3536
}
3637
};
3738

src/modules/settings/activity/steps/results/ResultsSettings.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ const EvaluationSettings: FC<ResultsSettingsProps> = ({
4949
handleResultsTypeChange(event.target.value as EvaluationType);
5050
}}
5151
>
52+
<FormControlLabel
53+
value={EvaluationType.None}
54+
control={<Radio />}
55+
label={tEvaluationType('NONE')}
56+
/>
5257
<FormControlLabel
5358
value={EvaluationType.Rate}
5459
control={<Radio />}

0 commit comments

Comments
 (0)