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: Added support to sidebar #2119

Merged
merged 25 commits into from
Oct 2, 2024

Conversation

harshsbhat
Copy link
Contributor

@harshsbhat harshsbhat commented Sep 20, 2024

What does this PR do?

Fixes #2095

Adds the support options to side bar

image

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 requires a documentation update

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read Contributing Guide
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand areas
  • Ran pnpm build
  • Ran pnpm fmt
  • 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

Appreciated

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

Summary by CodeRabbit

  • New Features
    • Introduced a Discord navigation item in the sidebar for easy access.
    • Added a Feedback dialog component for users to report issues directly from the dashboard.
  • Enhancements
    • Expanded the types of icons that can be used in the sidebar navigation.
    • Streamlined the feedback process by integrating feedback directly into the command menu.
    • Simplified feedback submission with a new FeedbackCommand component.
    • Improved user experience with toast notifications for feedback submission outcomes.

Copy link

changeset-bot bot commented Sep 20, 2024

⚠️ No Changeset found

Latest commit: 41dffeb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Sep 20, 2024

@harshsbhat is attempting to deploy a commit to the Unkey Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Sep 20, 2024

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes introduce a new DiscordIcon component and modify the NavItem type to support a broader range of icons. A "Discord" navigation item is added to the sidebar, along with a new Feedback component for user feedback. Additionally, a new file for the feedback dialog component is created, which includes form validation and submission handling for reporting issues within the dashboard application.

Changes

Files Change Summary
apps/dashboard/app/(app)/desktop-sidebar.tsx Added DiscordIcon component, updated NavItem type to accept React.ElementType, added "Discord" navigation item, and included <Feedback /> component in the sidebar.
apps/dashboard/components/dashboard/command-menu.tsx Removed Feedback component and its logic, added FeedbackCommand component for simplified feedback interaction.
apps/dashboard/components/dashboard/feedback-component.tsx Introduced a feedback dialog component with form handling, validation using Zod, and TRPC mutation for submitting feedback.

Assessment against linked issues

