Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Ttc on welcome card #1461

Merged
merged 11 commits into from
Nov 10, 2023
Merged

feat: Ttc on welcome card #1461

merged 11 commits into from
Nov 10, 2023

Conversation

Dhruwang
Copy link
Contributor

What does this PR do?

Adds TTC to welcome card
Now user can have an idea of what will be the estimated time required to take that particular survey

Fixes #1456

ttc_welcome_card.mp4
Screenshot 2023-10-25 at 5 58 18 PM

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • Enhancement (small improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change adds a new database migration
  • This change requires a documentation update

How should this be tested?

Go to survey Editor and check welcome card

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read How we Code at Formbricks
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand bits
  • Ran pnpm build
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues
  • First PR at Formbricks? Please sign the CLA! Without it we wont be able to merge it 🙏

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Formbricks Docs if changes were necessary

@vercel
Copy link

vercel bot commented Oct 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
formbricks-cloud ⬜️ Ignored (Inspect) Visit Preview Nov 10, 2023 5:06pm
formbricks-com ⬜️ Ignored (Inspect) Visit Preview Nov 10, 2023 5:06pm

@github-actions
Copy link
Contributor

github-actions bot commented Oct 25, 2023

Thank you for following the naming conventions for pull request titles! 🙏

@review-agent-prime
Copy link
Contributor

Overall, the changes in this PR look good. However, there are a few areas where improvements can be made:

  1. In EditWelcomeCard.tsx, the onChange event handler for the Switch component is directly modifying the timeToFinish property of the welcomeCard object. It would be better to create a new object with the updated property to avoid mutating the state directly. Here's a suggested change:
onCheckedChange={() =>
  updateSurvey({ ...localSurvey, welcomeCard: { ...localSurvey.welcomeCard, timeToFinish: !localSurvey.welcomeCard.timeToFinish } })
}
  1. In ProgressBar.tsx, the calculateProgress function has been simplified by extracting the logic for calculating elementIdx into a separate function calculateElementIdx. This is a good practice as it improves code readability and maintainability. However, it would be better to handle the case where calculateElementIdx returns undefined or null.

  2. In WelcomeCard.tsx, the calculateTimeToComplete function assumes that each question takes 15 seconds to complete. This might not always be the case. It would be better to make this a configurable parameter.

  3. In utils.ts, the calculateElementIdx function has a fallback value of 0.5 for elementIdx when currentQustionIdx is undefined or null. It would be better to handle these edge cases explicitly.

  4. In surveys.ts, the default value of timeToFinish has been changed from false to true. This is a significant change that could affect the behavior of existing surveys. Please ensure that this change is intended and that it has been thoroughly tested.

@jobenjada jobenjada added this pull request to the merge queue Nov 10, 2023
Merged via the queue into main with commit ac8cf98 Nov 10, 2023
9 checks passed
@jobenjada jobenjada deleted the ttc-on-welcome-card branch November 10, 2023 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants