-
Notifications
You must be signed in to change notification settings - Fork 28
Job posts fix #155
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
Job posts fix #155
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdds a global Prisma client declaration and an unconditional connect call; replaces direct Prisma calls in the jobs API with type-casts to bypass TypeScript checks; and applies broad UI styling changes (mostly dashed borders, spacing, and normalized icon sizing) across job-related components. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant NextAPI as Next.js API Route
participant Prisma as Prisma Client
Client->>NextAPI: GET /api/jobs (or POST create)
Note right of NextAPI: Route uses (prisma as any).job.*\n(ensure prisma is connected)
NextAPI->>Prisma: Ensure prisma.$connect() (called at init)
NextAPI->>Prisma: job.findMany / job.count / job.create
Prisma-->>NextAPI: Query result
NextAPI-->>Client: Response (jobs / created job)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Files/areas to focus on:
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 2 inconclusive)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/app/api/jobs/route.ts (1)
89-112: Remove type casting and fix the underlying Prisma type issue.Casting
prismatoany(lines 89, 112, and 187) completely bypasses TypeScript's type checking, which defeats the purpose of using TypeScript and Prisma's generated types. This approach is brittle and could allow invalid queries or schema mismatches to pass compilation.The proper solution is to ensure the Prisma client is correctly generated and typed. Run the following to verify and regenerate:
#!/bin/bash # Verify Prisma client generation and schema # Check if Prisma schema exists and is valid echo "=== Checking Prisma schema ===" fd -e prisma -x cat {} # Check if @prisma/client is properly installed echo -e "\n=== Checking Prisma client installation ===" cat package.json | jq '.dependencies."@prisma/client", .devDependencies.prisma' # Check if node_modules/.prisma/client exists echo -e "\n=== Checking generated Prisma client ===" fd -t d -p "node_modules/.prisma/client" -x ls -la {}After verification, regenerate the Prisma client:
npx prisma generateThen remove the
as anycasts and use the properly typedprisma.jobmethods directly.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (6)
src/app/api/jobs/route.ts(3 hunks)src/app/jobs/page.tsx(3 hunks)src/components/jobs/JobCard.tsx(4 hunks)src/components/jobs/JobSearch.tsx(3 hunks)src/components/jobs/JobsPage.tsx(3 hunks)src/lib/prisma.ts(2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-11-23T11:57:43.371Z
Learnt from: Ankur1493
Repo: tyaga001/devtoolsacademy PR: 39
File: src/lib/tools.ts:1-1
Timestamp: 2024-11-23T11:57:43.371Z
Learning: In `src/lib/tools.ts`, creating a new `PrismaClient` instance for each request is acceptable in this project and does not cause connection pool exhaustion due to previous optimizations.
Applied to files:
src/lib/prisma.ts
📚 Learning: 2025-04-14T07:46:36.019Z
Learnt from: tyaga001
Repo: tyaga001/devtoolsacademy PR: 110
File: package.json:39-39
Timestamp: 2025-04-14T07:46:36.019Z
Learning: The "prisma" package should be placed in devDependencies rather than dependencies, as it's only needed during development. The "prisma/client" package should remain in dependencies as it's used at runtime.
Applied to files:
src/lib/prisma.ts
🧬 Code graph analysis (1)
src/components/jobs/JobCard.tsx (3)
src/components/ui/card.tsx (4)
Card(77-77)CardHeader(77-77)CardContent(77-77)CardFooter(77-77)src/components/ui/badge.tsx (1)
Badge(39-39)src/lib/utils.ts (1)
formatDate(14-20)
🪛 GitHub Actions: Node.js CI
src/lib/prisma.ts
[error] 4-4: 'prisma' is defined but never used. (no-unused-vars)
🔇 Additional comments (4)
src/components/jobs/JobCard.tsx (1)
47-135: LGTM! Cohesive UI refresh with improved visual hierarchy.The styling updates successfully implement a consistent dashed-border design system while improving readability and visual hierarchy. The featured badge repositioning to the top-right (lines 48-52) creates better visual prominence, and the uniform application of dashed borders across detail blocks maintains design consistency throughout the card.
src/components/jobs/JobSearch.tsx (1)
85-111: LGTM! Styling updates align with the broader design refresh.The dashed border styling and layout adjustments maintain consistency with the updated JobCard and JobsPage components, creating a cohesive visual language across the jobs interface.
src/components/jobs/JobsPage.tsx (1)
110-160: LGTM! Consistent UI polish across empty states and job grid.The styling updates maintain visual consistency with the dashed-border design system introduced across other job components, while the tightened grid gap (line 160) improves information density on larger screens.
src/app/jobs/page.tsx (1)
48-106: LGTM! Effective hero redesign with improved visual hierarchy.The hero section updates successfully integrate the dashed-border design language while improving content hierarchy. The gradient text treatment (lines 52-55), restructured CTA card (lines 85-106), and refined spacing create a more polished landing experience that aligns with the component-level styling updates throughout the PR.
There was a problem hiding this 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/jobs/JobSubmissionForm.tsx (1)
212-257: Fix contact name error binding; label/id changes look goodThe new
htmlFor/idwiring for contact name/email improves accessibility and is correct, but the error block under “Contact name” is still checking and renderingerrors.contactEmail. That means name-specific validation errors won’t show.Suggested fix:
- {errors.contactEmail && ( + {errors.contactName && ( <p className="mt-2 text-sm text-red-600"> - {errors.contactEmail} + {errors.contactName} </p> )}
🧹 Nitpick comments (2)
src/components/jobs/JobSubmissionForm.tsx (2)
139-194: Unreachable success state; consider wiring it up or removing it
submitSuccessis never set totrue, so this success card UI is effectively dead code even as a Stripe redirect fallback. Either:
- set
submitSuccess(true)somewhere on successful submission when you intend to fall back to this UI, or- remove this branch and state if you’ve decided the redirect is the only happy path.
451-525: List field labels are good; consider accessibility for icon-only buttonsThe new labels/ids for Categories, Requirements, Benefits, and Tags correctly match their respective inputs and fields, and the
Plus/Xicon sizing aligns with yoursize-*convention.One improvement: the “add” and “remove” buttons in these sections are icon-only, so they currently have no accessible name for screen readers.
Consider something along these lines:
- <Button ...> - <Plus className="size-4" /> - </Button> + <Button ... aria-label="Add category"> + <Plus className="size-4" /> + </Button> ... - <button - type="button" - onClick={() => removeArrayItem("categories", index)} - className="text-blue-300 hover:text-blue-100" - > - <X className="size-3" /> - </button> + <button + type="button" + onClick={() => removeArrayItem("categories", index)} + className="text-blue-300 hover:text-blue-100" + aria-label={`Remove category ${category}`} + > + <X className="size-3" /> + </button>and similarly for requirements, benefits, and tags.
Also applies to: 528-585, 587-643, 646-701
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/components/jobs/JobSkeleton.tsx(1 hunks)src/components/jobs/JobSubmissionForm.tsx(27 hunks)src/components/jobs/JobsPagination.tsx(2 hunks)src/components/jobs/LoadingCategories.tsx(1 hunks)src/lib/prisma.ts(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- src/components/jobs/JobSkeleton.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- src/lib/prisma.ts
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2024-11-30T20:41:53.463Z
Learnt from: Ankur1493
Repo: tyaga001/devtoolsacademy PR: 44
File: src/components/tools/ToolsPagination.tsx:19-19
Timestamp: 2024-11-30T20:41:53.463Z
Learning: In `src/components/tools/ToolsPagination.tsx`, the application handles invalid page numbers by showing a proper error, so additional input validation for the page parameter is not required.
Applied to files:
src/components/jobs/JobsPagination.tsx
📚 Learning: 2024-11-30T20:29:45.779Z
Learnt from: Ankur1493
Repo: tyaga001/devtoolsacademy PR: 44
File: src/components/tools/ToolCard.tsx:19-23
Timestamp: 2024-11-30T20:29:45.779Z
Learning: In the `src/components/tools/ToolCard.tsx` file, it's acceptable to use `tool.logo` directly in the `img` `src` attribute without additional validation because the image URLs are controlled by the backend, and overengineering is to be avoided before the MVP is complete.
Applied to files:
src/components/jobs/JobSubmissionForm.tsx
📚 Learning: 2024-11-23T12:17:36.011Z
Learnt from: Ankur1493
Repo: tyaga001/devtoolsacademy PR: 39
File: src/components/tools/toolDetails/ToolDetailsPage.tsx:186-197
Timestamp: 2024-11-23T12:17:36.011Z
Learning: In `src/components/tools/toolDetails/ToolDetailsPage.tsx`, the `ToolDetailsPage` component contains a hardcoded description in the about section.
Applied to files:
src/components/jobs/JobSubmissionForm.tsx
🧬 Code graph analysis (1)
src/components/jobs/LoadingCategories.tsx (2)
src/components/tools/LoadingCategories.tsx (2)
LoadingCategories(3-34)_(17-28)src/components/jobs/JobCategories.tsx (4)
_(142-155)categories(125-125)a(125-125)category(50-76)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build (20.x)
- GitHub Check: build (18.x)
🔇 Additional comments (6)
src/components/jobs/JobSubmissionForm.tsx (4)
145-183: Success state icon sizing changes are consistentThe updated
size-*classes on the success icon wrapper andArrowLeftkeep visuals consistent with the rest of the job UI while preserving behavior. No issues here.
263-305: Company name/logo label wiring and styling are solidThe
htmlFor/idadditions forcompanyandcompanyLogocorrectly associate labels with inputs, and the Tailwind class reordering doesn’t change behavior. Looks good.
310-424: Job details, type dropdown, and description updates are coherentThe added
htmlFor/idpairs for title, apply URL, location, job type, salary, and description improve accessibility and match the bound fields. The job type dropdown styling (button classes,ChevronDownsize,DropdownMenuContentborder/background) is purely presentational and consistent with the rest of the UI. No functional issues spotted.Also applies to: 429-445
706-720: Submit button and loader sizing look appropriateStandardizing the submit button classes and using
size-4onLoader2keeps the CTA visually consistent; disabling while submitting is already correctly handled.src/components/jobs/JobsPagination.tsx (1)
131-155: Chevron icon sizing change is safe and consistentUpdating
ChevronLeftandChevronRightto usesize-4is a purely visual Tailwind change and keeps pagination controls consistent with other icons in the app. No functional impact.src/components/jobs/LoadingCategories.tsx (1)
17-23: Loading skeleton class tweak is benignThe updated class list on the loading pill keeps the same dimensions and behavior (
animate-pulse, rounded, dark background). No issues from this change.
Pull Request
Summary
Type of Change
Changes Made
Testing
npm run build)Database Changes (if applicable)
Content Changes (if applicable)
src/lib/toolData.jsonUI/UX Changes (if applicable)
Checklist
Screenshots/Demo
Related Issues
Additional Notes
Summary by CodeRabbit
Style
Accessibility
✏️ Tip: You can customize this high-level summary in your review settings.