diff --git a/src/commons/sideContent/SideContentAutograder.tsx b/src/commons/sideContent/SideContentAutograder.tsx index 5b11670d46..40a571f996 100644 --- a/src/commons/sideContent/SideContentAutograder.tsx +++ b/src/commons/sideContent/SideContentAutograder.tsx @@ -8,6 +8,7 @@ import ControlButton from '../ControlButton'; import { WorkspaceLocation } from '../workspace/WorkspaceTypes'; import SideContentResultCard from './SideContentResultCard'; import SideContentTestcaseCard from './SideContentTestcaseCard'; +import StarRating from './StarRating'; export type SideContentAutograderProps = DispatchProps & StateProps & OwnProps; @@ -31,6 +32,7 @@ type OwnProps = { const SideContentAutograder: React.FunctionComponent = props => { const [showsTestcases, setTestcasesShown] = React.useState(true); const [showsResults, setResultsShown] = React.useState(true); + const [userRating, setUserRating] = React.useState(null); const { testcases, autogradingResults, handleTestcaseEval, workspaceLocation } = props; @@ -96,6 +98,10 @@ const SideContentAutograder: React.FunctionComponent {testcaseCards} +
+
Rate the Quality of the Answer:
+ +
{collapseButton('Autograder Results', showsResults, toggleResults)} {resultCards} diff --git a/src/commons/sideContent/StarRating.tsx b/src/commons/sideContent/StarRating.tsx new file mode 100644 index 0000000000..f5fb8123e5 --- /dev/null +++ b/src/commons/sideContent/StarRating.tsx @@ -0,0 +1,31 @@ +import { Icon } from '@blueprintjs/core'; +import React from 'react'; + +interface StarRatingProps { + value: number; + onChange: (rating: number) => void; +} + +const StarRating: React.FC = ({ value, onChange }) => { + const maxStars = 5; + + const handleStarClick = (selectedValue: number) => { + if (onChange) { + onChange(selectedValue); + } + }; + + return ( +
+ {[...Array(maxStars)].map((_, index) => ( + = index + 1 ? 'star' : 'star-empty'} + onClick={() => handleStarClick(index + 1)} + /> + ))} +
+ ); +}; + +export default StarRating;