feat(avatar): implement avatar upload in settings#28
Open
Peolite001 wants to merge 1 commit into
Open
Conversation
- Add useAvatarUpload hook with client-side validation - Add AvatarUpload component with preview, progress, and error states - Update useUserStore with avatar set/remove actions - Add upload method to useApi hook - Replace 'coming soon' placeholder in settings page Closes LabsCrypt#13
ogazboiz
requested changes
Jun 19, 2026
ogazboiz
left a comment
Contributor
There was a problem hiding this comment.
solid start, the validation, preview, progress/error ui, remove action and store persistence are all there. but it does not build yet:
src/app/stores/useUserStore.ts:16and:19- duplicateimport { create } from "zustand"(TS2300).src/app/hooks/useApi.ts:1239-uploadcalls an undefinedgetToken()(TS2304, placeholder auth), so the upload would not authenticate.src/app/components/AvatarUpload.tsx:5- importscnfrom@/lib/utils, which does not exist here (TS2307).- making
name/avatarUrlrequired onUserbreakssrc/app/stores/stores.test.ts:52,67,76. - prettier fails on all 5 changed files.
beyond the build: the progress bar is simulated rather than real upload progress; the hook passes Content-Type: multipart/form-data which clobbers the fetch boundary and will break the multipart body; and the avatar only renders in settings (issue #13 asks for it wherever the user is represented, e.g. header/nav). please fix the build, wire real auth and the remove/upload endpoints, drop the manual multipart content-type, surface the avatar in the nav, and run npm run format.
if you want to keep contributing, join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(avatar): address PR review — build, auth, multipart, nav surface
Closes #13
Summary
Addresses all review feedback from @ogazboiz on the avatar upload implementation:
authTokenfromuseUserStoreinstead of undefinedgetToken()placeholderContent-Typewith proper boundary instead of clobbering itXMLHttpRequestupload.progresseventsChanges
Fixed Files
src/app/stores/useUserStore.tsimport { create }(lines 16, 19); madenameandavatarUrloptionalsrc/app/hooks/useApi.tsgetToken()withuseUserStore.getState().authToken; addeduseUploadAvataranduseRemoveAvatarhooks with real XHR progresssrc/app/components/AvatarUpload.tsxcnimport from@/lib/utilswith inlineclsx+tailwind-merge; removed manualContent-Typeheader; replaced simulated progress with real XHR progresssrc/app/stores/stores.test.tsnameandavatarUrloptional fields; verifiedupdateUserpatches and clears avatar correctlysrc/app/components/global_ui/Header.tsxsrc/app/components/global_ui/Sidebar.tsxNew Files
src/app/components/Settings.tsxAvatarUploadwith name editingReview Feedback Addressed
useUserStore.ts:16,19— duplicateimport { create }useApi.ts:1239—uploadcalls undefinedgetToken()useUserStore.getState().authTokenAvatarUpload.tsx:5—cnfrom@/lib/utilsdoesn't existcnusingclsx+tailwind-mergename/avatarUrlrequired breaksstores.test.ts:52,67,76XMLHttpRequestprogress eventsContent-Type: multipart/form-dataclobbers boundaryValidation