Skip to content

fix: increase card size for link surveys#4285

Merged
jobenjada merged 3 commits intomainfrom
increase-card-size
Nov 12, 2024
Merged

fix: increase card size for link surveys#4285
jobenjada merged 3 commits intomainfrom
increase-card-size

Conversation

@Dhruwang
Copy link
Member

@Dhruwang Dhruwang commented Nov 11, 2024

What does this PR do?

Fixes #3293

How should this be tested?

Test card size for link surveys

Before

Screenshot 2024-11-11 at 5 55 40 PM

After

Screenshot 2024-11-11 at 5 55 14 PM

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
    • Enhanced layout for the LinkSurveyWrapper and PreviewSurvey components with a wider display area in medium-sized viewports.
    • Improved responsive design for the Survey component, refining its layout for better adaptability across different screen sizes.
  • Bug Fixes
    • Improved loading behavior of the SurveyLoadingAnimation component with the addition of a new prop for background loading state.

@vercel
Copy link

vercel bot commented Nov 11, 2024

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

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
formbricks-cloud ⬜️ Ignored (Inspect) Visit Preview Nov 12, 2024 2:06am
formbricks-docs ⬜️ Ignored (Inspect) Visit Preview Nov 12, 2024 2:06am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 11, 2024

Walkthrough

The pull request introduces modifications to the LinkSurveyWrapper, PreviewSurvey, and Survey components, primarily focusing on increasing the maximum width of specific div elements from max-w-md to max-w-lg. This change enhances the layout for better content display across various screen sizes. Additionally, the SurveyLoadingAnimation component is updated to include a new prop, isBackgroundLoaded, which improves its functionality based on the loading state. The overall structure and control flow of the components remain unchanged.

Changes

File Path Change Summary
apps/web/app/s/[surveyId]/components/LinkSurveyWrapper.tsx Increased max-w-md to max-w-lg for wider display; added isBackgroundLoaded prop to SurveyLoadingAnimation.
packages/ui/components/PreviewSurvey/index.tsx Changed max-w-md to max-w-lg for wider survey presentation in desktop preview mode.
packages/surveys/src/components/general/Survey.tsx Updated responsive class names from md: to sm: for improved layout on smaller screens.

Assessment against linked issues

