Skip to content

33 upgrade packages#43

Merged
sanjaysah101 merged 36 commits intodevfrom
33-upgrade-packages
Oct 4, 2025
Merged

33 upgrade packages#43
sanjaysah101 merged 36 commits intodevfrom
33-upgrade-packages

Conversation

@sanjaysah101
Copy link
Contributor

@sanjaysah101 sanjaysah101 commented Oct 4, 2025

What changes have been made?

Sanjay Kumar Sah and others added 30 commits April 23, 2025 18:18
Reordered tailwind class names across multiple components to maintain a consistent pattern. Updated PostCSS configuration to use the Tailwind CSS PostCSS plugin directly. Removed unnecessary ESLint configuration and migrated to a flat config format. Updated dependencies and dev scripts to use Turbopack for faster development builds.
… ignore patterns

Add @parcel/watcher to the onlyBuiltDependencies list in package.json to ensure it is included in the build process. Additionally, update ESLint configuration to ignore common build and output directories, improving linting efficiency by excluding unnecessary files.
The pnpm overrides in package.json were removed as they are no longer needed. Additionally, a new pnpm-workspace.yaml file was added to specify onlyBuiltDependencies, ensuring that sharp and unrs-resolver are built correctly within the workspace.
- Replace `flex-grow` with `grow` in button components for consistency
- Update shadow classes from `shadow` to `shadow-sm` or `shadow-xs` across multiple components
- Remove `tailwind.config.ts` and migrate to inline Tailwind CSS configurations
- Adjust class names for better readability and maintainability
- Update global CSS to use `@import` for Tailwind and custom animations
…slot attributes

Refactored various UI components from class-based to function components for better maintainability and readability. Added `data-slot` attributes to improve component identification and styling. Updated dependencies to include `@radix-ui/react-tabs` and `sonner`. Simplified component logic and improved consistency across the codebase.
- Add `eslint-plugin-jsx-a11y` for better accessibility linting
- Update ESLint configuration to include accessibility rules
- Replace `<a>` with `<Link>` in `LoginForm` for Next.js optimization
- Add `role="button"` to password toggle for better accessibility
- Clean up unused ESLint directives and improve code readability
- Update `global-error.tsx` to include `lang="en"` for better HTML semantics
The button variant types in QuizDetails.tsx were updated to include "ghost" and "link" and to remove redundant "default". Additionally, the CoursePage and QuizPage components were refactored to improve type safety by awaiting the params object directly from the props.
- Rename `href` and `label` to `link` and `name` in NavBar for clarity
- Change `dark:flex` to `dark:block` in Welcome component for correct display
- Update ThemeToggle position from `absolute` to `fixed` in layout for better UI
- Add `createdAt` and `updatedAt` fields to courseSchema for enhanced data tracking
- Simplify contributors section in README for cleaner presentation
…ser menu

- Added theme toggle functionality to switch between light and dark modes
- Integrated a search bar for improved user experience
- Enhanced user menu with avatar, dropdown, and navigation options
- Updated mobile menu to include search, theme toggle, and auth buttons
- Improved styling and responsiveness for better usability
Add axios as a dependency and create a new axios instance with request and response interceptors to handle token refresh and error management. This enables consistent API request handling and improves error recovery for authentication-related issues.
Implement logout action in authSlice to reset user state and update logout page to dispatch the logout action. This ensures consistent state management and proper user session cleanup.
- Remove unused `rememberMe` field from `LoginSchema` and related components
- Remove unnecessary `console.dir` and `console.log` statements
- Simplify form initialization in `useLogin` hook
- Add `cursor-pointer` class to `Password` component for better UX
- Update `axiosInstance` to handle status codes more effectively
- Remove unused `ThemeToggle` component from layout
- Refactor `Button` component to use `forwardRef` and simplify styles
- Replace mock blog fetching with `getBlog` action
- Refactor `fetchBlogs` to support complex filters
- Update `useBlogFilters` to handle input and category filters separately
…ayer

This commit introduces a new service layer by consolidating API-related functions into dedicated service files (authService, courseService, userService). It removes deprecated API utilities (fetch.ts, api.ts, axios.ts) and replaces them with a streamlined API client (apiClient.ts). The changes improve maintainability, reduce code duplication, and provide a consistent interface for API interactions. Additionally, auth-related hooks and components have been reorganized for better structure and clarity.
Introduce OTP verification feature by adding a new `input-otp` component and a `/verify-otp` page. The `useSignUp` hook now redirects users to the OTP verification page after successful sign-up. This enhances security by requiring users to verify their identity via a one-time password.
Introduce OTP verification functionality including a reusable modal component, context for managing verification data, and hooks for OTP requests and verification. This enhances the authentication flow by providing a secure and user-friendly way to verify email addresses during signup. The implementation includes schema validation, session storage for persistence, and integration with existing auth services.
…e types

