Skip to content

Commit

Permalink
Merge pull request #523 from EscolaLMS/feature/REK-79
Browse files Browse the repository at this point in the history
Feature/rek 79
  • Loading branch information
victazzz authored Dec 5, 2024
2 parents 38d7729 + 28567dd commit ccffc59
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@capacitor/ios": "^5.7.3",
"@capacitor/local-notifications": "^5.0.7",
"@capacitor/status-bar": "^5.0.7",
"@escolalms/components": "^0.0.158",
"@escolalms/components": "^0.0.159",
"@escolalms/h5p-react": "^0.2.19",
"@escolalms/sdk": "^0.6.2",
"@escolalms/ts-models": "^0.0.35",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,6 @@ const ConsultationSidebar: React.FC<ConsultationSidebarProps> = (props) => {
</Button>
)}

<IconText
icon={<IconUsers />}
text={t("ConsultationPage.SidebarFeature1")}
/>
<IconText
icon={<IconQuestion />}
text={t("ConsultationPage.SidebarFeature2")}
Expand Down
5 changes: 3 additions & 2 deletions src/components/Courses/RateCourse/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const RateCourse: React.FC<Props> = ({

const handleSendAnswer = useCallback(
async (rate: number, note?: string) => {
console.log("handleSendAnswer", rate, note);
if (questionnaire.questions) {
setState((prevState) => ({
...prevState,
Expand All @@ -55,8 +56,8 @@ const RateCourse: React.FC<Props> = ({
if (request.success) {
toast(`${t("RateCourse.")}`, "success");
}
} catch (error) {
toast("Error", "error");
} catch (error: any) {

Check warning on line 59 in src/components/Courses/RateCourse/index.tsx

View workflow job for this annotation

GitHub Actions / static-analysis (20)

Unexpected any. Specify a different type

Check warning on line 59 in src/components/Courses/RateCourse/index.tsx

View workflow job for this annotation

GitHub Actions / build-and-deploy

Unexpected any. Specify a different type
toast("Error", error.message);
console.error(error);
} finally {
setState((prevState) => ({
Expand Down
12 changes: 7 additions & 5 deletions src/components/QuestionBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ export const QuestionBox: FC<QuestionBoxProps> = ({

const [answer, setAnswer] = useState({ rate: 0, note: "" });

const submit = () => {
handleSubmit(answer.rate, answer.note);
const submit = (rate?: number) => {
handleSubmit(rate ? rate : answer.rate, answer.note);
setAnswer({ rate: 0, note: "" });
};

console.log({ data });
return (
<QuestionBoxWrapper>
<Title className="question-box__title">
Expand All @@ -52,7 +52,9 @@ export const QuestionBox: FC<QuestionBoxProps> = ({
<div className="question-box__content">
{!!withStarsRating ? (
<Rate
onSubmit={(rate) => setAnswer((prev) => ({ ...prev, rate }))}
// @ts-ignore TODO: add to sdk
score={data.max_score}
onSubmit={(rate) => submit(rate)}
header={data.title}
onCancel={onClose}
>
Expand Down Expand Up @@ -103,7 +105,7 @@ export const QuestionBox: FC<QuestionBoxProps> = ({
{t("RateCourse.NoAnswer")}
</Button>
<Button
onClick={submit}
onClick={() => submit()}
type="button"
mode="primary"
disabled={!answer.note.length}
Expand Down

0 comments on commit ccffc59

Please sign in to comment.