Objective Addressed Explanation
Increase card size for link surveys (#3293)

Possibly related PRs

  • fix: height & width of survey preview when loading #3234: The changes in the PreviewSurvey component regarding layout adjustments and maximum width are directly related to the modifications made in the LinkSurveyWrapper component, as both involve changes to the maximum width of div elements affecting the survey display.
  • feat: Data table for persons #3154: The adjustment of maximum width in the PreviewSurvey component parallels the changes made to the LinkSurveyWrapper, indicating a shared focus on responsive design.
  • fix: survey preview updation issues #3269: The updates to the Survey component's responsiveness and layout changes are relevant as they reflect similar objectives in enhancing user experience through improved display characteristics, akin to the changes in LinkSurveyWrapper.
  • feat: Add Embed </> options to Survey cta bar and minor changes #3272: The modifications in the ShareEmbedSurvey component regarding layout and props suggest a connection to the changes in LinkSurveyWrapper, which also involves adjustments to component behavior and presentation.

Suggested labels

bug, customer request, 🕹️ oss.gg, 🕹️ 150 points

Suggested reviewers

  • gupta-piyush19

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 40b513f and 40c768e.

📒 Files selected for processing (2)
  • apps/web/app/s/[surveyId]/components/LinkSurveyWrapper.tsx (2 hunks)
  • packages/surveys/src/components/general/Survey.tsx (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/surveys/src/components/general/Survey.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/app/s/[surveyId]/components/LinkSurveyWrapper.tsx

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
Copy link
Contributor

github-actions bot commented Nov 11, 2024

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

@github-actions github-actions bot added the enhancement New feature or request label Nov 11, 2024
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: 0

🧹 Outside diff range and nitpick comments (1)
packages/ui/components/PreviewSurvey/index.tsx (1)

Line range hint 388-401: Consider consistent sizing between mobile and desktop views.

While the desktop view now uses max-w-lg, the mobile view (line 151) still uses max-w-md. Consider whether the mobile view should also be updated for consistency in the survey display across different devices.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between ea52624 and 40b513f.

📒 Files selected for processing (2)
  • apps/web/app/s/[surveyId]/components/LinkSurveyWrapper.tsx (1 hunks)
  • packages/ui/components/PreviewSurvey/index.tsx (1 hunks)
🔇 Additional comments (3)
apps/web/app/s/[surveyId]/components/LinkSurveyWrapper.tsx (2)

Line range hint 41-47: LGTM: Clean state management implementation.

The background loading state management is well-implemented using React hooks and follows best practices.


66-66: LGTM: Card size increase implemented correctly.

The width increase from md:max-w-md (28rem) to md:max-w-lg (32rem) perfectly matches the requirements from issue #3293. The change:

  • Only affects medium and larger viewports
  • Maintains responsiveness within the flex container
  • Provides better visibility for link surveys

Let's verify that this is the only instance of card width that needed updating:

✅ Verification successful

Width class change is correctly implemented

The change from md:max-w-md to md:max-w-lg in LinkSurveyWrapper.tsx is appropriate. The search results show that other max-w-md occurrences in the codebase are used in different contexts (error components, sheets, preview components, billing tables) and don't require similar updates as they serve different UI purposes unrelated to the link survey card size requirements from issue #3293.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining max-w-md classes that might need updating
rg "max-w-md" --type tsx --type jsx

Length of output: 63


Script:

#!/bin/bash
# Search for any remaining max-w-md classes using ripgrep without file type filters
rg "max-w-md"

Length of output: 1341

packages/ui/components/PreviewSurvey/index.tsx (1)

388-388: LGTM! Card size increase implemented correctly.

The change from max-w-md to max-w-lg successfully implements the requested card size increase for link surveys in desktop view, addressing issue #3293.

Let's verify that this change maintains proper responsiveness across different screen sizes:

✅ Verification successful

Card size increase looks good and maintains responsiveness

The change from max-w-md to max-w-lg is safe and maintains proper responsiveness:

  • The component has separate mobile and desktop views with different styling
  • The change only affects the desktop preview mode for link surveys
  • No conflicting responsive classes found in the component
  • The width increase from 28rem to 32rem is moderate and won't cause layout issues
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for responsive classes that might conflict with max-w-lg
rg "max-w-\w+" --type tsx

Length of output: 55


Script:

#!/bin/bash
# Search for responsive classes that might conflict with max-w-lg, using correct file extension
rg "max-w-\w+" --type ts --type tsx --type jsx --type js

Length of output: 86


Script:

#!/bin/bash
# Search for responsive classes that might conflict with max-w-lg, without file type filtering
rg "max-w-\w+"

Length of output: 56558


Script:

#!/bin/bash
# Search for mobile-specific classes in PreviewSurvey component
rg -A 5 -B 5 "className=.*mobile.*|className=.*sm:|className=.*md:|className=.*lg:" packages/ui/components/PreviewSurvey/

Length of output: 123

@jobenjada jobenjada self-requested a review November 12, 2024 01:50
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.

looks good :)

@jobenjada jobenjada enabled auto-merge November 12, 2024 02:06
@jobenjada jobenjada added this pull request to the merge queue Nov 12, 2024
Merged via the queue into main with commit c450c35 Nov 12, 2024
@jobenjada jobenjada deleted the increase-card-size branch November 12, 2024 02:28
@coderabbitai coderabbitai bot mentioned this pull request Nov 13, 2024
12 tasks
@coderabbitai coderabbitai bot mentioned this pull request Dec 4, 2024
12 tasks
@coderabbitai coderabbitai bot mentioned this pull request Dec 18, 2024
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🕹️] Increase card size for link surveys

2 participants