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(frontend): landing page ui optimization #149

Merged
merged 6 commits into from
Mar 5, 2025

Conversation

PengyuChen01
Copy link
Collaborator

@PengyuChen01 PengyuChen01 commented Mar 4, 2025

Summary by CodeRabbit

  • New Features

    • Introduced new authentication modals that offer a smoother transition for signing in and creating an account.
    • Modified navigation interactions: one menu tab now shows a “Coming Soon” alert, and the sidebar logo has been updated to function as a clickable button for returning home.
  • Style

    • Adjusted form element sizing for improved responsiveness.
    • Refined success message notifications to appear at the bottom-right for clearer user feedback.

Copy link
Contributor

coderabbitai bot commented Mar 4, 2025

Walkthrough

This pull request introduces several UI and control flow modifications across the frontend. New modal components for sign-in and sign-up have been integrated into the authentication flow with added state management and delayed execution after modal closure. Additionally, routing enhancements have been applied by replacing certain navigational elements with buttons that utilize the router, and minor style adjustments have been made for improved responsiveness and layout. A GraphQL schema file was also tidied by streamlining comment formatting.

Changes

Files Change Summary
frontend/src/app/(main)/page.tsx
frontend/src/components/auth-choice-modal.tsx
frontend/src/components/sign-in-modal.tsx
Integrated SignIn and SignUp modals into the authentication flow. Added state variables to manage modal visibility, implemented a delay via setTimeout after modal closure, and updated toast notification configuration.
frontend/src/components/root/nav.tsx
frontend/src/components/sidebar.tsx
Modified navigation behavior: Changed "Codefox Journey" tab to display an alert instead of linking externally, and updated sidebar navigation to use a button with useRouter() for home redirection along with style adjustments.
frontend/src/components/root/prompt-form.tsx Adjusted the styling of the SelectTrigger by replacing a fixed width (w-[117px]) with a responsive min-w-max class.
frontend/src/graphql/schema.gql Streamlined the GraphQL schema comments: Changed a multiline comment for the Date scalar to a single line and removed an extra newline at the end of the User type declaration.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant A as AuthChoiceModal
    participant M as Modal (SignIn/SignUp)
    
    U->>A: Click "Sign In" or "Create Account" button
    A->>A: Trigger onClose to dismiss AuthChoiceModal
    A->>A: Start 100ms delay using setTimeout
    A->>M: Invoke respective sign in/up function after delay
    M-->>U: Display SignIn/SignUp Modal
Loading
sequenceDiagram
    participant U as User
    participant Nav as FloatingNavbar
    participant SB as ChatSideBar
    participant R as Next Router

    U->>Nav: Click "Codefox Journey" tab
    Nav-->>U: Alert "Coming Soon."

    U->>SB: Click Home button/logo
    SB->>R: Execute router.push('/')
    R-->>U: Navigate to Home Page
Loading

Possibly related PRs

Suggested reviewers

  • NarwhalChen

Poem

I'm a little rabbit with a code-filled delight,
Hopping through modals with transitions so light.
With timeouts and buttons, my journey's set right,
Navigating home in a blend of day and night.
Cheers to fresh routes and styles so bright! 🥕✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

frontend/src/app/(main)/page.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/frontend/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

frontend/src/components/root/nav.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/frontend/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

frontend/src/components/root/prompt-form.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/frontend/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

  • 4 others
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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 generate docstrings to generate docstrings for this 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.

@Sma1lboy Sma1lboy marked this pull request as ready for review March 5, 2025 02:35
Copy link
Owner

@Sma1lboy Sma1lboy left a comment

Choose a reason for hiding this comment

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

LGTM

@Sma1lboy Sma1lboy changed the title Feat/chat UI improvements feat(frontend): landing page ui optimization Mar 5, 2025
@Sma1lboy Sma1lboy merged commit f9cbbc9 into main Mar 5, 2025
2 of 4 checks passed
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

🧹 Nitpick comments (4)
frontend/src/components/root/prompt-form.tsx (1)

214-214: Improved responsive design with flexible width

Replacing the fixed width (w-[117px]) with min-w-max makes the component adapt to its content size, improving responsiveness and preventing text truncation.

For even better responsive behavior across different viewport sizes, consider using:

-'h-6 border-0 focus:ring-0 hover:bg-gray-100 dark:hover:bg-gray-600 pl-1 min-w-max',
+'h-6 border-0 focus:ring-0 hover:bg-gray-100 dark:hover:bg-gray-600 pl-1 min-w-max max-w-[200px] md:max-w-none',

This would ensure the component doesn't grow too large on small screens while still being flexible.

frontend/src/components/sidebar.tsx (2)

87-120: Consider refactoring button styling for better maintainability

The button styling contains many Tailwind classes that make it hard to maintain. Consider using the cn() utility (already imported) to organize styles or extract this into a reusable component.

<Button
  onClick={() => router.push('/')}
  variant="ghost"
-  className="
-    w-full
-    h-14
-    flex
-    items-center
-    justify-start
-    px-4
-    gap-2
-    text-sm
-    xl:text-lg
-    font-normal
-    rounded-md
-    hover:bg-yellow-50
-    transition-all
-    duration-200
-    ease-in-out
-  "
+  className={cn(
+    "w-full h-14 flex items-center justify-start px-4 gap-2",
+    "text-sm xl:text-lg font-normal rounded-md",
+    "hover:bg-yellow-50 transition-all duration-200 ease-in-out"
+  )}
>

69-74: Remove console.log statements before production

There's a console.log statement that should be removed before deploying to production. Consider using a logger that can be toggled based on environment.