- Refactor IApiResponse into success/failed interfaces for better type safety
- Update auth services and hooks to use new response types
- Improve OTP verification flow with proper redirects and error handling
- Add SignUpResponse type for better type safety in signup flow
- Consolidate dashboard layout into single component
- Update logout page to use constants for cookie names
- Improve Google sign-in with error handling and button styling
- Move IApiResponse type to shared types file and update all service imports
- Remove redundant send-response.util and update apiClient to use new type
- Add USER_ID cookie constant and save it during login
- Clean up imports and remove unused code in various service files
- Remove loading.tsx as it's no longer needed
- Move AuthProvider from dashboard layout to root layout for better auth handling
- Update auth checks to use status instead of data presence
- Add accessToken and userId props to AuthProvider for conditional fetching
- Simplify AuthProvider component structure
- Remove AuthContext and replace with useSessionStorage hook
- Add authFlowSlice for managing auth state with redux
- Update OTP verification flow to use new session storage approach
- Consolidate notification types and OTP schemas in constants
- Improve type safety with new VerifyOTPSchema
- Add USER_ID cookie deletion in logout process
- Introduce AuthToken type for better type safety
- Improve OTP verification flow with token persistence
- Update API client to handle token refresh for OTP endpoints
- Refactor auth services for better token management
- Fix OTP modal to properly handle token storage and resend
- Replace `div` with semantic `header` tag
- Rename `scrolled` state to `isScrolled` for clarity
- Remove unused imports and console log
- Reorganize authenticated user section
- Simplify mobile auth buttons logic
- Remove custom toast components and hooks in favor of sonner library
- Update all toast usage across components to use sonner's API
- Simplify toast calls and improve consistency in error/success messaging
- Remove unused toast-related exports from ui index file
- Replace h1-h6, p, and span elements with Typography component across multiple files
- Update Typography component to support span variant and improve styling
- Standardize text rendering and improve consistency in UI
- Update password component to use Lucide icons and better button implementation
- Clean up unused imports and update dependencies
- Migrate next.config from mjs to ts with enhanced image patterns
- Restructure home page components for better organization
- Update image components with proper sizing and priority attributes
- Improve auth pages typography and image handling
- Enhance blog cards with better layout and typography
- Update dependencies to latest versions
…h functionality

- Add new dashboard layout components including header, main, and top navigation
- Implement command menu with keyboard shortcut (Cmd+K) for quick navigation
- Add search functionality with context provider
- Include new UI components (command, scroll-area) and types
- Update dependencies to support new features (cmdk, recharts, etc.)
- Add sample dashboard overview with charts and statistics
- Add new Collapsible component using Radix UI primitives
- Refactor sidebar structure to support collapsible navigation groups
- Implement team switcher dropdown with team selection functionality
- Add user profile dropdown in sidebar footer
- Export new navigation types from types.ts
- Update package dependencies for new components
refactor(types): improve type definitions for navigation and profile
feat(ui): add calendar and popover components
build: add date-fns and react-day-picker dependencies
abhishek-nexgen-dev and others added 5 commits June 22, 2025 10:20
…d components

refactor(public): replace div with fragment in public page layout

feat(protected): add dashboard with sidebar, navbar, and settings pages

feat(users): implement user profile and list pages with error handling

style(footer): simplify footer layout and improve responsiveness

chore: update dependencies and add new ui components

fix(login): remove duplicate navbar from auth pages

feat(courses): add courses management with create, update, and delete functionality

docs: update documentation and comments for new components

