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(workspace): ui #192

Closed
wants to merge 26 commits into from
Closed

feat(workspace): ui #192

wants to merge 26 commits into from

Conversation

kriptonian1
Copy link
Contributor

@kriptonian1 kriptonian1 commented Apr 24, 2024

User description

Description

Give a summary of the change that you have made

Fixes #[ISSUENO]

Dependencies

Mention any dependencies/packages used

Future Improvements

Mention any improvements to be done in future related to any file/feature

Mentions

Mention and tag the people

Screenshots of relevant screens

Add screenshots of relevant screens

Developer's checklist

  • My PR follows the style guidelines of this project
  • I have performed a self-check on my work

If changes are made in the code:

  • I have followed the coding guidelines
  • My changes in code generate no new warnings
  • My changes are breaking another fix/feature of the project
  • I have added test cases to show that my feature works
  • I have added relevant screenshots in my PR
  • There are no UI/UX issues

Documentation Update

  • This PR requires an update to the documentation at docs.keyshade.xyz
  • I have made the necessary updates to the documentation, or no documentation changes are required.

Type

enhancement


Description

  • Implemented a comprehensive update to the workspace application, introducing a variety of new UI components and pages.
  • Added new SVGs for enhanced visual elements across authentication and dashboard pages.
  • Developed key components like Navbar, Sidebar, and ProjectCard for improved navigation and user interaction.
  • Introduced new pages for account details, OTP verification, and inviting teammates, enhancing the authentication flow.

Changes walkthrough

Relevant files
Enhancement
12 files
layout.tsx
Implement Main Layout Structure with Sidebar and Navbar   

