import { h } from 'preact';
import { PropTypes } from 'prop-types';
// eslint-disable-next-line import/no-unresolved
import twitterImage from 'images/twitter-logo.svg';
// eslint-disable-next-line import/no-unresolved
import githubImage from 'images/github-logo.svg';
// eslint-disable-next-line import/no-unresolved
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 (
);
};
setUpButton.propTypes = {
modalId: PropTypes.string.isRequired,
otherModalId: PropTypes.string.isRequired,
btnName: PropTypes.string.isRequired,
};
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',
},
};
const UserDetails = ({ user, activeChannelId, activeChannel }) => {
const channelId = activeChannelId;
const channel = 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.