test: add skeleton loaders and error boundaries for async components
…onent (#40)

* feat(auth): add NavBar component to login and signup pages

* feat(username): implement username availability check with input component

* feat(auth): remove NavBar from login and signup pages, add it to AuthProvider, and update username availability check response structure

* feat(layout): replace AuthNavBar with NavBar in PublicLayout and update import paths

* feat(ui): enhance UsernameInput component with props for controlled behavior and availability check callback

* feat(layout): replace NavBar with AuthNavBar in PublicLayout and clean up unnecessary fragments in layout components

---------

Co-authored-by: Sanjay Kumar Sah <sanjay8797421521@gmail.com>
- Fix incorrect signup endpoint URL that was pointing to login
- Add userId check to auth query enabled condition
- Redirect to logout instead of login on failed auth status
@sanjaysah101 sanjaysah101 self-assigned this Oct 4, 2025
@sanjaysah101 sanjaysah101 linked an issue Oct 4, 2025 that may be closed by this pull request
Comment on lines +83 to +88
const response = await fetch(url, {
method,
headers,
body: body ? JSON.stringify(body) : undefined,
...fetchOptions,
});

Check failure

Code scanning / CodeQL

Server-side request forgery Critical

The
URL
of this request depends on a
user-provided value
.
The
URL
of this request depends on a
user-provided value
.
The
URL
of this request depends on a
user-provided value
.
The
URL
of this request depends on a
user-provided value
.
The
URL
of this request depends on a
user-provided value
.
The
URL
of this request depends on a
user-provided value
.
The
URL
of this request depends on a
user-provided value
.

Copilot Autofix

AI 5 months ago

To fix this SSRF vulnerability, you should validate and enforce constraints on the courseId parameter in getCourse before using it to construct a URL. Specifically:

  • Only permit course IDs that match the expected pattern—typically, a UUID or numeric/alphanumeric identifier.
  • Reject course IDs containing path traversal (..), slashes, or any special characters not expected in IDs.
  • Optionally, use an allow-list or a regular expression to enforce permitted formats.

Implement this input validation directly in the getCourse function (src/lib/services/courseService.ts) before interpolating courseId into the URL template. If validation fails, throw an error or return an appropriate response. This neutralizes SSRF vectors by ensuring only legitimate path segments are used for request URLs.

No changes to src/lib/apiClient.ts are needed; all validation should happen at the boundary where tainted data enters the system.


Suggested changeset 1
src/lib/services/courseService.ts
Outside changed files

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/lib/services/courseService.ts b/src/lib/services/courseService.ts
--- a/src/lib/services/courseService.ts
+++ b/src/lib/services/courseService.ts
@@ -16,5 +16,10 @@
 };
 
 export const getCourse = async (courseId: string): Promise<IApiResponse<{ course: Course }>> => {
+  // Only allow course IDs matching UUID (common) or restrict to alphanumeric/hyphen/underscore
+  const COURSE_ID_REGEX = /^[A-Za-z0-9-_]{1,64}$/;
+  if (!COURSE_ID_REGEX.test(courseId)) {
+    throw new Error("Invalid courseId");
+  }
   return GET<{ course: Course }>(`${COURSE_API_BASE_URL}/api/v1/courses/${courseId}`);
 };
EOF
@@ -16,5 +16,10 @@
};

export const getCourse = async (courseId: string): Promise<IApiResponse<{ course: Course }>> => {
// Only allow course IDs matching UUID (common) or restrict to alphanumeric/hyphen/underscore
const COURSE_ID_REGEX = /^[A-Za-z0-9-_]{1,64}$/;
if (!COURSE_ID_REGEX.test(courseId)) {
throw new Error("Invalid courseId");
}
return GET<{ course: Course }>(`${COURSE_API_BASE_URL}/api/v1/courses/${courseId}`);
};
Copilot is powered by AI and may make mistakes. Always verify output.
@gemini-code-assist
Copy link

Summary of Changes

Hello @sanjaysah101, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request represents a substantial overhaul of the project's foundational technologies and user interface. The primary goal was to modernize the application by upgrading key dependencies to their latest versions, enhancing the user experience with new and improved UI components, and streamlining the backend interaction through a centralized API client. This includes a complete refactoring of the authentication process, the introduction of a new OTP verification flow, and a significant redesign of the dashboard and user settings areas. The changes aim to improve performance, maintainability, and prepare the codebase for future feature development.

Highlights

  • Major Dependency Upgrades: The project has undergone a significant upgrade of core dependencies, including Next.js to v15.3.3, React to v19.1.0, Tailwind CSS to v4.0, and various Radix UI components to their latest stable versions. This brings performance improvements, new features, and better maintainability.
  • Refactored Authentication Flow: The authentication system has been completely revamped. Server-side actions for login/signup have been replaced with a new client-side apiClient and dedicated services (authService.ts, userService.ts). A new OTP verification flow with a dedicated page and modal (/verify-otp) has been introduced, along with session storage for auth actions.
  • Enhanced UI/UX Components: Many UI components have been updated and new ones introduced, including a new sonner toast notification system (replacing shadcn/ui Toast), InputOTP for OTP entry, Calendar, Popover, ScrollArea, Tabs, and a CommandMenu for quick navigation. Existing components like Button, Card, Dialog, DropdownMenu, Input, Label, Password, Select, Sheet, Sidebar, Table, Textarea, and Tooltip have received styling and functionality enhancements.
  • Improved Dashboard and Settings Layouts: The dashboard now features a new layout with dedicated sidebar and top navigation components (DashboardSidebar, DashboardNavbar). The settings section has been restructured with a new layout (/dashboard/settings) including a sidebar navigation for different settings categories (Profile, Account) and new forms (AccountForm, ProfileForm). New dashboard overview components using recharts have also been added.
  • Centralized API Services and Error Handling: A new apiClient.ts has been implemented for making server-side requests, including robust token refresh logic and centralized error handling. This replaces the previous api.ts and fetch.ts modules, leading to a more consistent and resilient API interaction layer.
  • Codebase Restructuring and Modernization: The project structure has been reorganized, particularly for authentication-related components and hooks, moving them into src/app/(auth) and src/app/(protected) directories. ESLint configuration has been migrated to a flat config (eslint.config.mjs), and Tailwind CSS configuration has been updated for v4.0.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/codeql.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This is a massive and impressive pull request that upgrades major dependencies (Next.js, React, Tailwind CSS) and refactors large parts of the application architecture. The move to a dedicated service layer, modern ESLint configuration, and improved authentication flow are excellent architectural improvements. I've identified a few areas with placeholder code and opportunities for improved type safety that should be addressed, but overall, this is a high-quality contribution that significantly modernizes the codebase.

