gayanSandamal / choner-mobile

0 stars 0 forks source link

Feedback page #92

Closed nisalV closed 2 weeks ago

nisalV commented 2 weeks ago

Fixed Text Field didn't get cleared after comment got posted bug mentioned in #91

@gayanSandamal Feedback form data model:


export type SurveyPageData = {
  id: string
  description: string
  options: { id: string, description: string }[]
  type: {
    multiSelect?: boolean
    textMultiline?: boolean
  }
}

export type CompletedForm = {
  pageId: string
  optionIds?: string[]
}

export type SurveyData = {
  title: string
  completedForms: CompletedForm[]
  pages: SurveyPageData[]
}

// Example:
const surveyData: SurveyData = {
  title: 'FOR GENERAL HEALTH AND WELLNESS',
  completedForms: [
    {
      pageId: `1`,
      optionIds: [`2`]
    },
    {
      pageId: `2`,
      optionIds: [`2`, `1`]
    }
  ],
  pages: [
    {
      id: `1`,
      description: 'How would you rate your overall quality of sleep in the past week?',
      options: [
        {
          id: `1`,
          description: 'Very poor sleep: Less than 4 hours'
        },
        {
          id: `2`,
          description: 'Very poor sleep: Less than 4 hours'
        },
        {
          id: `3`,
          description: 'Very poor sleep: Less than 4 hours'
        },
        {
          id: `4`,
          description: 'Very poor sleep: Less than 4 hours'
        },
        {
          id: `5`,
          description: 'Very poor sleep: Less than 4 hours'
        },
      ],
      type: {}
    },
    {
      id: `2`,
      description: 'How would you rate your overall quality of sleep in the past week? 2',
      options: [
        {
          id: `1`,
          description: 'Very poor sleep: Less than 4 hours 2'
        },
        {
          id: `2`,
          description: 'Very poor sleep: Less than 4 hours 2'
        },
        {
          id: `3`,
          description: 'Very poor sleep: Less than 4 hours 2'
        },
        {
          id: `4`,
          description: 'Very poor sleep: Less than 4 hours 2'
        },
        {
          id: `5`,
          description: 'Very poor sleep: Less than 4 hours 2'
        },
      ],
      type: { multiSelect: true }
    }
  ]
}