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(ui/portal): create singin page components #276

Merged
merged 2 commits into from
Jan 31, 2025

Conversation

HasithDeAlwis
Copy link
Collaborator

@HasithDeAlwis HasithDeAlwis commented Jan 31, 2025

Checklist

  • I've thoroughly read the latest contribution guidelines.
  • I've rebased my branch onto main before creating this PR.
  • I've added tests to cover my changes (if applicable).
  • I've verified that all new and existing tests have passed locally for mobile, tablet, and desktop screen sizes.
  • My commit messages follow guidelines
  • My change requires documentation updates.
  • I've updated the documentation accordingly.
  • My code follows existing patterns of this project and/or improves upon them.

image

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a sign-in page with GitHub login functionality
    • Introduced a new call-to-action component for user authentication
  • UI Improvements

    • Enhanced button variants with a new primary style
    • Added responsive sign-in page design with background image
  • Development

    • Expanded Storybook configuration to include more story files
    • Added TypeScript configuration for the portal library
  • Chores

    • Updated project configuration and path mappings

Copy link

coderabbitai bot commented Jan 31, 2025

📝 Walkthrough

Walkthrough

This pull request introduces a comprehensive set of changes to the portal application, focusing on implementing a sign-in page and enhancing the project's configuration. The changes include creating new components for the sign-in flow, updating Storybook configuration, modifying the index route, and adding TypeScript configuration files for the portal library. The modifications aim to improve the application's structure, add a new sign-in experience, and prepare the project for further development.

Changes

File Change Summary
.storybook/main.ts Added new story path for Storybook configuration
apps/portal/app/routes/_index.tsx Removed dynamic loader, replaced with static data
libs/portal/features/sign-in/index.ts Added export for SignInCallToAction component
libs/portal/features/sign-in/ui/call-to-action.stories.tsx Created Storybook stories for sign-in component
libs/portal/features/sign-in/ui/call-to-action.tsx Implemented SignInCallToAction component
libs/portal/pages/signin/index.tsx Created Signin page component
libs/portal/project.json Added new project configuration file
libs/portal/tsconfig.json, libs/portal/tsconfig.lib.json Added TypeScript configuration files
libs/shared/ui/button/button.tsx Added primary button variant
tsconfig.base.json Added path mappings for portal library

Possibly related issues

Possibly related PRs

Suggested labels

frontend, enhancement

Suggested reviewers

  • MFarabi619

Poem

🐰 A Rabbit's Sign-In Delight 🔑

In portal's realm, a new page springs,
With GitHub's logo and login's wings,
Storybook stories, configs so neat,
A sign-in journey, now complete!
Hop along, code rabbit's delight! 🚀

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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

netlify bot commented Jan 31, 2025

Deploy Preview for cuhacking-website ready!

Name Link
🔨 Latest commit ba83e59
🔍 Latest deploy log https://app.netlify.com/sites/cuhacking-website/deploys/679d13878af624000836fe41
😎 Deploy Preview https://deploy-preview-276--cuhacking-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

@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)
libs/portal/features/sign-in/ui/call-to-action.stories.tsx (1)

4-16: Enhance Storybook coverage with additional variants.

The story configuration looks good, but consider adding variants for different states:

  • Loading state
  • Error state
  • Disabled state

Example addition:

export const Loading: Story = {
  args: {
    isLoading: true
  }
}

export const Error: Story = {
  args: {
    error: 'Failed to authenticate'
  }
}
libs/portal/pages/signin/index.tsx (2)

10-15: Optimize background image loading and accessibility.

The background image implementation could be improved:

  1. Add loading="lazy" for performance
  2. Consider using next/image for automatic optimization
  3. Provide more descriptive alt text even if decorative
 <img
   src={dashboard_background}
-  alt=""
+  alt="Abstract dashboard background"
+  loading="lazy"
   aria-hidden="true"
   className="absolute top-0 left-0 w-full h-full object-cover z-[-1]"
 />

4-18: Add SEO metadata for the signin page.

Consider adding a title and meta description for better SEO:

import { Helmet } from 'react-helmet';

export function Signin() {
  return (
    <>
      <Helmet>
        <title>Sign In - cuHacking Portal</title>
        <meta name="description" content="Sign in to cuHacking portal using your GitHub account" />
      </Helmet>
      {/* existing JSX */}
    </>
  );
}
libs/portal/features/sign-in/ui/call-to-action.tsx (1)

