You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.6 KiB

  1. // Package imports.
  2. import React from 'react';
  3. import ImmutablePropTypes from 'react-immutable-proptypes';
  4. import {
  5. FormattedMessage,
  6. defineMessages,
  7. } from 'react-intl';
  8. // Components.
  9. import Avatar from 'flavours/glitch/components/avatar';
  10. import Permalink from 'flavours/glitch/components/permalink';
  11. // Utils.
  12. import { hiddenComponent } from 'flavours/glitch/util/react_helpers';
  13. // Messages.
  14. const messages = defineMessages({
  15. edit: {
  16. defaultMessage: 'Edit profile',
  17. id: 'navigation_bar.edit_profile',
  18. },
  19. });
  20. // The component.
  21. export default function DrawerAccount ({ account }) {
  22. // We need an account to render.
  23. if (!account) {
  24. return (
  25. <div className='drawer--account'>
  26. <a
  27. className='edit'
  28. href='/settings/profile'
  29. >
  30. <FormattedMessage {...messages.edit} />
  31. </a>
  32. </div>
  33. );
  34. }
  35. // The result.
  36. return (
  37. <div className='drawer--account'>
  38. <Permalink
  39. className='avatar'
  40. href={account.get('url')}
  41. to={`/accounts/${account.get('id')}`}
  42. >
  43. <span {...hiddenComponent}>{account.get('acct')}</span>
  44. <Avatar
  45. account={account}
  46. size={40}
  47. />
  48. </Permalink>
  49. <Permalink
  50. className='acct'
  51. href={account.get('url')}
  52. to={`/accounts/${account.get('id')}`}
  53. >
  54. <strong>@{account.get('acct')}</strong>
  55. </Permalink>
  56. <a
  57. className='edit'
  58. href='/settings/profile'
  59. ><FormattedMessage {...messages.edit} /></a>
  60. </div>
  61. );
  62. }
  63. // Props.
  64. DrawerAccount.propTypes = { account: ImmutablePropTypes.map };