Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference path="./.next/types/routes.d.ts" />
import "./.next/types/routes.d.ts";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Next.js 15 typed routes configuration next-env.d.ts correct syntax

💡 Result:

In Next.js 15, you should not manually edit the next-env.d.ts file [1][2][3]. This file is automatically generated and managed by Next.js whenever you run next dev, next build, or next typegen [1][2]. Modifying it will result in your changes being overwritten [1][2]. To enable and configure typed routes, follow these steps: 1. Enable typedRoutes: Open your next.config.js (or next.config.ts) and set typedRoutes to true [4]. // next.config.ts import type { NextConfig } from 'next'; const nextConfig: NextConfig = { typedRoutes: true, }; export default nextConfig; 2. Ensure tsconfig.json configuration: Your tsconfig.json must include the generated type definitions [1][2]. This is usually handled automatically by create-next-app, but you should verify that your include array contains the following paths [1][2]: { "include": [ "next-env.d.ts", ".next/types//.ts", "/.ts", "/.tsx" ] } 3. Custom Type Declarations: If you need to add your own custom type declarations, do not add them to next-env.d.ts [1][2]. Instead, create a separate file (e.g., custom-types.d.ts) and add that filename to the include array in your tsconfig.json [1][2][3]. How it works: When typedRoutes is enabled, Next.js generates a hidden directory at.next/types that contains information about all valid routes in your application [1][2]. By including.next/types//.ts in your tsconfig.json, the TypeScript compiler can access these generated types to provide real-time validation and autocompletion for href values in components like next/link and methods in next/navigation [1][2]. Important notes: - Version Control: It is recommended to add next-env.d.ts to your.gitignore file, as it is generated dynamically [1][2][3]. - CI/CD: If you perform separate type checking in your CI pipeline, ensure you run next typegen before your type checker (e.g., tsc --noEmit) to ensure the route types are up to date [5].

Citations:


🏁 Script executed:

#!/bin/bash
# Check if next-env.d.ts is generated by Next.js commands
echo "Searching for Next.js type generation references..."
rg -n "next-env\.d\.ts" --type-add 'config:*.{json,js,mjs,ts}' --type config -C2

# Check package.json scripts that might regenerate types
cat package.json | jq -r '.scripts | to_entries[] | select(.value | contains("next")) | "\(.key): \(.value)"'

Repository: SheCanCODE-Capstone-Projects/Med-Delivery-System-FE

Length of output: 666


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== next-env.d.ts (repo contents) ==="
if [ -f next-env.d.ts ]; then nl -ba next-env.d.ts | sed -n '1,120p'; else echo "next-env.d.ts not found at repo root"; fi

echo
echo "=== Search for typedRoutes config ==="
rg -n --hidden --glob 'next.config.*' "typedRoutes" . || true
rg -n --hidden "typedRoutes" . || true

echo
echo "=== Search for manual edits/mentions of .next/types/routes.d.ts ==="
rg -n --hidden "routes\.d\.ts" . || true
rg -n --hidden "next-env\.d\.ts" . || true

echo
echo "=== .gitignore entries for next-env.d.ts ==="
if [ -f .gitignore ]; then rg -n "next-env\.d\.ts" .gitignore || true; fi

Repository: SheCanCODE-Capstone-Projects/Med-Delivery-System-FE

Length of output: 194


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== next-env.d.ts (repo contents) ==="
if [ -f next-env.d.ts ]; then
  echo "found next-env.d.ts"
  cat -n next-env.d.ts | sed -n '1,160p'
else
  echo "next-env.d.ts not found at repo root"
fi

echo
echo "=== Search for typedRoutes config ==="
rg -n --hidden --glob 'next.config.*' "typedRoutes" . || true
rg -n --hidden "typedRoutes" . || true

echo
echo "=== Search for manual edits/mentions of .next/types/routes.d.ts ==="
rg -n --hidden "routes\.d\.ts" . || true
rg -n --hidden "next-env\.d\.ts" . || true

echo
echo "=== .gitignore entries for next-env.d.ts ==="
if [ -f .gitignore ]; then rg -n "next-env\.d\.ts" .gitignore || true; else echo "no .gitignore"; fi

Repository: SheCanCODE-Capstone-Projects/Med-Delivery-System-FE

Length of output: 780


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== next.config.* files ==="
fd -a -t f -g 'next.config.*' . || true
echo

for f in $(fd -a -t f -g 'next.config.*' .); do
  echo "=== $f (first 200 lines) ==="
  sed -n '1,200p' "$f"
  echo
done

echo "=== Look for typedRoutes mention anywhere ==="
rg -n --hidden "typedRoutes" . || true

echo "=== Does repo contain .next/types/routes.d.ts (usually not committed)? ==="
if [ -f .next/types/routes.d.ts ]; then
  echo "found .next/types/routes.d.ts"
  sed -n '1,120p' .next/types/routes.d.ts
else
  echo ".next/types/routes.d.ts not present in repo working tree"
