Skip to content

Conversation

@muntaxir4
Copy link
Contributor

@muntaxir4 muntaxir4 commented Mar 26, 2025

Closes #48

📝 Description

This PR migrates the project from Vite.js (JavaScript) to Vite + TypeScript, ensuring better type safety, maintainability, and scalability as the project grows. Additionally, it includes various frontend improvements, missing component fixes, and TypeScript enhancements.

The project successfully builds after migration, and functionality was tested and compared against the existing JSX version to ensure no breaking changes. And Nextjs type files were updated to refltect Vite.


🔧 Changes Made

Migrated Vite.js to Vite + TypeScript

  • Installed and configured TypeScript for Vite.
  • Converted key JavaScript files to TypeScript (.ts / .tsx).
  • Added tsconfig.json with proper compiler options.

Installed Tailwind & Setup shadcn Components

  • Installed TailwindCSS using proper methods as mentioned in the docs.
  • Enabled shadcn/ui CLI for component management.

Fixed Missing Components

  • Installed missing UI components that were not previously checked due to build issues:
    • Switch, Textarea, Calendar, Popover.

Fixed Router Usage Issues

  • Replaced next/navigation router in contract-template with react-router-dom’s navigate for consistency.

Improved Auth Context with Proper Types

  • Refactored authentication context to use strongly-typed interfaces.
  • Ensured better type inference for useContext().

Fixed Link Component Issues

  • Updated BasicDetails, ForgotPassword, Login, and ResetPassword components to use to instead of href (React Router standard).

Added Missing Type Definitions

  • Fixed handler functions like onChange, onSubmit to properly use TypeScript types.
  • Ensured FormEvent, ChangeEvent types are correctly applied to forms.

Successfully Built & Tested

  • Project builds successfully after migration.
  • Compared JSX and TypeScript versions to ensure no breaking changes.
  • UI and functionality remain identical to the original JavaScript implementation.

This PR enhances the frontend structure, routing consistency, and developer experience, ensuring a smooth transition to TypeScript with no loss of functionality. 🚀

✅ Checklist

  • I have read the contributing guidelines.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if applicable).
  • Any dependent changes have been merged and published in downstream modules.

[UPDATE 1, Apr 15 5:49AM IST] : Merge conflicts resolved till #55

  • Fixed type errors on Authentication using supabase along with OAuth Google auth #45
    -- await was not used in Login.jsx and useAuth context was previously accessed outside Login component.
    image
    image
    -- await was not used in Signup.jsx handleGoogleSignup and login function was not imported from useAuth.
    image
  • Updated package-lock.json

@Vivekgupta008
Copy link
Contributor

Currently going with the js only. Ig this is not needed now @muntaxir4

@muntaxir4
Copy link
Contributor Author

Currently going with the js only. Ig this is not needed now @muntaxir4

Typescript in Frontend is absolutely required. Not sure why was it initialized with just JS. Contributors were using next js codes here, and not double checking them.
I will fix the merge conflicts.

@muntaxir4
Copy link
Contributor Author

I have updated all the changed files to Typescript in e8e169c

@muntaxir4 muntaxir4 changed the title feat: Migrate Vite.js to Vite + TypeScript & Improve Frontend Setup [ IMPORTANT ] feat: Migrate Vite.js to Vite + TypeScript & Improve Frontend Setup Apr 14, 2025
@ishaanxgupta
Copy link
Contributor

@muntaxir4 You have tried to resolve all the bugs in one PR, Please make small PRs when addressing bugs and attach a working screenshot

@muntaxir4
Copy link
Contributor Author

@muntaxir4 You have tried to resolve all the bugs in one PR, Please make small PRs when addressing bugs and attach a working screenshot

Okay, I will attach the screenshots. But I did not understand how small PRs will affect this. There will be merge conflicts for this PR, as PRs older than this are merged, so unless I address those changes in this PR, this one won't be merged.

I will add commits to resolve all new merge conflicts for PRs merged earlier than this.

@ishaanxgupta
Copy link
Contributor

@muntaxir4 You have tried to resolve all the bugs in one PR, Please make small PRs when addressing bugs and attach a working screenshot

Okay, I will attach the screenshots. But I did not understand how small PRs will affect this. There will be merge conflicts for this PR, as PRs older than this are merged, so unless I address those changes in this PR, this one won't be merged.

I will add commits to resolve all new merge conflicts for PRs merged earlier than this.

I think you got me wrong, I was saying that this PR is fine but in the future when addressing many bugs make single PR for every bug. This way it is easier for maintainer to review the files and merging can be smooth.

@muntaxir4
Copy link
Contributor Author

@chandansgowda can you please review this PR? I have resolved all merge conflicts.

@chandansgowda chandansgowda merged commit 7f19677 into AOSSIE-Org:main May 7, 2025
@chandansgowda
Copy link
Member

Thanks for contributing @muntaxir4

@chandansgowda chandansgowda changed the title [ IMPORTANT ] feat: Migrate Vite.js to Vite + TypeScript & Improve Frontend Setup feat: Migrate Vite.js to Vite + TypeScript & Improve Frontend Setup May 7, 2025
@muntaxir4
Copy link
Contributor Author

Thanks for contributing @muntaxir4

It was my pleasure.

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.

FEATURE REQUEST: Migrate Vite.js to Vite + TypeScript

4 participants