diff --git a/apps/comments-ui/src/components/Form.js b/apps/comments-ui/src/components/Form.js
index 582a08ebd3..8421dcbf5a 100644
--- a/apps/comments-ui/src/components/Form.js
+++ b/apps/comments-ui/src/components/Form.js
@@ -423,7 +423,7 @@ const Form = (props) => {
handleShowDialog(event, {
bioAutofocus: true
});
- }}>{memberBio ? memberBio : 'Add your bio'}
+ }}>{memberBio ? memberBio : 'Add your expertise'}
{memberBio && }
diff --git a/apps/comments-ui/src/components/modals/AddDetailsDialog.js b/apps/comments-ui/src/components/modals/AddDetailsDialog.js
index 0704c7667a..948f8ebd47 100644
--- a/apps/comments-ui/src/components/modals/AddDetailsDialog.js
+++ b/apps/comments-ui/src/components/modals/AddDetailsDialog.js
@@ -11,6 +11,9 @@ const AddNameDialog = (props) => {
const [name, setName] = useState(member.name ?? '');
const [bio, setBio] = useState(member.bio ?? '');
+ const [exampleProfiles, setExampleProfiles] = useState([]);
+ const [exampleExpertise, setExampleExpertise] = useState('Head of Marketing');
+
const maxBioChars = 50;
let initialBioChars = maxBioChars;
if (member.bio) {
@@ -20,6 +23,10 @@ const AddNameDialog = (props) => {
const [error, setError] = useState({name: '', bio: ''});
+ const stopPropagation = (event) => {
+ event.stopPropagation();
+ };
+
const close = (succeeded) => {
dispatchAction('closePopup');
props.callback(succeeded);
@@ -39,8 +46,49 @@ const AddNameDialog = (props) => {
}
};
+ const generateExampleProfiles = () => {
+ let returnable = [];
+ let dummyData = [
+ {avatar: 'https://images.unsplash.com/photo-1607746882042-944635dfe10e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2670&q=80', name: 'Sophie Joan', expertise: 'Freelance Writer'},
+ {avatar: 'https://images.unsplash.com/photo-1569913486515-b74bf7751574?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1289&q=80', name: 'Naomi Schiff', expertise: 'Founder @ Acme Inc'},
+ {avatar: 'https://images.unsplash.com/photo-1544725176-7c40e5a71c5e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2667&q=80', name: 'Katrina Klosp', expertise: 'Local Resident'},
+ {avatar: 'https://images.unsplash.com/photo-1580489944761-15a19d654956?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1361&q=80', name: 'Laura Smith', expertise: 'Craft Maker'},
+ {avatar: 'https://images.unsplash.com/photo-1633332755192-727a05c4013d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1760&q=80', name: 'Peter Kristy', expertise: 'Design Consultant'},
+ {avatar: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1364&q=80', name: 'Linda Lo', expertise: 'Wedding Photographer'},
+ {avatar: 'https://images.unsplash.com/photo-1527980965255-d3b416303d12?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1760&q=80', name: 'Darren Mckenzie', expertise: 'Senior Engineer'},
+ {avatar: 'https://images.unsplash.com/photo-1566492031773-4f4e44671857?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1287&q=80', name: 'Jack Tomlin', expertise: 'Mid-level UX Designer'}
+ ];
+
+ // setup fake users
+ for (let i = 0; i < 4; i++) {
+ let dummyIndex = Math.floor(Math.random() * dummyData.length);
+ returnable.push(dummyData[dummyIndex]);
+ dummyData.splice(dummyIndex, 1);
+ }
+
+ return returnable;
+ };
+
+ const generateExampleExpertise = () => {
+ let dummyData = [
+ 'Freelance Copywriter',
+ 'Head of Marketing',
+ 'Junior Developer',
+ 'Full-time Parent',
+ 'Local Resident',
+ 'English Teacher',
+ 'Support Officer',
+ 'Professional Athlete'
+ ];
+
+ return dummyData[Math.floor(Math.random() * dummyData.length)];
+ };
+
// using breaks transitions in browsers. So we need to use a timer
useEffect(() => {
+ setExampleProfiles(generateExampleProfiles());
+ setExampleExpertise(generateExampleExpertise());
+
const timer = setTimeout(() => {
if (props.bioAutofocus) {
inputBioRef.current?.focus();
@@ -52,80 +100,122 @@ const AddNameDialog = (props) => {
return () => {
clearTimeout(timer);
};
- }, [inputNameRef]);
+ }, [inputNameRef, inputBioRef]);
+
+ const renderExampleProfile = (index) => {
+ return (exampleProfiles[index] ?
+
+
+
+
+
+ {exampleProfiles[index].name}
+
+
+ {exampleProfiles[index].expertise}
+
+
+
+ : null
+ );
+ };
return (
- <>
-
Add to your profile
- For a healthy discussion, let other members know who you are when commenting.
-
-
-
-
- {error.name}
-
+
+
+
+
+ {exampleProfiles.length > 0 && (
+ <>
+ {renderExampleProfile(0)}
+ {renderExampleProfile(1)}
+ {renderExampleProfile(2)}
+ {renderExampleProfile(3)}
+ >
+ )}
+
- {
- setName(e.target.value);
- }}
- onKeyDown={(e) => {
- if (e.key === 'Enter') {
- setName(e.target.value);
- submit();
- }
- }}
- maxLength="64"
- />
-
-
-
{bioCharsLeft} characters left
+
+
Complete your profile.
+
Add context to your comment, share your name and expertise to foster a healthy discussion.
+
+
+
+
+ {error.name}
+
+
+ {
+ setName(e.target.value);
+ }}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') {
+ setName(e.target.value);
+ submit();
+ }
+ }}
+ maxLength="64"
+ />
+
+
+
{bioCharsLeft} characters left
+
+ {
+ let bioText = e.target.value;
+ setBioCharsLeft(maxBioChars - bioText.length);
+ setBio(bioText);
+ }}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') {
+ setBio(e.target.value);
+ submit();
+ }
+ }}
+ maxLength={maxBioChars}
+ />
+
+
- {
- let bioText = e.target.value;
- setBioCharsLeft(maxBioChars - bioText.length);
- setBio(bioText);
- }}
- onKeyDown={(e) => {
- if (e.key === 'Enter') {
- setBio(e.target.value);
- submit();
- }
- }}
- maxLength={maxBioChars}
- />
-
-
-
close(false)} />
- >
+ close(false)} />
+
+
);
};
diff --git a/apps/comments-ui/src/components/modals/CloseButton.js b/apps/comments-ui/src/components/modals/CloseButton.js
index 8c8afbe2d4..059f29b317 100644
--- a/apps/comments-ui/src/components/modals/CloseButton.js
+++ b/apps/comments-ui/src/components/modals/CloseButton.js
@@ -3,7 +3,7 @@ import {ReactComponent as CloseIcon} from '../../images/icons/close.svg';
const CloseButton = (props) => {
return (
-
diff --git a/apps/comments-ui/src/components/modals/ReportDialog.js b/apps/comments-ui/src/components/modals/ReportDialog.js
index fa4846bf0c..48ada84410 100644
--- a/apps/comments-ui/src/components/modals/ReportDialog.js
+++ b/apps/comments-ui/src/components/modals/ReportDialog.js
@@ -27,6 +27,10 @@ const ReportDialog = (props) => {
const {dispatchAction} = useContext(AppContext);
+ const stopPropagation = (event) => {
+ event.stopPropagation();
+ };
+
const close = (event) => {
dispatchAction('closePopup');
};
@@ -48,7 +52,7 @@ const ReportDialog = (props) => {
};
return (
- <>
+
You sure you want to report?
You request will be sent to the owner of this site.
@@ -60,7 +64,7 @@ const ReportDialog = (props) => {
No, I've changed my mind
- >
+
);
};