apps/workspace/app/(main)/layout.tsx

  • Added imports for Navbar and Sidebar components.
  • Created a new AppLayout component with a main layout structure
    incorporating Sidebar and Navbar.
  • +18/-0   
    page.tsx
    Add Main Page Layout with Project Cards                                   

    apps/workspace/app/(main)/page.tsx

  • Added import for ProjectCard component.
  • Created a new Index function component for the main page layout
    displaying project cards.
  • +13/-0   
    page.tsx
    Create Account Details Page with Form Inputs                         

    apps/workspace/app/auth/account-details/page.tsx

  • Added imports for various UI components and SVGs.
  • Created a new AuthDetailsPage component for account details with input
    fields and a verification button.
  • +50/-0   
    page.tsx
    Implement Teammate Invitation Page                                             

    apps/workspace/app/auth/invite/page.tsx

  • Added imports for UI components and SVGs.
  • Implemented an AuthDetailsPage component for inviting teammates with
    email input and invite functionality.
  • +88/-0   
    page.tsx
    Add OTP Verification Page                                                               

    apps/workspace/app/auth/otp/page.tsx

  • Added imports for UI components and SVGs.
  • Created an AuthOTPPage component for OTP verification with a dynamic
    OTP input field.
  • +51/-0   
    page.tsx
    Redesign Authentication Page with Social Logins                   

    apps/workspace/app/auth/page.tsx

  • Updated imports and added new SVG imports.
  • Redesigned the AuthPage to include social login buttons and a sign-in
    form.
  • +37/-6   
    index.ts
    Export New SVGs for Authentication Pages                                 

    apps/workspace/public/svg/auth/index.ts

    • Added exports for KeyshadeBigSVG, GoogleSVG, and GithubSVG.
    +5/-0     
    index.ts
    Export New SVGs for Dashboard Components                                 

    apps/workspace/public/svg/dashboard/index.ts

    • Added exports for EnvironmentSVG, ConfigSVG, and SecretSVG.
    +5/-0     
    index.ts
    Export Shared SVG Components                                                         

    apps/workspace/public/svg/shared/index.ts

  • Added exports for various SVG components used across the application.
  • +17/-0   
    index.tsx
    Implement Project Card Component with Interactive Elements

    apps/workspace/src/components/dashboard/projectCard/index.tsx

  • Added imports for SVGs and Menubar components.
  • Created a ProjectCard component with interactive elements for project
    management.
  • +58/-0   
    index.tsx
    Add Navbar with Search and Account Management                       

    apps/workspace/src/components/shared/navbar/index.tsx

  • Added imports for various icons and UI components.
  • Implemented a Navbar component with search functionality and user
    account management options.
  • +132/-0 
    index.tsx
    Create Sidebar with Navigation and Project Selection         

    apps/workspace/src/components/shared/sidebar/index.tsx

  • Added imports for SVGs and a Combobox component.
  • Created a Sidebar component with navigation links and a user interface
    for selecting projects.
  • +56/-0   

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    @codiumai-pr-agent-free codiumai-pr-agent-free bot added the type: enhancement New feature or request label Apr 24, 2024
    Copy link
    Contributor

    PR Description updated to latest commit (124a33e)

    Copy link
    Contributor

    PR Review

    ⏱️ Estimated effort to review [1-5]

    4, because the PR introduces a significant amount of new UI components and pages, along with complex hooks like useRef and useEffect. The changes span multiple files and involve both state management and UI rendering logic, which requires a thorough review to ensure functionality and maintainability.

    🧪 Relevant tests

    No

    🔍 Possible issues

    Possible Bug: The use of 'use client' directive in multiple components without corresponding server-side handling might lead to hydration issues or mismatches in React.

    Performance Concern: The extensive use of SVG imports and potentially large components might impact the loading time and performance, especially on lower-end devices.

    🔒 Security concerns

    No


    ✨ Review tool usage guide:

    Overview:
    The review tool scans the PR code changes, and generates a PR review which includes several types of feedbacks, such as possible PR issues, security threats and relevant test in the PR. More feedbacks can be added by configuring the tool.

    The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.

    • When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:
    /review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
    
    [pr_reviewer]
    some_config1=...
    some_config2=...
    

    See the review usage page for a comprehensive guide on using this tool.

    Copy link
    Contributor

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Enhancement
    Improve type safety and developer experience by using more specific prop types.

    Consider using a more specific type than React.ComponentPropsWithoutRef for the component
    props to ensure type safety and better developer experience with autocomplete and type
    checking.

    apps/workspace/src/components/ui/menubar.tsx [18]

    -React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>
    +MenubarPrimitive.RootProps
     
    Replace hardcoded emoji with an icon component for better accessibility.

    Replace the hardcoded emoji with a proper icon component or SVG for better accessibility
    and consistency across different platforms and browsers.

    apps/workspace/src/components/ui/combobox.tsx [63]

    -🔥
    +<FireIcon />
     
    Simplify conditional rendering with a ternary operator.

    Use a ternary operator to conditionally render the 'Select framework...' placeholder to
    simplify the JSX structure.

    apps/workspace/src/components/ui/combobox.tsx [58-60]

    -{/* {value
    -  ? frameworks.find((framework) => framework.value === value)?.label
    -  : 'Select framework...'} */}
    +{value ? frameworks.find(framework => framework.value === value)?.label : 'Select framework...'}
     
    Improve code readability by destructuring props directly.

    Consider destructuring props directly in the function parameter to improve readability and
    reduce redundancy.

    apps/workspace/src/components/ui/avatar.tsx [8]

    -({ className, ...props }, ref) => (
    +({ className, ...otherProps }, ref) => (
     
    Improve accessibility by adding alt attributes and appropriate roles.

    Ensure accessibility by adding alt attributes to images and appropriate roles or labels to
    fallback content.

    apps/workspace/src/components/ui/avatar.tsx [24]

     <AvatarPrimitive.Image
    +  alt="User avatar"
     
    Best practice
    Improve code readability and conciseness by using parameter destructuring.

    Use destructuring directly in the function parameter to clean up the code and improve
    readability.

    apps/workspace/src/components/ui/menubar.tsx [51]

    -({ className, ...props }, ref) => (
    +({ className, children, inset, ...props }, ref) => (
     
    Improve application stability by adding error boundaries.

    Consider adding error boundaries around components to gracefully handle potential runtime
    errors in the component tree.

    apps/workspace/src/components/ui/menubar.tsx [20]

    -<MenubarPrimitive.Root
    +<ErrorBoundary>
    +  <MenubarPrimitive.Root
    +</ErrorBoundary>
     
    Enhance type specificity for better type safety and clarity.

    Use a more specific type than React.JSX.Element for function return types to enhance type
    safety and clarity in the codebase.

    apps/workspace/src/components/ui/command.tsx [28]

     function CommandDialog({
       children,
       ...props
    -}: CommandDialogProps): React.JSX.Element {
    +}: CommandDialogProps): JSX.Element {
     
    Replace inline styles with CSS class names for better consistency.

    Avoid using inline styles for padding and margins to maintain consistency and reusability
    of CSS classes across the application.

    apps/workspace/src/components/ui/combobox.tsx [54]

    -className="flex items-center justify-between rounded-xl border border-white/10 bg-[#161819] px-[0.6875rem] py-[0.8125rem]"
    +className="flex items-center justify-between rounded-xl border border-white/10 bg-dark px-md py-sm"
     
    Enhance type safety and clarity by adding explicit type annotations.

    Use explicit type annotations for the Avatar, AvatarImage, and AvatarFallback components
    to improve type safety and code clarity.

    apps/workspace/src/components/ui/avatar.tsx [5]

    -const Avatar = React.forwardRef<
    +const Avatar: React.ForwardRefExoticComponent<React.PropsWithoutRef<React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>> & React.RefAttributes<HTMLElement>> = React.forwardRef<
     
    Maintainability
    Enhance maintainability by using constants for CSS class names.

    Avoid using magic strings for CSS classes and consider defining them as constants or using
    a theme object to ensure consistency and ease of maintenance.

    apps/workspace/src/components/ui/menubar.tsx [22]

    -'flex h-10 items-center space-x-1 rounded-md border border-zinc-200 bg-white p-1 dark:border-zinc-800 dark:bg-zinc-950'
    +const menuBarRootClasses = 'flex h-10 items-center space-x-1 rounded-md border border-zinc-200 bg-white p-1 dark:border-zinc-800 dark:bg-zinc-950';
     
    Simplify JSX and enhance readability by refactoring conditional class logic.

    Refactor the conditional class logic into a utility function to simplify the component's
    JSX and enhance readability.

    apps/workspace/src/components/ui/menubar.tsx [55]

    -inset && 'pl-8',
    +getInsetClass(inset)
     
    Simplify complex CSS selectors to enhance maintainability.

    Replace the complex CSS selector string with a simpler, more maintainable approach or
    consider using CSS modules or styled-components for better scalability and readability.

    apps/workspace/src/components/ui/command.tsx [32]

    -<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-zinc-500 dark:[&_[cmdk-group-heading]]:text-zinc-400 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
    +<Command className={commandClassNames}>
     
    Refactor complex conditional classNames for clarity and maintainability.

    Refactor the complex conditional classNames to use a function or custom hook that returns
    the appropriate classNames based on the component's state.

    apps/workspace/src/components/ui/dialog.tsx [36-37]

    -className={cn(
    -  'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-white/10 bg-white/10 p-6 shadow-lg duration-200 sm:rounded-lg dark:border-zinc-800 dark:bg-zinc-950',
    -  className
    -)}
    +className={dialogContentClassNames()}
     
    Use map function to dynamically generate CommandItem components.

    Consider using a map function to generate CommandItem components dynamically from an array
    of items to reduce redundancy and improve maintainability.

    apps/workspace/src/components/ui/combobox.tsx [78-82]

     <CommandGroup>
    -  <CommandItem>Calendar</CommandItem>
    -  <CommandItem>Search Emoji</CommandItem>
    -  <CommandItem>Calculator</CommandItem>
    +  {['Calendar', 'Search Emoji', 'Calculator'].map(item => (
    +    <CommandItem key={item}>{item}</CommandItem>
    +  ))}
     </CommandGroup>
     
    Accessibility
    Improve accessibility by adding aria-label and role to interactive elements.

    Consider using a more descriptive aria-label or role for accessibility on interactive
    elements, especially for complex UI components like command inputs.

    apps/workspace/src/components/ui/command.tsx [50-57]

     <CommandPrimitive.Input
    +  aria-label="Command Input"
    +  role="textbox"
       className={cn(
         'flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-zinc-500 disabled:cursor-not-allowed disabled:opacity-50 dark:placeholder:text-zinc-400',
         className
       )}
       ref={ref}
       {...props}
     />
     
    Improve button accessibility with a descriptive aria-label.

    Use a more descriptive aria-label for the button to improve accessibility and help screen
    reader users understand the button's purpose.

    apps/workspace/src/components/ui/combobox.tsx [51-57]

     <button
       aria-controls="popover-content"
       aria-expanded={open}
    +  aria-label="Toggle framework selection"
       className="flex items-center justify-between rounded-xl border border-white/10 bg-[#161819] px-[0.6875rem] py-[0.8125rem]"
       role="combobox"
       type="button"
     >
     
    Performance
    Simplify animation handling in className for better performance and maintainability.

    Avoid using complex chained animations in className for better performance and
    maintainability. Consider using a dedicated animation library or CSS module.

    apps/workspace/src/components/ui/dialog.tsx [19-22]

    -className={cn(
    -  'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0  fixed inset-0 z-50 bg-black/80',
    -  className
    -)}
    +className={overlayClassNames}
     
    Optimize class name concatenation by using a utility function.

    Replace the repeated usage of className concatenation with a utility function to handle
    conditional class names more efficiently.

    apps/workspace/src/components/ui/avatar.tsx [10]

    -className={cn(
    +className={cn([
     
    Enhance performance by memoizing frequently used components.

    Use memoization for components to avoid unnecessary re-renders and enhance performance,
    especially for components that are likely to be used frequently in the application.

    apps/workspace/src/components/ui/avatar.tsx [5]

    -const Avatar = React.forwardRef<
    +const Avatar = React.memo(React.forwardRef<
     

    ✨ Improve tool usage guide:

    Overview:
    The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.

    • When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:
    /improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...
    
    [pr_code_suggestions]
    some_config1=...
    some_config2=...
    

    See the improve usage page for a comprehensive guide on using this tool.

    @kriptonian1 kriptonian1 requested a review from rajdip-b as a code owner April 24, 2024 06:18
    @kriptonian1 kriptonian1 changed the title Workspace feat(workspace): ui Apr 24, 2024
    @kriptonian1 kriptonian1 requested review from a team and removed request for a team April 30, 2024 04:54
    @kriptonian1 kriptonian1 marked this pull request as draft May 5, 2024 13:57
    Copy link

    sonarqubecloud bot commented May 6, 2024

    Quality Gate Failed Quality Gate failed

    Failed conditions
    C Reliability Rating on New Code (required ≥ A)
    17 New Code Smells (required ≤ 5)

    See analysis details on SonarCloud

    Catch issues before they fail your Quality Gate with our IDE extension SonarLint

    @rajdip-b rajdip-b closed this May 18, 2024
    @rajdip-b rajdip-b deleted the workspace branch May 18, 2024 10:17
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    type: enhancement New feature or request
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    8 participants