5-31: Add TypeScript props interface for better reusability.

Consider adding props to make the component more flexible:

interface SignInCallToActionProps {
  onLogin?: () => Promise<void>;
  isLoading?: boolean;
  error?: string;
}

export function SignInCallToAction({ 
  onLogin,
  isLoading = false,
  error
}: SignInCallToActionProps) {
  // ... existing implementation
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bcda515 and ba83e59.

⛔ Files ignored due to path filters (1)
  • libs/shared/assets/icons/socials/github-black-1.svg is excluded by !**/*.svg
📒 Files selected for processing (11)
  • .storybook/main.ts (2 hunks)
  • apps/portal/app/routes/_index.tsx (1 hunks)
  • libs/portal/features/sign-in/index.ts (1 hunks)
  • libs/portal/features/sign-in/ui/call-to-action.stories.tsx (1 hunks)
  • libs/portal/features/sign-in/ui/call-to-action.tsx (1 hunks)
  • libs/portal/pages/signin/index.tsx (1 hunks)
  • libs/portal/project.json (1 hunks)
  • libs/portal/tsconfig.json (1 hunks)
  • libs/portal/tsconfig.lib.json (1 hunks)
  • libs/shared/ui/button/button.tsx (1 hunks)
  • tsconfig.base.json (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • libs/portal/project.json
  • libs/portal/features/sign-in/index.ts
  • libs/portal/tsconfig.json
  • libs/portal/tsconfig.lib.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (7)
apps/portal/app/routes/_index.tsx (1)

2-9: ⚠️ Potential issue

Verify the removal of dynamic social links loading.

The change from dynamically loaded social links to a static array seems like a potential regression. Was this intentional? If so, please provide context for this change in the PR description.

libs/portal/features/sign-in/ui/call-to-action.tsx (1)

5-31: Add unit tests for the SignInCallToAction component.

As mentioned in the PR objectives, tests are missing. Please add unit tests to cover:

  1. Rendering in different states
  2. Button click handling
  3. Loading state
  4. Error handling

Would you like me to help generate the test file with these test cases?

libs/shared/ui/button/button.tsx (2)

Line range hint 6-6: Address TODO comment before merging.

The TODO comment suggests a pending refactor. Since you're modifying the button component, consider addressing this technical debt now.

Would you like me to help create a separate issue to track this refactor task?


22-22: LGTM! The primary variant follows consistent styling patterns.

The new primary variant maintains consistency with existing variants and uses appropriate Tailwind classes.

.storybook/main.ts (2)

18-18: LGTM! Story path addition aligns with new portal features.

The new path correctly includes stories from the portal features directory, which is necessary for the signin page components.


115-117: LGTM! Essential fix for webpack configuration.

Adding the missing return statement ensures proper webpack configuration.

tsconfig.base.json (1)

20-21: LGTM! Path mappings follow established patterns.

The new portal module path mappings maintain consistency with existing module configurations and enable proper TypeScript resolution for the signin page components.

Comment on lines +21 to +28
<Button
variant="primary"
className="flex items-center gap-x-3 px-4"
aria-label="Login with GitHub"
>
<img src={github_black} alt="GitHub logo" className="h-5 w-5" />
<span>Login</span>
</Button>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add onClick handler and loading state to the login button.

The button is missing crucial functionality:

  1. onClick handler for GitHub authentication
  2. Loading state feedback
  3. Error handling
 <Button
   variant="primary"
   className="flex items-center gap-x-3 px-4"
   aria-label="Login with GitHub"
+  onClick={handleGitHubLogin}
+  isLoading={isLoading}
+  disabled={isLoading}
 >
-  <img src={github_black} alt="GitHub logo" className="h-5 w-5" />
+  {!isLoading && <img src={github_black} alt="GitHub logo" className="h-5 w-5" />}
   <span>Login</span>
 </Button>

Committable suggestion skipped: line range outside the PR's diff.

@HasithDeAlwis HasithDeAlwis merged commit 43da7b6 into main Jan 31, 2025
9 checks passed
@HasithDeAlwis HasithDeAlwis linked an issue Jan 31, 2025 that may be closed by this pull request
1 task
@MFarabi619
Copy link
Member

🎉 This PR is included in version 1.23.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(ui/portal): create signin page components
2 participants