Persona stats with avatar, more doc improvements

This commit is contained in:
Wolfsblvt
2024-04-25 03:53:06 +02:00
parent b9f31d5066
commit 3adb955a14
6 changed files with 140 additions and 48 deletions

View File

@ -27,6 +27,31 @@ function switchPersonaGridView() {
$('#user_avatar_block').toggleClass('gridView', state);
}
/**
* @typedef {object} Persona - A persona
* @property {string} id - The id of the persona - currently same as avatar
* @property {string} name - The name of the persona
* @property {string} avatar - the avatar / avatar id representing the persona
* @property {boolean} fav - Whether this persona is favorited
* @property {{description: string, position: number}} description - The persona description, containing its text and the position where its placed
* */
/**
* Builds an object represting the given persona
* @param {string} avatar - The avatar id
* @returns {Persona} The persona object, wit all its data
*/
export function getPersona(avatar) {
const persona = {
id: avatar,
name: power_user.personas[avatar],
avatar: avatar,
fav: false,
description: power_user.persona_descriptions[avatar]
};
return persona;
}
/**
* Uploads an avatar file to the server
* @param {string} url URL for the avatar file