✨ [SCRUM-33] FE 프로필 API 연동#45
Hidden character warning
Conversation
There was a problem hiding this comment.
Hello @Kristyn-Yoon, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request focuses on integrating the profile API with the frontend. It includes fetching user profile data (level, experience, completed todos, name, email) and character collection data, as well as updating user information via PUT requests. The changes involve creating new API functions, modifying components to use the fetched data, and updating the profile modal to handle user input and data submission.
Highlights
- API Integration: Integrates profile and character APIs to fetch user data and display it on the profile page.
- Data Display: Modifies components like
ProfileHeaderContent,UserStats, andCharacterGridto display data fetched from the API. - Profile Update: Implements functionality to update user data (sex, age, job) through a modal form.
Changelog
Click here to see the changelog
- apis/character.ts
- Defines
CharacterResponsetype. - Implements
getCharacterItemsfunction to fetch character collection data for a user.
- Defines
- apis/profile.ts
- Defines
ProfileResponseandProfileRequesttypes. - Implements
getProfileItemsfunction to fetch user profile data. - Implements
updateUserDatafunction to update user profile information.
- Defines
- components/service/profile/CharacterCard.tsx
- Updates
Imagecomponentsrcto accept direct image links instead of local paths. - Adds conditional styling to display locked characters in grayscale.
- Updates
- components/service/profile/CharacterGrid.tsx
- Updates the
charactersprop type definition to includename.
- Updates the
- components/service/profile/CharacterGridHeader.tsx
- Accepts
characterCountas a prop to display the number of collected characters. - Updates the display to show the dynamic
characterCount.
- Accepts
- components/service/profile/Profile.tsx
- Fetches profile and character data using
getProfileItemsandgetCharacterItems. - Uses
useStateanduseEffecthooks to manage profile and character data. - Passes fetched data to child components for display.
- Fetches profile and character data using
- components/service/profile/ProfileHeaderContent.tsx
- Accepts
id,name, andemailas props to display user information. - Passes
idandemailprops to theProfileModalcomponent.
- Accepts
- components/service/profile/ProfileModal/ProfileModal.tsx
- Accepts
idandemailas props. - Implements form submission logic to update user data using
updateUserData. - Adds loading state and error handling for the form submission.
- Displays the user's email as the ID in the modal.
- Accepts
- components/service/profile/UserStats.tsx
- Accepts
level,exp, andcompletedTodoCountas props to display user statistics. - Updates the component to display dynamic user statistics.
- Accepts
- next.config.ts
- Configures image domains to allow images from 'gugitsa.blob.core.windows.net'.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
APIs connect,
Data flows, a profile shown,
Users now update.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces the profile API integration, including fetching and updating user profile information and character data. The changes involve creating new API functions, updating components to use the new API data, and modifying the profile modal to allow users to update their information. Overall, the code is well-structured and addresses the intended functionality.
Summary of Findings
- Error Handling in API Calls: The API calls in
apis/profile.tsandapis/character.tshave similar error handling blocks. Consider creating a reusable function to handle API errors consistently across the application. This will reduce code duplication and improve maintainability. - Data Validation Before API Call: In
ProfileModal.tsx, there's a check forisNaN(ageValue) || ageValue <= 0before callingsaveProfile. It would be better to rely on the zod schema validation to handle this, rather than doing it manually. - Loading State Management: The loading state in
Profile.tsxcould be improved by providing a more informative loading message or a skeleton UI to enhance the user experience.
Merge Readiness
The pull request is almost ready for merging. Addressing the error handling and data validation suggestions would improve the code quality and robustness. I am unable to directly approve the pull request, and recommend that others review and approve this code before merging. At a minimum, the high severity comments should be addressed before merging.
Explain this Pull Request 🙏
What has changed? 🤔
Whether needed review 🖍
Document🗒️ (Optional)
Screenshot 📸 (Optional)
api.mp4
Test Checklist ✅ (Optional)