Skip to content

Commit 770ada6

Browse files
shreeyash07frozenhelium
authored andcommitted
fix information validations
1 parent 85be907 commit 770ada6

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

manager-dashboard/app/views/NewTutorial/InformationPageInput/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99

1010
import TextInput from '#components/TextInput';
1111
import Button from '#components/Button';
12-
import MarkdownEditor from '#components/MarkdownEditor';
1312
import InformationPagePreview from './InformationPagePreview';
1413

1514
import { InformationPagesType } from '../utils';

manager-dashboard/app/views/NewTutorial/index.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ import {
7676
InformationPagesType,
7777
colorKeyToColorMap,
7878
InformationPageTemplateKey,
79-
infoPageTemplateoptions,
79+
infoPageTemplateOptions,
8080
infoPageBlocksMap,
8181
tileServerUrls,
8282
ColorKey,
@@ -565,14 +565,19 @@ function NewTutorial(props: Props) {
565565
popupContentClassName={styles.newInfoButtonPopup}
566566
disabled={submissionPending || projectTypeEmpty}
567567
>
568-
{infoPageTemplateoptions.map((infoPageTemplate) => (
568+
{infoPageTemplateOptions.map((infoPageTemplate) => (
569569
<Button
570570
className={styles.popupItem}
571571
name={infoPageTemplate.key}
572572
key={infoPageTemplate.key}
573573
onClick={handleAddInformationPage}
574574
variant="transparent"
575-
disabled={submissionPending || projectTypeEmpty}
575+
disabled={(
576+
submissionPending
577+
|| projectTypeEmpty
578+
|| (value.informationPages
579+
&& value.informationPages.length >= 10)
580+
)}
576581
>
577582
{infoPageTemplate.label}
578583
</Button>

manager-dashboard/app/views/NewTutorial/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export interface InformationPageOption {
170170
label: string;
171171
}
172172

173-
export const infoPageTemplateoptions: InformationPageOption[] = [
173+
export const infoPageTemplateOptions: InformationPageOption[] = [
174174
{
175175
key: '1-picture',
176176
label: 'With 1 picture',
@@ -429,7 +429,7 @@ export const tutorialFormSchema: TutorialFormSchema = {
429429
},
430430
informationPages: {
431431
validation: (info) => {
432-
if (info && info.length >= 10) {
432+
if (info && info.length > 10) {
433433
return 'Information page cannot be more than 10';
434434
}
435435
return undefined;

0 commit comments

Comments
 (0)