[Glitch] Profile redesign: Add alt to avatar and header

Port 59299c69ffce78bd4f2207ed3a7eb9484bd042a8 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Echo 2026-04-02 16:47:11 +02:00 committed by Claire
parent 093858e31a
commit de57fec9b6
4 changed files with 10 additions and 3 deletions

View File

@ -37,6 +37,7 @@ export interface BaseApiAccountJSON {
acct: string; acct: string;
avatar: string; avatar: string;
avatar_static: string; avatar_static: string;
avatar_description: string;
bot: boolean; bot: boolean;
created_at: string; created_at: string;
discoverable?: boolean; discoverable?: boolean;
@ -50,6 +51,7 @@ export interface BaseApiAccountJSON {
group: boolean; group: boolean;
header: string; header: string;
header_static: string; header_static: string;
header_description: string;
id: string; id: string;
last_status_at: string; last_status_at: string;
locked: boolean; locked: boolean;

View File

@ -13,6 +13,7 @@ interface Props {
account: account:
| Pick<Account, 'id' | 'acct' | 'avatar' | 'avatar_static'> | Pick<Account, 'id' | 'acct' | 'avatar' | 'avatar_static'>
| undefined; // FIXME: remove `undefined` once we know for sure its always there | undefined; // FIXME: remove `undefined` once we know for sure its always there
alt?: string;
size?: number; size?: number;
style?: React.CSSProperties; style?: React.CSSProperties;
inline?: boolean; inline?: boolean;
@ -25,6 +26,7 @@ interface Props {
export const Avatar: React.FC<Props> = ({ export const Avatar: React.FC<Props> = ({
account, account,
alt = '',
animate = autoPlayGif, animate = autoPlayGif,
size = 20, size = 20,
inline = false, inline = false,
@ -66,7 +68,7 @@ export const Avatar: React.FC<Props> = ({
data-avatar-of={account && `@${account.acct}`} data-avatar-of={account && `@${account.acct}`}
> >
{src && !error && ( {src && !error && (
<img src={src} alt='' onLoad={handleLoad} onError={handleError} /> <img src={src} alt={alt} onLoad={handleLoad} onError={handleError} />
)} )}
{counter && ( {counter && (

View File

@ -73,7 +73,7 @@ export const AccountHeader: React.FC<{
modalType: 'IMAGE', modalType: 'IMAGE',
modalProps: { modalProps: {
src: account.avatar, src: account.avatar,
alt: '', alt: account.avatar_description,
}, },
}), }),
); );
@ -125,7 +125,7 @@ export const AccountHeader: React.FC<{
{!suspendedOrHidden && ( {!suspendedOrHidden && (
<img <img
src={autoPlayGif ? account.header : account.header_static} src={autoPlayGif ? account.header : account.header_static}
alt='' alt={account.header_description}
className='parallax' className='parallax'
/> />
)} )}
@ -152,6 +152,7 @@ export const AccountHeader: React.FC<{
> >
<Avatar <Avatar
account={suspendedOrHidden ? undefined : account} account={suspendedOrHidden ? undefined : account}
alt={account.avatar_description}
size={80} size={80}
/> />
</a> </a>

View File

@ -62,6 +62,7 @@ export const accountDefaultValues: AccountShape = {
acct: '', acct: '',
avatar: '', avatar: '',
avatar_static: '', avatar_static: '',
avatar_description: '',
bot: false, bot: false,
created_at: '', created_at: '',
discoverable: false, discoverable: false,
@ -78,6 +79,7 @@ export const accountDefaultValues: AccountShape = {
group: false, group: false,
header: '', header: '',
header_static: '', header_static: '',
header_description: '',
id: '', id: '',
last_status_at: '', last_status_at: '',
locked: false, locked: false,