fi

Repository: SheCanCODE-Capstone-Projects/Med-Delivery-System-FE

Length of output: 961


🌐 Web query:

next-env.d.ts import "./.next/types/routes.d.ts"; Next.js typed routes next-env.d.ts should not be edited syntax

💡 Result:

The file next-env.d.ts is an auto-generated file in Next.js projects that ensures TypeScript recognizes Next.js type definitions, such as those for non-code imports (e.g., images, stylesheets) and route types [1][2]. You should never manually edit this file [3][2]. Because it is automatically regenerated by Next.js commands like next dev, next build, and next typegen, any manual changes will be overwritten [2]. Key takeaways regarding next-env.d.ts: 1. Do not edit or remove it: The file is managed entirely by the Next.js framework [3][2]. 2. Version control: It is recommended to add next-env.d.ts to your.gitignore file to avoid unnecessary churn in version control, as the file content can change based on the last command run (e.g., dev vs. build) [4][2][5]. 3. Generation in CI: If your CI pipeline requires type checking (e.g., via tsc), you must ensure the file exists. You can generate it by running npx next typegen before your type-checking command [4][6][5]. 4. Custom types: If you need to add custom TypeScript declarations, create a separate.d.ts file and include it in your tsconfig.json file, rather than attempting to modify next-env.d.ts [3][1][2]. The import statement import "./.next/types/routes.d.ts"; is a standard part of this auto-generated file when the experimental typedRoutes feature is enabled [1][2]. It allows Next.js to provide type-safe hrefs for components like next/link [2].

Citations:


Stop manually editing next-env.d.ts; configure typed routes via next.config.mjs and let Next regenerate it.

next-env.d.ts is annotated as “This file should not be edited” but it now includes import "./.next/types/routes.d.ts";. Since next.config.mjs does not enable typedRoutes, this routes import likely came from a previous typegen run—update typed routes configuration (typedRoutes: true) and regenerate, or revert/remove the manual routes.d.ts import so type generation matches the current config.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@next-env.d.ts` at line 3, The file next-env.d.ts contains a manual import
import "./.next/types/routes.d.ts" that conflicts with the “do not edit” rule;
either enable typed routes in your Next config (set typedRoutes: true in
next.config.mjs) and re-run Next/typegen to regenerate next-env.d.ts and
.next/types/routes.d.ts, or remove the manual import line from next-env.d.ts so
the generated types reflect the current config; update next.config.mjs and
regenerate (or revert the import) to restore correct automated type generation.


// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
36 changes: 22 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/app/auth/set-password/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ function SetPasswordForm() {

setLoading(true);
try {
const auth = await setPassword({ token, password });
const auth =await setPassword({
username: "",
otp: token,
password
});
Comment on lines +41 to +45

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Do not send an empty username in the set-password request.

At Line 42, username is hardcoded to "". Since setPassword forwards this payload directly, this can fail backend validation and block activation.

Proposed fix
   const searchParams = useSearchParams();
   const token = searchParams.get("token") ?? "";
+  const username = searchParams.get("username") ?? "";

@@
-    if (!token) {
-      setError("Invalid or missing activation token. Please use the link from your email.");
+    if (!token || !username) {
+      setError("Invalid activation link. Please use the latest link from your email.");
       return;
     }

@@
       const auth =await setPassword({
-        username: "",
+        username,
         otp: token,
         password
       });
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const auth =await setPassword({
username: "",
otp: token,
password
});
const searchParams = useSearchParams();
const token = searchParams.get("token") ?? "";
const username = searchParams.get("username") ?? "";
if (!token || !username) {
setError("Invalid activation link. Please use the latest link from your email.");
return;
}
const auth =await setPassword({
username,
otp: token,
password
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/auth/set-password/page.tsx` around lines 41 - 45, The setPassword
call is sending a hardcoded empty username ("") which can fail backend
validation; replace the empty string with the real username value (e.g., the
username/email from component props/state or from URL/searchParams) or omit the
username property entirely if the API derives it from the otp/token; update the
call to setPassword({ username: <actualUsername>, otp: token, password }) (or
remove username) and ensure the source used (searchParams, form state, or a
parent prop) is populated before invoking setPassword.

setSuccess(true);
setTimeout(() => router.push(roleToRoute(auth.role)), 1500);
} catch (err) {
Expand Down
6 changes: 5 additions & 1 deletion src/app/auth/verify-otp/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ function SetPasswordStep({
setLoading(true);
setError("");
try {
await setPassword({ username, otp, password });
await setPassword({
username,
otp,
password
});
onDone();
} catch (err) {
setError(err instanceof Error ? err.message : "Failed to set password. Please try again.");
Expand Down
1 change: 1 addition & 0 deletions src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export interface PaymentResponse {
failureReason?: string;
createdAt: string;
paidAt?: string;
patientName?: string;
}

export interface InsuranceCardResponse {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"jsx": "react-jsx",
"plugins": [
{
"name": "next"
Expand Down