Skip to content

fix: height & width of survey preview when loading#3234

Merged
jobenjada merged 3 commits intoformbricks:mainfrom
SatyanarayanPrashar:Fix-height-&-width-of-survey-preview-when-loading-#3210
Oct 1, 2024
Merged

fix: height & width of survey preview when loading#3234
jobenjada merged 3 commits intoformbricks:mainfrom
SatyanarayanPrashar:Fix-height-&-width-of-survey-preview-when-loading-#3210

Conversation

@SatyanarayanPrashar
Copy link
Contributor

@SatyanarayanPrashar SatyanarayanPrashar commented Oct 1, 2024

Fixes #3210

What does this PR do?

fixed the height of the preview window, when the survey editor was loading.

Screen.Recording.2024-10-01.at.1.12.26.PM.mov

How should this be tested?

  • Test A
  • Test B

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

Summary by CodeRabbit

  • New Features

    • Improved layout and styling of the survey preview interface for better responsiveness.
    • Enhanced visibility of the Reset Progress button in mobile view.
  • Bug Fixes

    • Fixed modal closing behavior when no questions are left in the survey.
  • Improvements

    • Streamlined transitions between preview states and improved state management for a smoother user experience.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 1, 2024

Walkthrough

The changes in the PreviewSurvey component focus on enhancing the layout and responsiveness of the survey preview interface. Key modifications include setting a fixed width of 95% for the main container, refining the logic for mobile view, and improving state management related to full-screen previews. Additionally, the component's behavior during loading has been adjusted to ensure a better user experience.

Changes

Files Change Summary
packages/ui/components/PreviewSurvey/index.tsx Adjusted layout and styling for responsiveness; refined mobile view logic; improved state management for full-screen preview; updated modal behavior on survey completion.

Assessment against linked issues

Objective Addressed Explanation
Fix height & width of survey preview when loading (#3210)

Possibly related PRs

Suggested labels

bug

Suggested reviewers

  • jobenjada

Poem

🐇 In the meadow, surveys bloom,
With widths adjusted, there's more room.
Mobile views now take the stage,
A better preview, all the rage!
Hopping through code, we make it right,
For every user, a joyful sight! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added bug Something isn't working good first issue Good for newcomers hacktoberfest complete these issues to gather points for Hacktoberfest 🕹️ 150 points 🕹️ oss.gg Community issue via oss.gg labels Oct 1, 2024
@github-actions
Copy link
Contributor

github-actions bot commented Oct 1, 2024

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between b7f4097 and 4ef84aa.

📒 Files selected for processing (1)
  • packages/ui/components/PreviewSurvey/index.tsx (1 hunks)

: "shrink"
}
className="relative flex items-center justify-center rounded-lg border border-slate-300 bg-slate-200">
className="relative flex h-full w-[95%] items-center justify-center rounded-lg border border-slate-300 bg-slate-200">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider using responsive width utilities for better adaptability

Setting a fixed width with w-[95%] may not provide optimal responsiveness across all screen sizes. Using responsive utility classes or maximum width constraints can enhance the component's adaptability on different devices.

You could modify the className as follows:

-className="relative flex h-full w-[95%] items-center justify-center rounded-lg border border-slate-300 bg-slate-200">
+className="relative flex h-full w-full max-w-4xl items-center justify-center rounded-lg border border-slate-300 bg-slate-200">

This change uses w-full for full width and max-w-4xl to set a maximum width, allowing the component to be responsive while maintaining a reasonable maximum size.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
className="relative flex h-full w-[95%] items-center justify-center rounded-lg border border-slate-300 bg-slate-200">
className="relative flex h-full w-full max-w-4xl items-center justify-center rounded-lg border border-slate-300 bg-slate-200">

@vercel
Copy link

vercel bot commented Oct 1, 2024

@jobenjada is attempting to deploy a commit to the formbricks Team on Vercel.

A member of the Team first needs to authorize it.

@jobenjada jobenjada enabled auto-merge October 1, 2024 19:37
@jobenjada jobenjada self-requested a review October 1, 2024 19:38
Copy link
Member

@jobenjada jobenjada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick fix ;) LGTM!

@jobenjada jobenjada added this pull request to the merge queue Oct 1, 2024
Merged via the queue into formbricks:main with commit 316e5f1 Oct 1, 2024
@oss-gg
Copy link

oss-gg bot commented Oct 1, 2024

Awarding SatyanarayanPrashar: 150 points 🕹️ Well done! Check out your new contribution on oss.gg/SatyanarayanPrashar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working good first issue Good for newcomers hacktoberfest complete these issues to gather points for Hacktoberfest 🕹️ oss.gg Community issue via oss.gg 🕹️ 150 points

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🕹️] Fix height & width of survey preview when loading

2 participants