[ABANDONED] React/Redux front end for the Flexor social network.
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.

65 lines
2.3 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. import React, { FC } from 'react'
  2. import { useSelector } from 'react-redux'
  3. import { Link } from 'react-router-dom'
  4. import { getAuthenticatedUser } from '../selectors/authentication'
  5. import { useTheme } from '../hooks'
  6. import HorizontalRule from '../components/horizontal-rule'
  7. const SelfInfo: FC = () => {
  8. const theme = useTheme()
  9. const user = useSelector(getAuthenticatedUser)
  10. if (!user) {
  11. return (
  12. <div className="user-info-unauthenticated" style={{ backgroundColor: theme.primary }}>
  13. <Link to="/login" style={{ color: theme.primaryAlternate, fontSize: '1.1rem' }}>Log In to Flexor</Link>
  14. <HorizontalRule />
  15. <Link to="/communities" style={{ color: theme.backgroundSecondary, fontSize: '0.9rem' }}>Create an Account</Link>
  16. </div>
  17. )
  18. }
  19. const group = user.group
  20. const groupImageUrl = group && group.iconImageUrl ? group.iconImageUrl : undefined
  21. const name = () => {
  22. if (user.name) {
  23. return (
  24. <Link to="/self" style={{ color: theme.primaryAlternate }}>
  25. <span style={{ fontSize: '1rem' }}>{user.name}</span> <span style={{ fontSize: '0.9rem', fontWeight: 'bold' }}>@{user.id}</span>
  26. </Link>
  27. )
  28. }
  29. return <Link to="/self" style={{ color: theme.primaryAlternate }}>@{user.id}</Link>
  30. }
  31. return (
  32. <div className="user-info" style={{ backgroundColor: theme.primary, color: theme.primaryAlternate }}>
  33. {user.imageUrl &&
  34. <div className="image">
  35. <img src={user.imageUrl} style={{ width: 32 }} />
  36. </div>
  37. }
  38. <div>
  39. {name()}
  40. <br />
  41. {group &&
  42. <div className="group-info">
  43. {groupImageUrl &&
  44. <div className="image">
  45. <img src={groupImageUrl} style={{ width: 16 }} />
  46. </div>
  47. }
  48. <div>
  49. <Link to={`/c/${group.id}`} style={{ color: theme.backgroundSecondary }}>{group.name}</Link>
  50. </div>
  51. </div>
  52. }
  53. </div>
  54. </div>
  55. )
  56. }
  57. export default SelfInfo