-  console.log(
-    'ChatSideBar state: isCollapsed:',
-    isCollapsed,
-    'currentChatid:',
-    currentChatid
-  );
+  // Use a logger utility that can be disabled in production
+  // logger.debug('ChatSideBar state:', { isCollapsed, currentChatid });
frontend/src/app/(main)/page.tsx (1)

97-99: Consider extracting timeout duration as a constant

The timeout duration of 100ms is hardcoded in multiple places. Consider extracting this to a constant for better maintainability.

+ const MODAL_TRANSITION_DELAY = 100; // milliseconds

  onSignUpClick={() => {
    setShowAuthChoice(false);
    setTimeout(() => {
      setShowSignUp(true);
-   }, 100);
+   }, MODAL_TRANSITION_DELAY);
  }}
  onSignInClick={() => {
    setShowAuthChoice(false);
    setTimeout(() => {
      setShowSignIn(true);
-   }, 100);
+   }, MODAL_TRANSITION_DELAY);
  }}

Also applies to: 103-105

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7136304 and 631b3e1.

📒 Files selected for processing (7)
  • frontend/src/app/(main)/page.tsx (3 hunks)
  • frontend/src/components/auth-choice-modal.tsx (3 hunks)
  • frontend/src/components/root/nav.tsx (1 hunks)
  • frontend/src/components/root/prompt-form.tsx (1 hunks)
  • frontend/src/components/sidebar.tsx (4 hunks)
  • frontend/src/components/sign-in-modal.tsx (1 hunks)
  • frontend/src/graphql/schema.gql (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • frontend/src/graphql/schema.gql
🔇 Additional comments (11)
frontend/src/components/sign-in-modal.tsx (1)

46-48: Good UX enhancement for toast notification positioning

Adding position configuration to the toast improves user experience by ensuring notifications appear in a consistent location.

Consider standardizing this position for all toast notifications throughout the application to maintain UI consistency.

frontend/src/components/root/nav.tsx (2)

177-177: Feature placeholder effectively communicates upcoming functionality

Changing from opening a GitHub link to showing a "Coming Soon" alert clearly communicates to users that this feature is in development.


185-185:

❓ Verification inconclusive

Navigation positioning change impacts layout behavior

Removing the fixed class changes the navbar from being fixed at the top of the viewport to scrolling with the page content.

This change affects the overall user experience of navigation. Please verify that:

  1. This was an intentional design change
  2. The navbar remains accessible throughout the user journey
  3. It doesn't negatively impact mobile experience

🏁 Script executed:

#!/bin/bash
# Check if there are other navigation elements or if this is the primary navigation

# Look for other potential navigation elements in the codebase
echo "Checking for other navigation components:"
rg -l "nav|navbar|navigation" --type tsx --type jsx

Length of output: 174


Action Required: Verify Navigation Positioning Change

There is an intentional removal of the fixed class from the navbar (in frontend/src/components/root/nav.tsx at line 185), which changes its behavior from fixed to scrolling with the page content. Please perform the following manual checks:

  • Confirm that this design change is intentional.
  • Ensure the navbar remains accessible throughout the user journey.
  • Validate that the change does not negatively affect the mobile experience.

Run the updated script above to help locate any other navigation components that might indicate alternative or complementary positioning strategies. Then, manually verify that the overall navigation experience is as expected.


🏁 Script executed:

#!/bin/bash
echo "Searching for navigation-related components in TSX and JSX files:"
rg --type-add "tsx:*.tsx" --type-add "jsx:*.jsx" -l "nav|navbar|navigation"

Length of output: 2421


Navigation Positioning Change Verification

The removal of the fixed class in frontend/src/components/root/nav.tsx (line 185) changes the navbar’s behavior from a fixed element at the top to one that scrolls with the content. Based on the search for navigation-related components, no obvious alternative fixed navbar is present that might compensate for this change. However, please manually verify that:

  • The design change is intentional.
  • The navbar remains visible and accessible throughout the user journey.
  • The change does not negatively affect the mobile experience.
frontend/src/components/auth-choice-modal.tsx (2)

41-48: Improved modal transition with sequential actions

The implementation now properly separates modal closing from the sign-in action, creating a smoother user experience with the delayed execution.

The pattern of:

  1. Close current modal
  2. Wait for animation to complete (100ms)
  3. Open the next modal

Creates a much more polished user flow.


57-62: Consistent implementation for sign-up flow

The same improved transition pattern has been correctly applied to the sign-up flow, maintaining consistency.

frontend/src/components/sidebar.tsx (3)

11-11: Navigation improvements with Next.js Router

Good addition of the useRouter hook for client-side navigation which provides a better user experience than traditional page reloads.


52-52: LGTM - Router instantiation

Properly initialized the router for use in navigation actions.


123-123: Width adjustment improves visual consistency

Good improvement changing from w-[85%] to w-full for the divider, which creates better visual alignment.

frontend/src/app/(main)/page.tsx (3)

11-13: New modal components enhance authentication UX

Good addition of separate modals for sign-in and sign-up flows to improve user experience.


18-19: Good state management for modal visibility

Properly implemented state variables for managing the visibility of authentication modals.


110-111: Clean implementation of modal components

The sign-in and sign-up modals are properly implemented with appropriate props for controlling visibility.


import { SignInModal } from '@/components/sign-in-modal';
import { SignUpModal } from '@/components/sign-up-modal';
import { useRouter } from 'next/navigation';
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Remove unused router import

The useRouter is imported and instantiated but not used anywhere in the component. You should remove unused imports to keep the code clean.

- import { useRouter } from 'next/navigation';

And:

- const router = useRouter();

Also applies to: 17-17

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