Project

General

Profile

Sub-Task #121

Updated by Bricklou 20 days ago

Technical specification of the avatar on the profile page and in the application. 

 Profile page: 

 * An avatar card at the top of the profile settings. The avatar is the control: a click opens the file picker, and a pen appears on hover and on keyboard focus. 
 * An image can also be dropped on the card. A drop zone shows while a file is dragged over it, and says why a refused file is refused. 
 * Only PNG, JPG, GIF and WebP images up to 10 MB are taken. The picture sent to the server is the cropped one, much smaller. 
 * The chosen image opens a dialog to frame a square: drag or arrow keys to move, slider or wheel to zoom, a preview at two sizes. Cancelling sends nothing. The server's refusal is shown in the dialog, which stays open. 
 * "Remove photo" is shown only when there is an avatar. 
 * An account managed by a login provider cannot change its avatar: the picker is disabled and nothing else is offered. 

 Cropper: 

 * A component of the component library, `k-image-cropper`, that does not know about avatars. Its inputs are the file, the largest side of the exported square (512 by default) and the maximum zoom. It exports the framed square as an image file, WebP when the browser can encode it, PNG otherwise. 
 * Its style belongs to the design system. 

 Display: 

 * The avatar, or the initials when there is none, shows in the top bar, in the list of users, on the details page of a user, in the suggestions of the user picker, and in the lists of members of a group. 
 * A shared component shows a user as an avatar next to their username, with an optional link. It is decorative for assistive technologies, since the username is written next to it. The members of a group link to the details page of the user. 
 * The suggestions of the user picker are real buttons. 
 * The API client sends a file as a raw body. 

 Only design-system classes and tokens, no inline style, Lucide icons only. 

 Acceptance criteria: 

 * [x] [ ] The avatar is the control: click to choose, a pen on hover and focus, drop an image on the card. (Not checked by hand yet.) 
 * [x] The chosen image is framed in a dialog, with zoom and preview, before it is sent. 
 * [x] A file that is not accepted, or that the server refuses, is explained. 
 * [x] The avatar can be removed. 
 * [x] A login provider account cannot change its avatar. 
 * [x] The avatar shows in the top bar, the lists, the details page and the user picker. 
 * [x] The cropper is a documented component of the library, covered by tests. 
 * [x] Every behaviour is covered by a browser test.

Back