--- import { Icon } from 'astro-icon/components' import { actions, isInputError } from 'astro:actions' import Button from '../../components/Button.astro' import { karmaUnlocksById } from '../../constants/karmaUnlocks' import MiniLayout from '../../layouts/MiniLayout.astro' import { makeKarmaUnlockMessage } from '../../lib/karmaUnlocks' import { makeLoginUrl } from '../../lib/redirectUrls' const user = Astro.locals.user if (!user) { return Astro.redirect(makeLoginUrl(Astro.url, { message: 'Login to edit your profile' })) } const result = Astro.getActionResult(actions.account.update) if (result && !result.error) { return Astro.redirect('/account') } const inputErrors = isInputError(result?.error) ? result.error.fields : {} ---
{ inputErrors.displayName && (

{inputErrors.displayName.join(', ')}

) } { !user.karmaUnlocks.displayName && (

{makeKarmaUnlockMessage(karmaUnlocksById.displayName)} Learn about karma

) }
{inputErrors.link &&

{inputErrors.link.join(', ')}

} { !user.karmaUnlocks.websiteLink && (

{makeKarmaUnlockMessage(karmaUnlocksById.websiteLink)} Learn about karma

) }

Upload a square image for best results. Supported formats: JPG, PNG, WebP, AVIF, JXL. Max size: 5MB.

{ inputErrors.pictureFile && (

{inputErrors.pictureFile.join(', ')}

) } { !user.karmaUnlocks.profilePicture && (

You need 200 karma to have a profile picture. Learn about karma

) }