import { h, Component } from 'preact';
import twitterImage from 'images/twitter-logo.svg';
import githubImage from 'images/github-logo.svg';
import websiteImage from 'images/external-link-logo.svg';
function blockUser(blockedUserId) {
const body = {
user_block: {
blocked_id: blockedUserId,
},
};
getCsrfToken().then(sendFetch('block-user', JSON.stringify(body)));
}
const setUpButton = ({ modalId = '', otherModalId = '', btnName = '' }) => {
return (
);
};
const userDetailsConfig = {
twitter_username: {
hostUrl: 'https://twitter.com/',
srcImage: twitterImage,
imageAltText: 'twitter logo',
},
github_username: {
hostUrl: 'https://github.com/',
srcImage: githubImage,
imageAltText: 'github logo',
},
website_url: {
className: 'external-link-img',
hostUrl: '',
srcImage: websiteImage,
imageAltText: 'external link icon',
},
};
export default class UserDetails extends Component {
render() {
const { user } = this.props;
const channelId = this.props.activeChannelId;
const channel = this.props.activeChannel || {};
const socialIcons = [];
const userMeta = ['twitter_username', 'github_username', 'website_url'];
userMeta.forEach(metaProp => {
if (user[metaProp]) {
const {
className,
hostUrl,
srcImage,
imageAltText,
} = userDetailsConfig[metaProp];
socialIcons.push(
,
);
}
});
let userLocation = '';
if (user.location && user.location.length > 0) {
userLocation = (
Reporting abuse will:
Blocking is only on Connect right now and has not been implemented across DEV yet.
Blocking on connect will:
Blocking is only on Connect right now and has not been implemented across DEV yet. Consider reporting abuse to the DEV team if this user is spamming or harassing elsewhere on dev.to, so we can take further action.