From 5cc962593e1aaa93f0d5f182740b697aee9fc1b8 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 29 Apr 2022 12:58:57 -0500 Subject: [PATCH] ProfilePreview: convert to TSX --- .../components/profile_preview.js | 46 ------------------- .../components/profile_preview.tsx | 44 ++++++++++++++++++ 2 files changed, 44 insertions(+), 46 deletions(-) delete mode 100644 app/soapbox/features/edit_profile/components/profile_preview.js create mode 100644 app/soapbox/features/edit_profile/components/profile_preview.tsx diff --git a/app/soapbox/features/edit_profile/components/profile_preview.js b/app/soapbox/features/edit_profile/components/profile_preview.js deleted file mode 100644 index 7fe1e8e4c..000000000 --- a/app/soapbox/features/edit_profile/components/profile_preview.js +++ /dev/null @@ -1,46 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { connect } from 'react-redux'; -import { Link } from 'react-router-dom'; - -import StillImage from 'soapbox/components/still_image'; -import VerificationBadge from 'soapbox/components/verification_badge'; -import { getAcct } from 'soapbox/utils/accounts'; -import { displayFqn } from 'soapbox/utils/state'; - -const mapStateToProps = state => ({ - displayFqn: displayFqn(state), -}); - -const ProfilePreview = ({ account, displayFqn }) => ( -
- -
- -
-
-
- -
-
- {account.get('username')} - - - {account.get('display_name')} - {account.get('verified') && } - - - @{getAcct(account, displayFqn)} -
-
- -
-); - -ProfilePreview.propTypes = { - account: ImmutablePropTypes.record, - displayFqn: PropTypes.bool, -}; - -export default connect(mapStateToProps)(ProfilePreview); diff --git a/app/soapbox/features/edit_profile/components/profile_preview.tsx b/app/soapbox/features/edit_profile/components/profile_preview.tsx new file mode 100644 index 000000000..e750bb273 --- /dev/null +++ b/app/soapbox/features/edit_profile/components/profile_preview.tsx @@ -0,0 +1,44 @@ +import React from 'react'; +import { Link } from 'react-router-dom'; + +import StillImage from 'soapbox/components/still_image'; +import VerificationBadge from 'soapbox/components/verification_badge'; +import { useSoapboxConfig } from 'soapbox/hooks'; + +import type { Account } from 'soapbox/types/entities'; + +interface IProfilePreview { + account: Account, +} + +/** Displays a preview of the user's account, including avatar, banner, etc. */ +const ProfilePreview: React.FC = ({ account }) => { + const { displayFqn } = useSoapboxConfig(); + + return ( +
+ +
+ +
+
+
+ +
+
+ {account.username} + + + {account.display_name} + {account.verified && } + + + @{displayFqn ? account.fqn : account.acct} +
+
+ +
+ ); +}; + +export default ProfilePreview;