|
|
|
@ -1,9 +1,3 @@
|
|
|
|
|
/**
|
|
|
|
|
* Applies attributes to user avatars.
|
|
|
|
|
* @module Avatar
|
|
|
|
|
* @memberof Builtin.Attributes.Components
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { forceUpdateElement } from '@vizality/util/react';
|
|
|
|
|
import { patch, unpatch } from '@vizality/patcher';
|
|
|
|
|
import { getModule } from '@vizality/webpack';
|
|
|
|
@ -11,6 +5,11 @@ import React from 'react';
|
|
|
|
|
|
|
|
|
|
export const labels = [ 'Components', 'Avatar' ];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Applies attributes to user avatars.
|
|
|
|
|
* @module Avatar
|
|
|
|
|
* @memberof Builtin.Attributes.Components
|
|
|
|
|
*/
|
|
|
|
|
export default builtin => {
|
|
|
|
|
const AvatarModule = getModule('AnimatedAvatar');
|
|
|
|
|
const Avatar = AvatarModule?.default;
|
|
|
|
@ -18,7 +17,7 @@ export default builtin => {
|
|
|
|
|
try {
|
|
|
|
|
const avatar = args[0]?.src;
|
|
|
|
|
if (avatar?.includes('/avatars')) {
|
|
|
|
|
[ , res.props['vz-user-id'] ] = avatar.match(/\/avatars\/(\d+)/);
|
|
|
|
|
[ , res.props['vz-user-id'] ] = avatar.match(/\/(?:avatars|users)\/(\d+)/);
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return builtin.error(builtin._labels.concat(labels), err);
|
|
|
|
|