-
Notifications
You must be signed in to change notification settings - Fork 2
Add user profile detail page (新增用户详情页) #57
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?
Conversation
Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
TechQuery
left a 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.
…tly, remove user index - Revert components/Git/Issue/Card.tsx to original synchronous markdown rendering - Delete package-lock.json and add to .gitignore (use pnpm instead) - Replace mock user data with direct API call to freeCodeCamp - Remove pages/user/index.tsx (not needed currently) Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
TechQuery
left a 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.
@copilot 根据我修正后的类型和接口逻辑去修正界面
- Update property names to match FCCUserProfile type (bio→about, avatar→picture, linkedin→linkedIn) - Use usernameDisplay field for display name - Fix completedChallenges to use array length - Remove fields not in type (twitter, currentStreak, longestStreak, certifications) - Add error handling to return 404 when API fails - Simplify stats display to show points and completed challenges count Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Updated in commit abaaa35. The UI now correctly uses the Property changes:
Removed fields not in the type:
Error handling: Added try-catch to return 404 when API fails (since freeCodeCamp API is not accessible outside their ecosystem). The page now displays: user picture, name/username, location, about text, social links (GitHub, LinkedIn, Website), points, and completed challenges count. |
[add] GitHub OAuth middleware & API proxy
36c8597 to
317558d
Compare
Checklist(清单):
Closes #56
Changes
Implements user profile page for freeCodeCamp users as referenced in the issue:
https://api.freecodecamp.org/users/get-public-profile?username=tech_queryhttps://www.freecodecamp.org/tech_queryImplementation
New Route:
/user/[username]- Dynamic user profile (e.g.,/user/tech_query)New Files:
pages/api/user.ts- API client with proper TypeScript types (FCCUserProfile) that fetches user data directly from freeCodeCamp API using koajaxpages/user/[username].tsx- Server-side rendered profile page with proper type safetyProfile Features:
usernameDisplayfallback), location, aboutAPI Integration
The implementation calls
https://api.freecodecamp.org/users/get-public-profile?username={username}using koajax HTTP client. The API is not accessible outside the freeCodeCamp ecosystem (as noted in the issue), so the page returns 404 until deployed within the freeCodeCamp infrastructure.Type Safety: The UI correctly uses the
FCCUserProfiletype with proper field mappings:picturefield for avataraboutfield for bio textlinkedIn(correct camelCase) for LinkedIn linkusernameDisplayfor display namecompletedChallengesas an array and uses.lengthfor countProject Configuration
Switched to pnpm for package management
Added
package-lock.jsonto.gitignoreFixes 新增用户详情页 #56
Original prompt
Human changes
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.