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

Remove stytch auth and implement custom Auth #400

Merged
merged 20 commits into from
Apr 30, 2024

Conversation

mit-27
Copy link
Contributor

@mit-27 mit-27 commented Apr 29, 2024

Summary by CodeRabbit

  • New Features

    • Introduced new user registration and login components with enhanced form validation and authentication handling.
    • Added theme toggle functionality for user interface customization.
    • Implemented a new Home component for improved navigation.
  • Enhancements

    • Updated user authentication flow, including manual handling of user profile and project data.
    • Enhanced layout components with ThemeProvider for dynamic theming support.
  • Bug Fixes

    • Refined user logout process to ensure complete data cleanup and redirection to the login page.
  • Refactor

    • Removed dependency on Stytch authentication library, replacing it with custom stores and cookie management.
    • Restructured authentication and project data handling across various components and hooks.
  • Documentation

    • Updated documentation and comments to reflect changes in authentication and project management logic.
  • Style

    • Adjusted CSS classes and styles for navigation and layout components to improve user interface consistency.
  • Tests

    • Modified and added tests to cover new functionalities and changes in user authentication and project management.
  • Chores

    • General code cleanup and removal of unused code and dependencies related to previous authentication implementations.
  • Revert

    • No significant reverts in this update.

Copy link

changeset-bot bot commented Apr 29, 2024

⚠️ No Changeset found

Latest commit: 11f2133

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 Apr 29, 2024

@mit-27 is attempting to deploy a commit to the Panora Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Apr 29, 2024

Walkthrough

This update primarily revolves around removing the Stytch authentication library and implementing a custom authentication system, alongside enhancing the user experience by refining UI components and backend services. The changes include the introduction of new components, hooks for user and project management, and updates to existing components to accommodate new authentication and theming functionalities.

Changes

File Path Change Summary
.../api-keys/page.tsx, .../configuration/page.tsx, .../connections/page.tsx, .../events/page.tsx Updated to use absolute paths for imports and integrated Heading component.
.../b2c/profile/page.tsx, .../b2c/login/page.tsx Replaced Stytch with custom authentication handling using cookies and stores.
.../layout.tsx, .../state/profileStore.ts, .../state/projectStore.ts Enhanced user and project state management.
.../Auth/CustomLoginComponent/..., .../hooks/mutations/... Added new components and hooks for user registration, login, and project management.
.../Nav/..., .../components/Provider/provider.tsx Updated navigation and provider components to support new authentication and theming functionalities.

Assessment against linked issues

