-
Notifications
You must be signed in to change notification settings - Fork 1
fix: swap URL and Short Code inputs order (#10) #13
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
base: main
Are you sure you want to change the base?
fix: swap URL and Short Code inputs order (#10) #13
Conversation
WalkthroughThe create-url-dialog component reorders its form fields, placing Short Code before URL. Input types are reassigned, a validation hint is added to Short Code, and error display is restructured to show validation messages adjacent to their respective fields. Changes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✨ Finishing touches
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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/create-url-dialog.tsx(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use 2-space indentation, semicolons as needed, and ES5 trailing commas; configure Biome for auto-formatting on save
Files:
src/components/create-url-dialog.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Auto-organize imports on save with Biome; exclude shadcn/ui components from Biome formatting
Files:
src/components/create-url-dialog.tsx
src/components/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/components/**/*.{ts,tsx}: Use shadcn/ui components with 'new-york' style and slate base color
Mark interactive components as client components; use React hooks for state management in client components
Use Sonner for toast notifications with standard error handling patterns
Call/api/urlsendpoints directly from frontend components via standard fetch with JSON; handle errors via toast notifications
Files:
src/components/create-url-dialog.tsx
🧠 Learnings (2)
📚 Learning: 2025-12-05T21:25:30.018Z
Learnt from: CR
Repo: PoliNetworkOrg/polinet.cc PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T21:25:30.018Z
Learning: Applies to src/app/[shortCode]/page.tsx : Implement URL redirection via Next.js dynamic routes at `src/app/[shortCode]/page.tsx`
Applied to files:
src/components/create-url-dialog.tsx
📚 Learning: 2025-12-05T21:25:30.018Z
Learnt from: CR
Repo: PoliNetworkOrg/polinet.cc PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T21:25:30.018Z
Learning: Applies to src/lib/url-service.ts : Generate short codes as 8-character nanoids in `UrlService.createShortUrl()`
Applied to files:
src/components/create-url-dialog.tsx
🧬 Code graph analysis (1)
src/components/create-url-dialog.tsx (2)
src/components/ui/label.tsx (1)
Label(24-24)src/components/ui/input.tsx (1)
Input(23-23)
🔇 Additional comments (3)
src/components/create-url-dialog.tsx (3)
75-83: LGTM! Good UX improvements.The Short Code field is now positioned first with appropriate type, placeholder, and validation hint. The
titleattribute on Line 82 is a nice touch that provides users with inline validation guidance.
85-90: LGTM! Proper error handling.The error display for Short Code is correctly implemented with proper accessibility attributes and safe error rendering using optional chaining.
92-99: LGTM! URL field correctly repositioned.The URL field is now properly positioned as the second field with the correct input type and descriptive placeholder.
| <span | ||
| id={fields.url.errorId} | ||
| className="text-xs col-start-2 col-span-3 text-red-600 text-center" | ||
| > | ||
| {fields.url.errors} | ||
| </span> |
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.
Inconsistent error handling pattern.
Line 105 displays fields.url.errors directly, while Line 89 uses fields.shortCode.errors?.join(", "). Both fields should handle errors consistently since @conform-to/react typically returns error arrays.
Apply this diff to ensure consistent error handling:
- {fields.url.errors}
+ {fields.url.errors?.join(", ")}📝 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.
| <span | |
| id={fields.url.errorId} | |
| className="text-xs col-start-2 col-span-3 text-red-600 text-center" | |
| > | |
| {fields.url.errors} | |
| </span> | |
| <span | |
| id={fields.url.errorId} | |
| className="text-xs col-start-2 col-span-3 text-red-600 text-center" | |
| > | |
| {fields.url.errors?.join(", ")} | |
| </span> |
🤖 Prompt for AI Agents
In src/components/create-url-dialog.tsx around lines 101 to 106, the URL field
error is rendered directly as fields.url.errors but the shortCode field uses
fields.shortCode.errors?.join(", "), so update the URL error rendering to mirror
that pattern: call fields.url.errors?.join(", ") (or fallback to an empty
string) so errors array is joined into a single string for display and
null/undefined is handled safely.
Swapped the order of the URL and Short Code inputs in the create dialog to improve UX.
Also moved the error messages to ensure they appear below the correct input fields.
Closes #10