Objective Addressed Explanation
Add Discord + Support to the left navigation (#2095)
Improve visibility of support features (#2095)

Possibly related PRs

Suggested reviewers

  • mcstepp
  • perkinsjr
  • chronark

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.

Copy link
Contributor

github-actions bot commented Sep 20, 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: 0

Outside diff range and nitpick comments (3)
apps/dashboard/components/dashboard/feedback-component.tsx (3)

1-22: Looks good! Consider grouping the imports for better readability.

The imports are correctly used and cover all the necessary dependencies. However, consider grouping them based on their origin (e.g., separate groups for @/components, @/lib, external libraries) to improve readability.


23-53: The component logic is well-structured. Consider adding error handling for the trpc mutation.

The component manages the dialog state and form handling correctly. The usage of react-hook-form and zod for form validation is a good practice.

However, consider adding error handling for the trpc mutation to handle potential network or server errors gracefully. You can use the onError callback of the useMutation hook to display an error message to the user.


55-157: The JSX is properly structured. Consider extracting the form fields into separate components.

The JSX correctly renders the feedback dialog and form. The usage of custom UI components enhances the consistency and reusability of the code.

However, the form fields (issueType, severity, message) are quite verbose and contain similar logic. Consider extracting them into separate components (e.g., IssueTypeField, SeverityField, MessageField) to improve maintainability and reduce duplication.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2d99e07 and acba9f7.

Files selected for processing (2)
  • apps/dashboard/app/(app)/desktop-sidebar.tsx (5 hunks)
  • apps/dashboard/components/dashboard/feedback-component.tsx (1 hunks)
Additional comments not posted (5)
apps/dashboard/app/(app)/desktop-sidebar.tsx (5)

2-2: LGTM!

The import statement for the Feedback component is correctly added.


41-41: LGTM!

The modification to the icon property in the NavItem type is a good change. It allows using custom React components as icons, providing more flexibility in the sidebar navigation.


50-65: LGTM!

The DiscordIcon component is correctly implemented as a functional component. The SVG code for the Discord logo is properly included, and the component can be used in other parts of the codebase.


148-153: LGTM!

The "Discord" navigation item is correctly added to the resourcesNavigation array. It uses the DiscordIcon component as the icon and links to the external Discord URL. The external property is properly set to true to open the link in a new tab.


202-204: LGTM!

The Feedback component is correctly included as a list item within the "Resources" section of the sidebar. This provides users with convenient access to the feedback functionality.

@harshsbhat
Copy link
Contributor Author

I have created a new component for the sidebar because it was not allowing me to use CommandItem outside the Commands. Or even use the div in CommandGroup

Copy link
Collaborator

@chronark chronark left a comment

Choose a reason for hiding this comment

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

CleanShot 2024-09-23 at 10 25 04@2x
The docs look weird now cause it's no longer a single icon that tells the user it'll open a new tab.

Let's use Book or BookOpen instead to blend in

apps/dashboard/components/dashboard/feedback-component.tsx Outdated Show resolved Hide resolved
@chronark chronark self-assigned this Sep 23, 2024
@harshsbhat
Copy link
Contributor Author

@chronark I have pushed the requested changes for this one too

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 (2)
apps/dashboard/components/dashboard/command-menu.tsx (2)

10-10: Consider removing unnecessary React import

The explicit import of React on line 12 may not be necessary if you're using a modern React setup with the new JSX transform. This transform allows you to use JSX without importing React in scope.

If you're using React 17 or later with a compatible build setup, you can safely remove this line:

-import React from "react";

However, ensure that your project is configured to use the new JSX transform before making this change.

Also applies to: 12-13


90-96: LGTM: FeedbackCommand implementation

The FeedbackCommand component is implemented correctly, integrating the FeedbackComponent within a CommandItem. This aligns with the PR objectives of improving support accessibility.

Consider making the component more flexible by accepting props:

-const FeedbackCommand: React.FC = () => {
+const FeedbackCommand: React.FC<{ variant?: string }> = ({ variant = 'command' }) => {
   return (
     <CommandItem>
-      <FeedbackComponent variant="command" />
+      <FeedbackComponent variant={variant} />
     </CommandItem>
   );
 };

This change would allow for easier customization if needed in the future.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between acba9f7 and 4564e47.

📒 Files selected for processing (3)
  • apps/dashboard/app/(app)/desktop-sidebar.tsx (5 hunks)
  • apps/dashboard/components/dashboard/command-menu.tsx (3 hunks)
  • apps/dashboard/components/dashboard/feedback-component.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/dashboard/app/(app)/desktop-sidebar.tsx
  • apps/dashboard/components/dashboard/feedback-component.tsx
🔇 Additional comments not posted (2)
apps/dashboard/components/dashboard/command-menu.tsx (2)

43-43: LGTM: FeedbackCommand added to Help group

The addition of the FeedbackCommand to the Help group in the CommandMenu aligns well with the PR objectives. This change improves user accessibility to support features, making them more prominent and easier to find.


Line range hint 1-96: Verify impact of simplified feedback mechanism

The changes have significantly simplified the feedback collection process by removing the complex Feedback component (with dialog, form validation, and submission handling) in favor of the simpler FeedbackCommand. While this aligns with the PR objectives of improving support accessibility, it's important to ensure that this simplification doesn't negatively impact the quality of feedback collected or the user experience.

Could you provide more information on how the new FeedbackComponent handles the feedback collection process? Specifically:

  1. How is the feedback submitted now?
  2. Is there still form validation in place?
  3. How does this change impact the user experience when providing feedback?

To help verify the changes, please run the following script:

This will help ensure that all references to the old Feedback component have been updated and provide insight into the implementation of the new FeedbackComponent.

Copy link

vercel bot commented Sep 25, 2024

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

Name Status Preview Comments Updated (UTC)
dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 2, 2024 2:28pm
planetfall ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 2, 2024 2:28pm
play ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 2, 2024 2:28pm
workflows ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 2, 2024 2:28pm
www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 2, 2024 2:28pm

@chronark
Copy link
Collaborator

why not?
It's clickable in prod, where we only have the docs link right now, so this sounds like a regression within this PR

@harshsbhat
Copy link
Contributor Author

Yeah I know it's working in prod. I just wanted to update you that I am still working on it. So you don't accidentally keep cloning my branch it just to realise this error.

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

🧹 Outside diff range and nitpick comments (2)
apps/dashboard/components/dashboard/command-menu.tsx (2)

43-43: LGTM: FeedbackCommand added to Help group

The addition of <FeedbackCommand /> to the Help group in the CommandMenu is a good implementation of the PR objectives. It improves the accessibility of the support features as intended.

Consider adding a comment above the FeedbackCommand to briefly explain its purpose, which could be helpful for future maintenance. For example:

+ {/* Feedback option for users to report issues or provide suggestions */}
<FeedbackCommand />

Line range hint 1-96: Overall implementation aligns well with PR objectives

The changes in this file successfully address the PR objectives of improving support accessibility in the sidebar. Key points:

  1. The new FeedbackCommand component simplifies the feedback mechanism as intended.
  2. The addition of the feedback option to the Help group in the CommandMenu improves discoverability.
  3. The overall structure of the CommandMenu remains clean and maintainable.

These changes should effectively enhance user accessibility to support features, addressing the concerns raised in issue #2095.

To further improve the implementation, consider:

  1. Ensuring consistent prop naming conventions across components.
  2. Adding brief comments to explain the purpose of new components or significant changes.
  3. If not already done, update relevant documentation to reflect these new support options in the sidebar.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 429d205 and dc6183f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • apps/dashboard/app/(app)/desktop-sidebar.tsx (5 hunks)
  • apps/dashboard/components/dashboard/command-menu.tsx (3 hunks)
  • apps/dashboard/components/dashboard/feedback-component.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/dashboard/app/(app)/desktop-sidebar.tsx
  • apps/dashboard/components/dashboard/feedback-component.tsx
🔇 Additional comments (1)
apps/dashboard/components/dashboard/command-menu.tsx (1)

10-10: LGTM: Import statements updated correctly

The changes to the import statements are consistent with the new implementation of the feedback feature. The addition of BookOpen and LucideIcon imports, along with the FeedbackComponent, aligns well with the simplified feedback mechanism mentioned in the PR summary.

Also applies to: 12-13

@harshsbhat
Copy link
Contributor Author

Done. I think this is ready to review now. I have made all heights and widths consistent.

@harshsbhat
Copy link
Contributor Author

@chronark

You will probably need to submit the form to check if it is working I was not able to do so. As I don't have a Plain API key. It should work tbh. As I haven't made any other changes in the code other than styling

@chronark chronark added this pull request to the merge queue Oct 2, 2024
Merged via the queue into unkeyed:main with commit 527c6ae Oct 2, 2024
24 checks passed
harshsbhat added a commit to harshsbhat/unkey that referenced this pull request Oct 3, 2024
* Discord dark mode and fixing the link

* Requested changes

* Requested changes

* Lint

* Adding support to sidebar

* remove unused imports

* change the docs icon to book and remove repeating code

* Consistent size

* Making sure the Feedback is clickable, the feedback can be entered using the arrows and enter key on command

* Revert "Making sure the Feedback is clickable, the feedback can be entered using the arrows and enter key on command"

This reverts commit dc6183f.

* pnpm-lock file

* Fix

---------

Co-authored-by: Andreas Thomas <dev@chronark.com>
mcstepp pushed a commit that referenced this pull request Oct 8, 2024
* Discord dark mode and fixing the link

* Requested changes

* Requested changes

* Lint

* Adding support to sidebar

* remove unused imports

* change the docs icon to book and remove repeating code

* Consistent size

* Making sure the Feedback is clickable, the feedback can be entered using the arrows and enter key on command

* Revert "Making sure the Feedback is clickable, the feedback can be entered using the arrows and enter key on command"

This reverts commit dc6183f.

* pnpm-lock file

* Fix

---------

Co-authored-by: Andreas Thomas <dev@chronark.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Discord + Support to the left navigation
2 participants