Objective Addressed Explanation
Remove Stytch and Implement Custom Auth (#398)
Remove Server Side Components from NextJS (#398) Specific details on server-side component removal are not provided.
Add functionality to create and fetch projects associated with the current User (#398)
Retrieve and display connections and API keys associated with the logged-in user (#398) Not addressed in the provided summary.

🐇✨
In the land of code, where logic threads,
A rabbit hopped, changing the beds.
Out with the old, in with the new,
Authentication flows, fresh as morning dew.
Celebrate the craft, for changes we cheer,
Hop along, my friends, the future is here! 🚀🌟
🐇✨


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between a4ecb04 and 11f2133.
Files selected for processing (3)
  • apps/client-ts/src/app/(Dashboard)/api-keys/page.tsx (3 hunks)
  • apps/client-ts/src/components/Connection/AddConnectionButton.tsx (2 hunks)
  • apps/client-ts/src/hooks/mutations/useProjectMutation.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • apps/client-ts/src/app/(Dashboard)/api-keys/page.tsx
  • apps/client-ts/src/hooks/mutations/useProjectMutation.tsx
Additional comments not posted (1)
apps/client-ts/src/components/Connection/AddConnectionButton.tsx (1)

Line range hint 172-262: Validate file input for batch magic link creation.

The form includes an input for uploading files when showNewLinkedUserDialog.import is true. However, there is no validation or handling logic provided for the file input. It's important to ensure that the file is in the correct format and size before processing. Consider adding validation logic or using a library to handle file uploads more robustly.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

socket-security bot commented Apr 29, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@nestjs/[email protected] Transitive: environment, eval, filesystem, network, shell, unsafe +232 27.2 MB nestjscore
npm/@nestjs/[email protected] Transitive: eval +9 2.47 MB nestjscore
npm/@nestjs/[email protected] environment, unsafe Transitive: filesystem, network, shell +18 1.47 MB nestjscore
npm/@nestjs/[email protected] Transitive: eval +5 1.9 MB nestjscore
npm/@nestjs/[email protected] network Transitive: environment, eval, filesystem, unsafe +84 2.76 MB nestjscore
npm/@nestjs/[email protected] Transitive: shell +3 4.59 MB nestjscore
npm/@nestjs/[email protected] Transitive: environment, eval, filesystem, network, unsafe +64 5.4 MB nestjscore
npm/@nestjs/[email protected] Transitive: environment, eval, filesystem +11 14.5 MB nestjscore
npm/@nestjs/[email protected] None +1 115 kB nestjscore
npm/@prisma/[email protected] environment, filesystem, shell +1 2.12 MB prismabot
npm/@sentry/[email protected] environment, filesystem, network, shell, unsafe +8 7.83 MB sentry-bot
npm/@sentry/[email protected] Transitive: network +4 4.98 MB sentry-bot
npm/@types/[email protected] None +10 112 kB types
npm/@types/[email protected] Transitive: environment, filesystem, unsafe +48 1.76 MB types
npm/@types/[email protected] None 0 3.78 MB types
npm/@types/[email protected] None +2 26.2 kB types
npm/@typescript-eslint/[email protected] Transitive: environment, filesystem +48 6.88 MB jameshenry
npm/@typescript-eslint/[email protected] Transitive: environment, filesystem +36 2.62 MB jameshenry
npm/[email protected] network Transitive: environment, filesystem +8 2.14 MB jasonsaayman
npm/[email protected] None 0 19.7 kB lydell
npm/[email protected] environment, filesystem Transitive: eval, shell, unsafe +97 10.5 MB eslintbot
npm/[email protected] Transitive: environment, eval, filesystem, network, shell, unsafe +274 19.1 MB simenb
npm/[email protected] unsafe Transitive: environment, eval, filesystem +19 1.88 MB iamolegga
npm/[email protected] None +1 14.7 kB hydra-newmedia
npm/[email protected] None +14 314 kB themikenicholson
npm/[email protected] None +1 13.2 kB jaredhanson
npm/[email protected] network +2 88.9 kB jaredhanson
npm/[email protected] environment Transitive: filesystem +16 1.27 MB matteo.collina
npm/[email protected] environment, filesystem, unsafe 0 11.2 MB prettier-bot
npm/[email protected] None +1 17.3 MB prismabot
npm/[email protected] None 0 293 kB rbuckton
npm/[email protected] None +1 4.59 MB blesh
npm/[email protected] filesystem +2 895 kB linusu
npm/[email protected] network Transitive: environment, unsafe +3 2.54 MB lgore-stytch
npm/[email protected] network Transitive: environment, eval, filesystem +36 1.87 MB titanism
npm/[email protected] environment, filesystem, unsafe Transitive: shell +79 12.4 MB kul
npm/[email protected] filesystem Transitive: environment, eval, network, shell, unsafe +86 15.2 MB johnnyreilly
npm/[email protected] environment, filesystem, unsafe +16 1.98 MB cspotcode
npm/[email protected] environment, filesystem, unsafe +3 509 kB jonaskello
npm/[email protected] None 0 40.1 MB typescript-bot
npm/[email protected] None 0 123 kB ctavan

🚮 Removed packages: npm/@faker-js/[email protected], npm/@hookform/[email protected], npm/@nestjs/[email protected], npm/@nestjs/[email protected], npm/@nestjs/[email protected], npm/@nestjs/[email protected], npm/@nestjs/[email protected], npm/@nestjs/[email protected], npm/@nestjs/[email protected], npm/@nestjs/[email protected], npm/@panora/[email protected], npm/@prisma/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@sentry/[email protected], npm/@sentry/[email protected], npm/@stytch/[email protected], npm/@stytch/[email protected], npm/@tanstack/[email protected], npm/@tanstack/[email protected], npm/@tanstack/[email protected], npm/@tanstack/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@typescript-eslint/[email protected], npm/@typescript-eslint/[email protected], npm/@typescript-eslint/[email protected], npm/@typescript-eslint/[email protected], npm/@vitejs/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected]

View full report↗︎

Copy link

socket-security bot commented Apr 29, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSource
Install scripts npm/[email protected]
  • Install script: preinstall
  • Source: node scripts/preinstall-entry.js
Install scripts npm/[email protected]
  • Install script: postinstall
  • Source: node postinstall.js
Protestware/Troll package npm/[email protected]
  • Note: This package prints a protestware console message regarding Ukraine for users with Russian language locale

View full report↗︎

Next steps

What is an install script?

Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.

Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead.

What is protestware?

This package is a joke, parody, or includes undocumented or hidden behavior unrelated to its primary function.

Consider that consuming this package my come along with functionality unrelated to its primary purpose.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

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: 13

Out of diff range and nitpick comments (7)
apps/client-ts/src/state/projectStore.ts (1)

9-9: Initialization of idProject as an empty string is approved. Consider adding a comment explaining this choice for future maintainability.

apps/client-ts/src/components/Nav/theme-provider.tsx (1)

7-9: Introduction of ThemeProvider is approved. Consider adding a brief comment explaining its role and usage to enhance code readability.

apps/client-ts/src/state/profileStore.ts (1)

12-13: Allowing the profile to be set to null is approved. Consider adding a comment explaining this choice to aid in future maintenance and clarity.

apps/client-ts/src/app/(Dashboard)/layout.tsx (1)

27-30: Use of RootLayout to wrap children is approved. Consider adding a comment explaining its role and usage to enhance code readability.

apps/client-ts/src/hooks/useProjectsByUser.tsx (1)

9-14: Checks to ensure userId is not undefined or empty before fetching projects are approved. Consider adding a comment explaining why these checks are necessary for clarity and future maintainability.

apps/client-ts/src/components/Nav/main-nav.tsx (1)

32-32: Review dynamic class application in JSX.

Consider simplifying the expression for className to improve readability. Extract complex logic into a separate function or use classnames library.

apps/client-ts/src/components/Auth/CustomLoginComponent/LoginUserForm.tsx (1)

30-37: Refine form validation messages for better user experience.

Consider providing more descriptive validation messages that guide the user on how to correct their input.

Comment on lines 16 to 22
handleRequest(err, user, info) {
// You can throw an exception based on either "info" or "err" arguments
if (err || !user) {
throw err || new UnauthorizedException();
}
return user;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider removing the unused info parameter to clean up the code.

- handleRequest(err, user, info) {
+ handleRequest(err, user) {

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
handleRequest(err, user, info) {
// You can throw an exception based on either "info" or "err" arguments
if (err || !user) {
throw err || new UnauthorizedException();
}
return user;
}
handleRequest(err, user) {
// You can throw an exception based on either "info" or "err" arguments
if (err || !user) {
throw err || new UnauthorizedException();
}
return user;
}

Comment on lines 64 to 75

setProfile(data);
// Cookies.set('access_token',data.access_token,{expires:1});
// console.log("Bearer Token in client Side : ",data.access_token);

toast("User has been fetched !", {
description: "",
action: {
label: "Close",
onClick: () => console.log("Close"),
},
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor success toast message to include more details.

- toast("User has been fetched !", {
+ toast(`User ${data.first_name} has been successfully fetched!`, {

This change provides more context to the user about the operation's success.


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
setProfile(data);
// Cookies.set('access_token',data.access_token,{expires:1});
// console.log("Bearer Token in client Side : ",data.access_token);
toast("User has been fetched !", {
description: "",
action: {
label: "Close",
onClick: () => console.log("Close"),
},
})
setProfile(data);
// Cookies.set('access_token',data.access_token,{expires:1});
// console.log("Bearer Token in client Side : ",data.access_token);
toast(`User ${data.first_name} has been successfully fetched!`, {
description: "",
action: {
label: "Close",
onClick: () => console.log("Close"),
},
})

Comment on lines +36 to +39
// const { id_organization, ...rest } = data;
const res = await this.prisma.projects.create({
data: {
...rest,
name: data.name,
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider removing or uncommenting the commented-out code related to id_organization to clarify its usage.

- // const { id_organization, ...rest } = data;
+ const { id_organization, ...rest } = data;

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
// const { id_organization, ...rest } = data;
const res = await this.prisma.projects.create({
data: {
...rest,
name: data.name,
const { id_organization, ...rest } = data;
const res = await this.prisma.projects.create({
data: {
name: data.name,

Comment on lines 49 to 50

console.log(data)
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider enhancing the logging in the onSuccess method to provide more detailed information about the operation.

- console.log(data)
+ console.log("Project created successfully:", data)

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
console.log(data)
console.log("Project created successfully:", data)

Comment on lines +58 to +65
toast("User has been generated !", {
description: "",
action: {
label: "Close",
onClick: () => console.log("Close"),
},
})
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider enhancing the success notification to include more details about the user created, such as the user's name or email.

- toast("User has been generated !", {
+ toast(`User ${data.first_name} has been successfully created!`, {

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
toast("User has been generated !", {
description: "",
action: {
label: "Close",
onClick: () => console.log("Close"),
},
})
},
toast(`User ${data.first_name} has been successfully created!`, {
description: "",
action: {
label: "Close",
onClick: () => console.log("Close"),
},
})
},

Comment on lines +36 to +43
useEffect(() => {

if(profile)
{
router.replace('/connections');
}

},[profile]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Optimize useEffect hook for user redirection.

The useEffect hook can be optimized by combining the conditions for user redirection into a single hook to reduce redundancy and improve performance.

Comment on lines +53 to +63
const onSubmit = (values: z.infer<typeof formSchema>) => {

loginMutate({
email:values.email,
password_hash:values.password
},
{
onSuccess: () => router.replace("/connections")
})

}
Copy link
Contributor

Choose a reason for hiding this comment

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

Optimize form submission handling.

Refactor the form submission logic to handle different scenarios such as network failures or invalid credentials more gracefully.

import useProfile from '@/hooks/useProfile';
import useProfileStore from '@/state/profileStore';
import useProjectStore from '@/state/projectStore';
import { ThemeToggle } from '@/components/Nav/theme-toggle';
import { projects as Project } from 'api';
Copy link
Contributor

Choose a reason for hiding this comment

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

Imported projects from 'api' but it is not used anywhere in the file.

Consider removing this import if it's not intended for future use to keep the code clean and maintainable.

@@ -13,6 +13,8 @@
import { handleServiceError } from '@@core/utils/errors';
import { LoginDto } from './dto/login.dto';
import { users as User } from '@prisma/client';
import { ConfigService } from '@nestjs/config';
Copy link
Contributor

Choose a reason for hiding this comment

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

ConfigService is imported but never used.

Remove the unused import to clean up the code.

- import { ConfigService } from '@nestjs/config';

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
import { ConfigService } from '@nestjs/config';

Comment on lines 148 to 152
foundUser = await this.prisma.users.findUnique({
where: {
email: user.email
}
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Use const for foundUser since it is never reassigned.

Modify the declaration to use const for better code clarity and to prevent accidental reassignment.

- let foundUser = await this.prisma.users.findUnique({
+ const foundUser = await this.prisma.users.findUnique({

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
foundUser = await this.prisma.users.findUnique({
where: {
email: user.email
}
});
const foundUser = await this.prisma.users.findUnique({
where: {
email: user.email
}
});

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

Out of diff range and nitpick comments (1)
packages/api/src/@core/auth/auth.controller.ts (1)

Line range hint 1-12: Consider removing unused imports to clean up the file.

- import { Query, Res, Param, Response } from '@nestjs/common';
- import { ApiKeyAuthGuard } from './guards/api-key.guard';

Comment on lines +16 to +21
handleRequest<TUser = any>(err: any, user: any, _info: any, _context: ExecutionContext, _status?: any): TUser {
if (err || !user) {
throw err || new UnauthorizedException();
}
return user;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider removing the unused parameters _info, _context, and _status to clean up the method signature.

- handleRequest<TUser = any>(err: any, user: any, _info: any, _context: ExecutionContext, _status?: any): TUser {
+ handleRequest<TUser = any>(err: any, user: any): TUser {

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
handleRequest<TUser = any>(err: any, user: any, _info: any, _context: ExecutionContext, _status?: any): TUser {
if (err || !user) {
throw err || new UnauthorizedException();
}
return user;
}
handleRequest<TUser = any>(err: any, user: any): TUser {
if (err || !user) {
throw err || new UnauthorizedException();
}
return user;
}

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: 2

Out of diff range and nitpick comments (3)
apps/client-ts/src/app/(Dashboard)/events/page.tsx (1)

4-4: Ensure that the Heading component is used consistently across the application for UI uniformity.

apps/client-ts/src/app/(Dashboard)/connections/page.tsx (1)

4-4: Ensure that the Heading component is used consistently across the application for UI uniformity.

apps/client-ts/src/app/(Dashboard)/configuration/page.tsx (1)

44-44: Added import for Heading. Ensure this component is used consistently across the application for UI uniformity.

Comment on lines +9 to +15
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<div className="flex-1 space-y-4 p-8 pt-6">
<div className="flex items-center justify-between space-y-2">
<h2 className="text-3xl font-bold tracking-tight">Events</h2>
<Heading
title="Events"
description=""
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

The JSX structure has been modified to include a Heading component with a title and an empty description. Consider providing a meaningful description or removing the empty attribute if it's not needed.

Comment on lines +116 to +122
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<div className="flex-1 space-y-4 p-8 pt-6">
<div className="flex items-center justify-between space-y-2">
<h2 className="text-3xl font-bold tracking-tight">Configuration</h2>
<Heading
title="Configuration"
description=""
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

The JSX structure has been modified to include a Heading component with a title and an empty description for the configuration section. Consider providing a meaningful description or removing the empty attribute if it's not needed.

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

Out of diff range and nitpick comments (3)
apps/client-ts/src/components/Connection/AddConnectionButton.tsx (3)

Line range hint 172-262: Ensure consistent error handling in the form submission process.

The current implementation logs the error to the console when there is an error in the mutate function call within the onSubmit method. However, this does not provide any feedback to the user. It would be beneficial to implement a user-friendly error handling mechanism, such as displaying an error message on the UI.


Line range hint 172-262: Consider using a conditional rendering strategy for form fields.

The current implementation uses a ternary operator to switch between two completely different sets of form fields based on the showNewLinkedUserDialog.import state. This could be refactored into smaller, more manageable components or custom hooks to improve readability and maintainability.


Line range hint 172-262: Optimize the rendering of form fields.

The form fields are re-rendered every time the state changes, which might lead to performance issues on larger forms or slower devices. Consider memoizing the form fields or using React's PureComponent or memo for functional components to avoid unnecessary re-renders.

@naelob naelob merged commit e90b062 into panoratech:main Apr 30, 2024
8 of 12 checks passed
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.

Remove Stytch and Implement Custom Authentication
2 participants