Comment on lines +31 to +33
<Link href="#" className="text-blue-500 hover:underline">
Forget password?
</Link>

Choose a reason for hiding this comment

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

medium

The "Forget password?" link currently points to href="#", which is a placeholder. This should be updated to point to the actual password reset page or removed if the functionality is not yet implemented.

import { checkUsernameAvailability } from "@/lib/services";

const useUserInput = () => {
const { isPending, mutate, data, error } = useMutation<any, Error, any>({

Choose a reason for hiding this comment

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

medium

The useMutation hook is using any for its generic types. To improve type safety, these should be replaced with specific types. Based on the checkUsernameAvailability service, the types should be useMutation<IApiResponse<{ isAvailable: boolean }>, Error, { username: string }>.

Suggested change
const { isPending, mutate, data, error } = useMutation<any, Error, any>({
const { isPending, mutate, data, error } = useMutation<IApiResponse<{ isAvailable: boolean }>, Error, { username: string }>({

Comment on lines +31 to +35
const handleVerificationSuccess = (data: any) => {
// This callback is triggered when OTP is successfully verified via the modal
console.log("Verification successful, received data:", data);
router.replace("/dashboard");
};

Choose a reason for hiding this comment

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

medium

The handleVerificationSuccess function contains a console.log and its data parameter is typed as any. The console.log should be removed for production code, and the parameter should be properly typed based on the expected API response for better type safety.

  const handleVerificationSuccess = (data: { actionToken: AuthToken }) => {
    // This callback is triggered when OTP is successfully verified via the modal
    router.replace("/dashboard");
  };

Comment on lines +5 to +10
return (
<>
<DashboardPage />
<Dashboard />
</>
);

Choose a reason for hiding this comment

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

medium

This page currently renders two different dashboard components, <DashboardPage /> and <Dashboard />. This appears to be temporary code for development or comparison. Please clean this up to render only the single, intended dashboard component.

  return (
    <>
      <Dashboard />
    </>
  );

Comment on lines +59 to +62
function onSubmit(data: AccountFormValues) {
// showSubmittedData(data);
console.log(data);
}

Choose a reason for hiding this comment

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

medium

The onSubmit function for the account form currently only logs the data to the console. This placeholder logic should be replaced with the actual implementation for submitting the form data to the backend.


return (
<Form {...form}>
<form onSubmit={form.handleSubmit(console.log)} className="space-y-8">

Choose a reason for hiding this comment

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

medium

The onSubmit function for the profile form logs the form data to the console. This is placeholder logic and should be implemented to actually submit the data to the backend API.

headers: { ...(res.headers as Record<string, string>) },
});
} catch (err: any) {
console.log({ err });

Choose a reason for hiding this comment

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

medium

A console.log is present in the error handling catch block. For production environments, this should be removed or replaced with a structured logging service to ensure that errors are tracked effectively without exposing sensitive information in logs.

Comment on lines +22 to 24
} = useForm<Course | CreateCourse>({
resolver: zodResolver(CreateCourse),
defaultValues: {

Choose a reason for hiding this comment

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

medium

The useForm hook is typed with Course | CreateCourse. For a creation form, it's cleaner to use only the CreateCourse type, as an id won't be present. Additionally, the onSubmit function is typed with data: Course, which is inconsistent. Aligning these types to consistently use CreateCourse will improve type safety.

Suggested change
} = useForm<Course | CreateCourse>({
resolver: zodResolver(CreateCourse),
defaultValues: {
} = useForm<CreateCourse>({
resolver: zodResolver(CreateCourse),

@sanjaysah101 sanjaysah101 merged commit 82da3b6 into dev Oct 4, 2025
1 of 2 checks passed
@sanjaysah101 sanjaysah101 deleted the 33-upgrade-packages branch October 4, 2025 18:00
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.

🔼 Upgrade Next.js and React to Latest Stable Versions

2 participants