Skip to content

Commit

Permalink
Fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
subinasr committed Aug 23, 2023
1 parent 3f72721 commit 4b98279
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/views/QuestionnaireEdit/DateQuestionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,15 @@ interface Props {
projectId: string;
questionnaireId: string;
questionId?: string;
onSuccess: (questionId: string | undefined) => void;
}

function DateQuestionForm(props: Props) {
const {
projectId,
questionnaireId,
questionId,
onSuccess,
} = props;

const alert = useAlert();
Expand Down Expand Up @@ -193,6 +195,7 @@ function DateQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question created successfully.',
{ variant: 'success' },
Expand Down Expand Up @@ -225,6 +228,7 @@ function DateQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question updated successfully.',
{ variant: 'success' },
Expand Down
4 changes: 4 additions & 0 deletions src/views/QuestionnaireEdit/FileQuestionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,15 @@ interface Props {
projectId: string;
questionnaireId: string;
questionId?: string;
onSuccess: (questionId: string | undefined) => void;
}

function FileQuestionForm(props: Props) {
const {
projectId,
questionnaireId,
questionId,
onSuccess,
} = props;

const alert = useAlert();
Expand Down Expand Up @@ -193,6 +195,7 @@ function FileQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question created successfully.',
{ variant: 'success' },
Expand Down Expand Up @@ -225,6 +228,7 @@ function FileQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question updated successfully.',
{ variant: 'success' },
Expand Down
4 changes: 4 additions & 0 deletions src/views/QuestionnaireEdit/ImageQuestionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,15 @@ interface Props {
projectId: string;
questionnaireId: string;
questionId?: string;
onSuccess: (questionId: string | undefined) => void;
}

function ImageQuestionForm(props: Props) {
const {
projectId,
questionnaireId,
questionId,
onSuccess,
} = props;

const alert = useAlert();
Expand Down Expand Up @@ -193,6 +195,7 @@ function ImageQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question created successfully.',
{ variant: 'success' },
Expand Down Expand Up @@ -225,6 +228,7 @@ function ImageQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question updated successfully.',
{ variant: 'success' },
Expand Down
4 changes: 4 additions & 0 deletions src/views/QuestionnaireEdit/IntegerQuestionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,15 @@ interface Props {
projectId: string;
questionnaireId: string;
questionId?: string;
onSuccess: (questionId: string | undefined) => void;
}

function IntegerQuestionForm(props: Props) {
const {
projectId,
questionnaireId,
questionId,
onSuccess,
} = props;

const alert = useAlert();
Expand Down Expand Up @@ -189,6 +191,7 @@ function IntegerQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question created successfully.',
{ variant: 'success' },
Expand Down Expand Up @@ -221,6 +224,7 @@ function IntegerQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question updated successfully.',
{ variant: 'success' },
Expand Down
4 changes: 4 additions & 0 deletions src/views/QuestionnaireEdit/NoteQuestionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,15 @@ interface Props {
projectId: string;
questionnaireId: string;
questionId?: string;
onSuccess: (questionId: string | undefined) => void;
}

function NoteQuestionForm(props: Props) {
const {
projectId,
questionnaireId,
questionId,
onSuccess,
} = props;

const alert = useAlert();
Expand Down Expand Up @@ -193,6 +195,7 @@ function NoteQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question created successfully.',
{ variant: 'success' },
Expand Down Expand Up @@ -225,6 +228,7 @@ function NoteQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question updated successfully.',
{ variant: 'success' },
Expand Down
4 changes: 4 additions & 0 deletions src/views/QuestionnaireEdit/RankQuestionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,15 @@ interface Props {
projectId: string;
questionnaireId: string;
questionId?: string;
onSuccess: (questionId: string | undefined) => void;
}

function RankQuestionForm(props: Props) {
const {
projectId,
questionnaireId,
questionId,
onSuccess,
} = props;

const alert = useAlert();
Expand Down Expand Up @@ -194,6 +196,7 @@ function RankQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question created successfully.',
{ variant: 'success' },
Expand Down Expand Up @@ -226,6 +229,7 @@ function RankQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question updated successfully.',
{ variant: 'success' },
Expand Down
10 changes: 10 additions & 0 deletions src/views/QuestionnaireEdit/SelectMultipleQuestionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ import SelectMultipleQuestionPreview from '#components/questionPreviews/SelectMu
import PillarSelectInput from '#components/PillarSelectInput';
import ChoiceCollectionSelectInput from '#components/ChoiceCollectionSelectInput';

import {
QUESTION_FRAGMENT,
} from '../queries.ts';
import styles from './index.module.css';

const CREATE_MULTIPLE_SELECTION_QUESTION = gql`
${QUESTION_FRAGMENT}
mutation CreateMultipleSelectionQuestion(
$projectId: ID!,
$input: QuestionCreateInput!,
Expand All @@ -43,6 +47,9 @@ const CREATE_MULTIPLE_SELECTION_QUESTION = gql`
) {
ok
errors
result {
...QuestionResponse
}
}
}
}
Expand Down Expand Up @@ -86,12 +93,14 @@ const schema: FormSchema = {
interface Props {
projectId: string;
questionnaireId: string;
onSuccess: (questionId: string | undefined) => void;
}

function SelectMultipleQuestionForm(props: Props) {
const {
projectId,
questionnaireId,
onSuccess,
} = props;

const alert = useAlert();
Expand All @@ -111,6 +120,7 @@ function SelectMultipleQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question created successfully.',
{ variant: 'success' },
Expand Down
10 changes: 10 additions & 0 deletions src/views/QuestionnaireEdit/SelectOneQuestionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ import SelectOneQuestionPreview from '#components/questionPreviews/SelectOneQues
import PillarSelectInput from '#components/PillarSelectInput';
import ChoiceCollectionSelectInput from '#components/ChoiceCollectionSelectInput';

import {
QUESTION_FRAGMENT,
} from '../queries.ts';
import styles from './index.module.css';

const CREATE_SINGLE_SELECTION_QUESTION = gql`
${QUESTION_FRAGMENT}
mutation CreateSingleSelectionQuestion(
$projectId: ID!,
$input: QuestionCreateInput!,
Expand All @@ -44,6 +48,9 @@ const CREATE_SINGLE_SELECTION_QUESTION = gql`
) {
ok
errors
result {
...QuestionResponse
}
}
}
}
Expand Down Expand Up @@ -87,12 +94,14 @@ const schema: FormSchema = {
interface Props {
projectId: string;
questionnaireId: string;
onSuccess: (questionId: string | undefined) => void;
}

function SelectOneQuestionForm(props: Props) {
const {
projectId,
questionnaireId,
onSuccess,
} = props;

const alert = useAlert();
Expand All @@ -111,6 +120,7 @@ function SelectOneQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question created successfully.',
{ variant: 'success' },
Expand Down
4 changes: 4 additions & 0 deletions src/views/QuestionnaireEdit/TextQuestionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ interface Props {
projectId: string;
questionnaireId: string;
questionId?: string;
onSuccess: (questionId: string | undefined) => void;
}

function TextQuestionForm(props: Props) {
const {
projectId,
questionnaireId,
questionId,
onSuccess,
} = props;

const alert = useAlert();
Expand Down Expand Up @@ -190,6 +192,7 @@ function TextQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question created successfully.',
{ variant: 'success' },
Expand Down Expand Up @@ -222,6 +225,7 @@ function TextQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question updated successfully.',
{ variant: 'success' },
Expand Down
4 changes: 4 additions & 0 deletions src/views/QuestionnaireEdit/TimeQuestionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,15 @@ interface Props {
projectId: string;
questionnaireId: string;
questionId?: string;
onSuccess: (questionId: string | undefined) => void;
}

function TimeQuestionForm(props: Props) {
const {
projectId,
questionnaireId,
questionId,
onSuccess,
} = props;

const alert = useAlert();
Expand Down Expand Up @@ -194,6 +196,7 @@ function TimeQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question created successfully.',
{ variant: 'success' },
Expand Down Expand Up @@ -226,6 +229,7 @@ function TimeQuestionForm(props: Props) {
return;
}
if (response.ok) {
onSuccess(response.result?.id);
alert.show(
'Question updated successfully.',
{ variant: 'success' },
Expand Down
Loading

0 comments on commit 4b98279

Please sign in to comment.