-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Added Settings Modal #342
Added Settings Modal #342
Conversation
- Improved the UI of the `Input` and `Message` components. - Added a `Settings` button to the `NavLinks` component. - Introduced a `Settings` component to handle user settings. - Refactored the `Dialog` component for consistency.
This commit removes the Dark Mode component from the navigation bar and replaces it with a theme selection dropdown menu in the Settings dialog. The implementation of the theme selection feature includes a function that allows the user to set the theme based on the system, light, or dark mode.
This commit adds a new state variable to keep track of whether the auto theme is enabled or not. It also registers an event listener to update the theme based on system preference changes. The event listener is removed when the component is unmounted.
- Create `selectedOption` state to track user-selected theme - Remove unused `isAutoTheme` state variable
This commit adds an SVG icon to the settings gear in the Navigation component's Settings file. The new SVG icon replaces the previous GearIcon component.
This commit updates the background color of the overlay in the AlertDialog and Dialog components by changing the classes applied to the elements. The new color is a transition from `bg-black/50 backdrop-blur-sm` to `bg-gray-500/90 dark:bg-gray-800/90`. This change improves the readability of the dialog boxes.
The ThemeContext now includes a "system" theme and ClearConvos no longer relies on the "selected option" state to update the theme. The bug is now fixed if the system theme changes.
Adjusted the color scheme of the DialogTemplate component to dark mode, updated the background color to gray-900 and removed unnecessary classes.
… convos This commit refactors the code by adding a confirmation dialog to prompt for a user's confirmation before clearing all conversations in the Settings.jsx file. The change ensures the user is aware of the irreversible action before initiating the clearConvos function. Additionally, the commit updates the clear chat button's class name and changes the button's onClick logic to call the confirmClearConvos function instead of directly invoking the clearConvos method.
- Changed component name from ClearConvos to Settings to support potential future use cases.
This commit optimizes the conversation clearing functionality in the `Settings.jsx` component by removing the `confirmClearConvos` function and directly calling the `clearConvos` function on confirmation. This change will simplify the code and improve the user experience.
Simplify Input component styles by simplifying the gradient background, removing border color styles, and updating button styles.
@danny-avila I have added a description and I'm working on unit tests |
This commit adds an e2e test to verify whether the Settings modal is displayed on the landing page. It uses a headless browser to navigate to the page and interacts with it to verify if the dialog and its components are visible.
Add Navigation and Settings tests to verify that the navigation bar and Settings button are visible and that the Settings modal displays the expected content. The settings modal verification includes checking whether the modal is visible, if the modal title, tab list, clear conversation button and theme are present, and if the theme option can be selected to change the mode.
Adding confirmation modal to prevent accidentally clearing conversations. Before, once you clicked on the "Clear" button it immediately clears all conversations. With this change, if you click on "Clear" the first time, it will change the text to "Confirm Clear" and if you click it again, it will clear all conversations.
The code introduced click functionality to the nav bar and improved the user interface. It also used the new theme select feature to change the theme to dark.
Refactor the test for Navigation suite to check for the 'dark' class in the HTML element when the 'dark' theme is selected in the modal. This ensures that the dark mode theme change works correctly, and improves test coverage.
This commit improves code clarity and adds more detailed test assertions to the navigation suite. New assert statements are added to check whether the modal theme selection changes the theme and that the HTML element receives the 'dark' class. A new function `changeMode` was introduced to avoid code repetition. A short description was added to the commit message to adhere to best practices.
This commit improves code clarity and adds more detailed test assertions to the navigation suite. New assert statements are added to check whether the modal theme selection changes the theme and that the HTML element receives the 'dark' class. A new function `changeMode` was introduced to avoid code repetition. A short description was added to the commit message to adhere to best practices.
- Update Conversation component to improve UX - Changed styling for group hover effect using shades of gray - Improved color contrast of the Message component for easy readability - Replaced class names in buildTree.js with a new class name - Added a new color theme (gray-1000) in tailwind.config to replace an old background color.
…ter user experience - The `EndpointItem` component now accepts an `isSelected` prop instead of `onSelect` to better reflect its usage in `EndpointItems` and `NewConversationMenu`. - `EndpointItems` component now has a `selectedEndpoint` prop to highlight the selected item in the list. - `NewConversationMenu` now has a gap between the endpoint options to improve user experience.
You changed 17 files and I only see tests for 2 files. Please make one for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
I see that Dannya has commented that you should perform tests for all files. After that, I can check your PR again.
@techwithanirudh
Tests are not required for all of the files except NewConversationMenu which was done in the latest commit. |
In the UI, when the user selects an endpoint, the active class is now properly set. In the error handling function, `isJson` is now a private function called by `getError`, which provides better parsing of error messages, and returns more succinct messages upon encountering specific errors. Finally, a new end-to-end test has been added to check if the active class is properly set on selecting an endpoint in the new conversation menu.
In the Landing spec, test the functionality to create conversations and check that the number of items has increased. In the Popup spec, change the path of the Auth JSON used by the context.
@danny-avila Any updates? |
Sorry for the delay. I'm testing now |
Some of your tests are failing.
Instead of using |
Thanks for writing tests! |
* Improve UI with style changes and add Settings button - Improved the UI of the `Input` and `Message` components. - Added a `Settings` button to the `NavLinks` component. - Introduced a `Settings` component to handle user settings. - Refactored the `Dialog` component for consistency. * Revert not needed changes * Updated style.css to only work for select * feat: Remove Dark Mode component and add theme selection feature This commit removes the Dark Mode component from the navigation bar and replaces it with a theme selection dropdown menu in the Settings dialog. The implementation of the theme selection feature includes a function that allows the user to set the theme based on the system, light, or dark mode. * Add auto theme setting to Settings component. This commit adds a new state variable to keep track of whether the auto theme is enabled or not. It also registers an event listener to update the theme based on system preference changes. The event listener is removed when the component is unmounted. * Improve user experience by allowing customized themes - Create `selectedOption` state to track user-selected theme - Remove unused `isAutoTheme` state variable * feat(Nav): Add SVG icon to settings gear This commit adds an SVG icon to the settings gear in the Navigation component's Settings file. The new SVG icon replaces the previous GearIcon component. * refactor(ui): Update overlay background color This commit updates the background color of the overlay in the AlertDialog and Dialog components by changing the classes applied to the elements. The new color is a transition from `bg-black/50 backdrop-blur-sm` to `bg-gray-500/90 dark:bg-gray-800/90`. This change improves the readability of the dialog boxes. * Refactor ThemeContext to include system theme and fix bug in Settings The ThemeContext now includes a "system" theme and ClearConvos no longer relies on the "selected option" state to update the theme. The bug is now fixed if the system theme changes. * Refactor DialogTemplate styles and color scheme Adjusted the color scheme of the DialogTemplate component to dark mode, updated the background color to gray-900 and removed unnecessary classes. * Refactor: Change button logic to require confirmation before clearing convos This commit refactors the code by adding a confirmation dialog to prompt for a user's confirmation before clearing all conversations in the Settings.jsx file. The change ensures the user is aware of the irreversible action before initiating the clearConvos function. Additionally, the commit updates the clear chat button's class name and changes the button's onClick logic to call the confirmClearConvos function instead of directly invoking the clearConvos method. * Refactor component name to reflect functionality change. - Changed component name from ClearConvos to Settings to support potential future use cases. * Refactor conversation clearing functionality in `Settings.jsx` This commit optimizes the conversation clearing functionality in the `Settings.jsx` component by removing the `confirmClearConvos` function and directly calling the `clearConvos` function on confirmation. This change will simplify the code and improve the user experience. * Refactor Input component UI styles Simplify Input component styles by simplifying the gradient background, removing border color styles, and updating button styles. * feat: Add e2e test for Settings modal This commit adds an e2e test to verify whether the Settings modal is displayed on the landing page. It uses a headless browser to navigate to the page and interacts with it to verify if the dialog and its components are visible. * test: Add Navigation and Settings tests Add Navigation and Settings tests to verify that the navigation bar and Settings button are visible and that the Settings modal displays the expected content. The settings modal verification includes checking whether the modal is visible, if the modal title, tab list, clear conversation button and theme are present, and if the theme option can be selected to change the mode. * Quick fix * feat(navbar): Add confirmation before clearing conversations Adding confirmation modal to prevent accidentally clearing conversations. Before, once you clicked on the "Clear" button it immediately clears all conversations. With this change, if you click on "Clear" the first time, it will change the text to "Confirm Clear" and if you click it again, it will clear all conversations. * Add click functionality to the navigation bar and improve UI design The code introduced click functionality to the nav bar and improved the user interface. It also used the new theme select feature to change the theme to dark. * test: Add test for dark mode theme change Refactor the test for Navigation suite to check for the 'dark' class in the HTML element when the 'dark' theme is selected in the modal. This ensures that the dark mode theme change works correctly, and improves test coverage. * Improve navigation test clarity This commit improves code clarity and adds more detailed test assertions to the navigation suite. New assert statements are added to check whether the modal theme selection changes the theme and that the HTML element receives the 'dark' class. A new function `changeMode` was introduced to avoid code repetition. A short description was added to the commit message to adhere to best practices. * Improve navigation test clarity This commit improves code clarity and adds more detailed test assertions to the navigation suite. New assert statements are added to check whether the modal theme selection changes the theme and that the HTML element receives the 'dark' class. A new function `changeMode` was introduced to avoid code repetition. A short description was added to the commit message to adhere to best practices. * Hotfix * Removed repetation * Refactor: Change text-gray-400 to text-white/50 to make tailwind more cleaner * style: Update CSS classes to improve the conversation UI - Update Conversation component to improve UX - Changed styling for group hover effect using shades of gray - Improved color contrast of the Message component for easy readability - Replaced class names in buildTree.js with a new class name - Added a new color theme (gray-1000) in tailwind.config to replace an old background color. * Refactor EndpointItem, EndpointItems, and NewConversationMenu for better user experience - The `EndpointItem` component now accepts an `isSelected` prop instead of `onSelect` to better reflect its usage in `EndpointItems` and `NewConversationMenu`. - `EndpointItems` component now has a `selectedEndpoint` prop to highlight the selected item in the list. - `NewConversationMenu` now has a gap between the endpoint options to improve user experience. * Added error messages * refactor: Improve endpoint menu highlighting and error handling In the UI, when the user selects an endpoint, the active class is now properly set. In the error handling function, `isJson` is now a private function called by `getError`, which provides better parsing of error messages, and returns more succinct messages upon encountering specific errors. Finally, a new end-to-end test has been added to check if the active class is properly set on selecting an endpoint in the new conversation menu. * test: Add Conversation and Change Path of Auth JSON In the Landing spec, test the functionality to create conversations and check that the number of items has increased. In the Popup spec, change the path of the Auth JSON used by the context. * Fixed logo issues * Make everything not rounded * Added time --------- Co-authored-by: Danny Avila <110412045+danny-avila@users.noreply.github.com>
Pull Request Description: Adding a Settings Modal to the ChatGPT UI
This Pull Request introduces a significant enhancement to the ChatGPT clone by incorporating a new Settings Modal. The purpose of this update is to provide users with more control and customization options, ensuring a tailored conversational experience.
Key Changes:
Settings Modal Integration: I have added a fully functional Settings Modal to the ChatGPT UI, enabling users to personalize their interactions with the AI model. This modal acts as a central hub for various customizable options.
Playwright Testing: I have thoroughly tested the new feature using Playwright, an end-to-end testing framework. This approach ensures comprehensive testing of the feature's functionality, interactions, and visual components. Throughout the Playwright testing process, no issues or errors were encountered, indicating a stable and error-free implementation.
UI Consistency: To maintain visual coherence and align with the existing ChatGPT UI, I have replaced the constant background color values (e.g., bg-[#...]) with colors from the Tailwind CSS library. This change ensures a consistent and standardized color scheme throughout the application.
Selected Endpoint Styling: As part of this Pull Request, I have added a selected background color to indicate when an endpoint is selected. This visual cue enhances the usability of the UI and provides clear feedback to the user.
Endpoint Spacing: In order to improve readability and visual separation between endpoints, I have introduced spacing between them. This change helps users distinguish between different endpoints more easily.
These modifications enhance the ChatGPT clone's versatility and user-friendliness, empowering users to customize their conversations and adapt the AI model to their specific needs. By integrating the Settings Modal, we aim to provide a more immersive and personalized conversational experience.
I am confident that this Pull Request, with Playwright testing and other improvements, will positively impact the overall user satisfaction and make the ChatGPT clone an even more powerful tool for various applications.