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

fix: dark mode issues on form preview #301

Merged
merged 3 commits into from
Feb 1, 2024
Merged

Conversation

madassdev
Copy link
Collaborator

@madassdev madassdev commented Jan 31, 2024

Summary by CodeRabbit

  • Style
    • Enhanced form field visuals in dark mode for better user experience.

@madassdev madassdev requested a review from JhumanJ January 31, 2024 13:00
Copy link
Contributor

coderabbitai bot commented Jan 31, 2024

Walkthrough

The update introduces a conditional styling feature to the OpenFormField.vue component, enhancing its appearance for dark mode users. By checking the beingEdited state, the component now dynamically applies a dark mode-specific class (dark:bg-gray-800) in addition to its standard styling (bg-blue-50 rounded-md). This adjustment ensures a more visually appealing and user-friendly interface across different themes.

Changes

File Path Change Summary
.../open/forms/OpenFormField.vue Added a condition for dark mode to apply dark:bg-gray-800 class based on beingEdited state.
client/tailwind.config.js Adjusted safelist array, reformatted animation object, and modified plugin function for improved code style.

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>.
    • Generate unit-tests for this file.
  • 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 tests 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 generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between de3e2d6 and 977490a.
Files selected for processing (1)
  • client/components/open/forms/OpenFormField.vue (1 hunks)
Additional comments: 2
client/components/open/forms/OpenFormField.vue (2)
  • 233-233: The addition of the dark:bg-notion-dark-light class for dark mode support within the getFieldClasses method is a targeted and effective way to ensure form fields are styled appropriately in dark mode. This change directly addresses the PR's objective to fix dark mode issues on form preview by ensuring that the form fields are visually distinct and appealing in both light and dark modes. The use of Tailwind CSS classes for conditional styling is consistent with modern front-end development practices.
  • 230-236: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-355]

Overall, the OpenFormField.vue component is well-structured, making extensive use of Vue's composition API and computed properties to dynamically render form fields based on their type and state. The addition of dark mode support is seamlessly integrated into the existing logic without introducing any apparent issues or conflicts.

However, it's crucial to ensure that the new class addition does not inadvertently affect the layout or styling of form fields in scenarios not related to dark mode. It would be beneficial to conduct thorough testing across different browsers and devices to verify that the form fields maintain their intended appearance and functionality in both light and dark modes.

Additionally, consider documenting the rationale behind specific class choices (e.g., dark:bg-notion-dark-light) within the code or project documentation to aid future development and maintenance efforts.

Copy link
Owner

@JhumanJ JhumanJ left a comment

Choose a reason for hiding this comment

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

Hey @madassdev you forgot the 2nd part of this issue (file uploads)
image

@madassdev
Copy link
Collaborator Author

madassdev commented Jan 31, 2024

Initially I saw the issue, however as I tried to debug, i saw that the class for dark theme is correctly used in the element.
I did a hard refresh, and the issue was gone without having to change anything. (Weird)
Since then, I've not seen the issue again.
The file upload displays normally in dark theme when hovered. I couldn't find anything to debug.
Screenshot 2024-01-31 at 20 09 11

In editor preview:
Screenshot 2024-01-31 at 20 13 21

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 977490a and 4cc301c.
Files selected for processing (2)
  • client/components/open/forms/OpenFormField.vue (1 hunks)
  • client/tailwind.config.js (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • client/components/open/forms/OpenFormField.vue
Additional comments: 4
client/tailwind.config.js (4)
  • 15-15: The regex pattern for the safelist configuration is correctly formatted. However, ensure that the regex pattern is comprehensive and matches all intended classes. This is crucial for avoiding unintended side effects where certain classes might not get included in the final build due to Tailwind's purge mechanism.
  • 17-18: Adding 'dark:hover:bg-notion-dark-light' to the safelist is a good approach to ensure that this class is not purged by Tailwind CSS in production builds, especially since it's conditionally applied based on the dark mode and hover state. This change directly supports the PR's objective of fixing dark mode issues on form preview.
  • 30-31: The reformatting of the infinite-scroll keyframes for better readability is approved. However, ensure that this change has been tested across all browsers where the application is expected to run, as different browsers may have varying levels of support for CSS animations and keyframes.
  • 88-88: The modification in the plugin function to improve code style by adding spaces within the function declaration is a minor stylistic change that aligns with JavaScript's conventional coding standards. However, consistency across the entire file and project should be maintained. If this coding style is adopted here, ensure it is consistently applied throughout the project to maintain readability and code hygiene.

@JhumanJ JhumanJ merged commit cfac87f into main Feb 1, 2024
3 of 4 checks passed
@JhumanJ JhumanJ deleted the 67ca4-dark-mode-issue- branch February 1, 2024 13:37
JhumanJ added a commit that referenced this pull request Feb 1, 2024
* fix: dark mode issues on form preview

* Fix darkmode issues

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
JhumanJ added a commit that referenced this pull request Feb 1, 2024
Fix resize for all forms

crisp migration (#302)

Co-authored-by: Julien Nahum <julien@nahum.net>

fix console error (#304)

fix: dark mode issues on form preview (#301)

* fix: dark mode issues on form preview

* Fix darkmode issues

---------

Co-authored-by: Julien Nahum <julien@nahum.net>

Remove useless iframe attributes
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.

2 participants