[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.

48 lines
1.2 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
  1. import React, { FC, useEffect } from 'react'
  2. import { useSelector, useDispatch } from 'react-redux'
  3. import { fetchTimeline } from '../../actions/posts'
  4. import { getAuthenticated } from '../../selectors/authentication'
  5. import { setTitle } from '../../utils'
  6. import { AppThunkDispatch } from '../../types'
  7. import Title from '../../components/title'
  8. import Composer from '../../components/composer'
  9. import Timeline from '../../components/timeline'
  10. import Section from '../../components/section'
  11. import Subtitle from '../../components/subtitle'
  12. const Home: FC = () => {
  13. const authenticated = useSelector(getAuthenticated)
  14. const dispatch = useDispatch<AppThunkDispatch>()
  15. useEffect(() => {
  16. setTitle('Home')
  17. })
  18. const handlePost = () => {
  19. dispatch(fetchTimeline())
  20. }
  21. return (
  22. <div>
  23. <Section>
  24. <Title>Home</Title>
  25. </Section>
  26. {authenticated &&
  27. <div>
  28. <Composer onPost={handlePost} />
  29. <div style={{ padding: '0px 1rem' }}>
  30. <Subtitle>Timeline</Subtitle>
  31. </div>
  32. <Timeline />
  33. </div>
  34. }
  35. </div>
  36. )
  37. }
  38. export default Home