YorKnEz

Untitled

Apr 20th, 2021
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.21 KB | None | 0 0
  1. import { useEffect, useState } from 'react'
  2. import { Row, Col, Spinner } from 'react-bootstrap'
  3. import CountUp from 'react-countup'
  4. import VisibilitySensor from 'react-visibility-sensor'
  5. import { useSelector } from 'react-redux'
  6. import { useHistory } from 'react-router'
  7.  
  8. import axios from 'axios'
  9.  
  10. import './Landing.css'
  11. import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
  12. import * as fa from '@fortawesome/free-solid-svg-icons'
  13. import * as fab from '@fortawesome/free-brands-svg-icons'
  14.  
  15. function Landing() {
  16. const [data, setData] = useState(null)
  17. const [isLoading, setIsLoading] = useState(false)
  18. const jwt = useSelector(state => state?.jwt?.jwt)
  19. const history = useHistory()
  20.  
  21. const getData = async () => {
  22. try {
  23. const response = await axios
  24. .get(process.env.REACT_APP_IP + '/generalData')
  25. .then(res => setData(res.data))
  26. setIsLoading(true)
  27. } catch (e) {
  28. console.log(e)
  29. }
  30. }
  31.  
  32. useEffect(() => {
  33. getData()
  34. }, [])
  35.  
  36. const gotoCategories = e => {
  37. history.push('/categories')
  38. }
  39.  
  40. const gotoRegister = e => {
  41. history.push('/register')
  42. }
  43.  
  44. return (
  45. <div className='page-scroll-container'>
  46. {isLoading ? (
  47. <div className='page-content'>
  48. <div>
  49. <h1 className='title-main'>Studyrooms</h1>
  50. <p className='title-slogan'>
  51. * TODO: Insert good marketing slogan here *
  52. </p>
  53. </div>
  54.  
  55. {jwt ? (
  56. <Row className='justify-content-center'>
  57. <Col md={12} lg={7} className='text-center-w1000'>
  58. <h2 className='text-act-now'>
  59. You're already logged in, you might want to go to the
  60. Categories.
  61. </h2>
  62. </Col>
  63. <Col md={12} lg={1} className='text-center'>
  64. <button
  65. className='button button-green button-act-now'
  66. onClick={gotoCategories}>
  67. Categories
  68. </button>
  69. </Col>
  70. </Row>
  71. ) : (
  72. ''
  73. )}
  74.  
  75. <h1 className='heading'>What we do</h1>
  76. <Row>
  77. <Col sm={6} lg={3}>
  78. <div className='card card-people'>
  79. <div>
  80. <img className='user-img' src='default-avatar.png' alt='' />
  81. </div>
  82. <div>
  83. <h3>John Doe</h3>
  84. <h5>Dummy</h5>
  85. </div>
  86. <div>
  87. Extremity sweetness difficult behaviour he of. On disposal of
  88. as landlord horrible. Children me laughing we prospect
  89. answered followed. At it went is song that held help face. Led
  90. ask possible mistress relation elegance eat likewise debating.
  91. By message or am nothing amongst chiefly address.
  92. </div>
  93. <div className='bottom'></div>
  94. </div>
  95. </Col>
  96. <Col sm={6} lg={3}>
  97. <div className='card card-people'>
  98. <div>
  99. <img className='user-img' src='default-avatar.png' alt='' />
  100. </div>
  101. <div>
  102. <h3>John Doe</h3>
  103. <h5>Dummy</h5>
  104. </div>
  105. <div>
  106. Extremity sweetness difficult behaviour he of. On disposal of
  107. as landlord horrible. Children me laughing we prospect
  108. answered followed. At it went is song that held help face. Led
  109. ask possible mistress relation elegance eat likewise debating.
  110. By message or am nothing amongst chiefly address.
  111. </div>
  112. <div className='bottom'></div>
  113. </div>
  114. </Col>
  115. <Col sm={6} lg={3}>
  116. <div className='card card-people'>
  117. <div>
  118. <img className='user-img' src='default-avatar.png' alt='' />
  119. </div>
  120. <div>
  121. <h3>John Doe</h3>
  122. <h5>Dummy</h5>
  123. </div>
  124. <div>
  125. Extremity sweetness difficult behaviour he of. On disposal of
  126. as landlord horrible. Children me laughing we prospect
  127. answered followed. At it went is song that held help face. Led
  128. ask possible mistress relation elegance eat likewise debating.
  129. By message or am nothing amongst chiefly address.
  130. </div>
  131. <div className='bottom'></div>
  132. </div>
  133. </Col>
  134. <Col sm={6} lg={3}>
  135. <div className='card card-people'>
  136. <div>
  137. <img className='user-img' src='default-avatar.png' alt='' />
  138. </div>
  139. <div>
  140. <h3>John Doe</h3>
  141. <h5>Dummy</h5>
  142. </div>
  143. <div>
  144. Extremity sweetness difficult behaviour he of. On disposal of
  145. as landlord horrible. Children me laughing we prospect
  146. answered followed. At it went is song that held help face. Led
  147. ask possible mistress relation elegance eat likewise debating.
  148. By message or am nothing amongst chiefly address.
  149. </div>
  150. <div className='bottom'></div>
  151. </div>
  152. </Col>
  153. </Row>
  154.  
  155. <h1 className='heading'>Features</h1>
  156. <Row>
  157. <Col sm={4}>
  158. <div className='card-fill'>
  159. <h2> Great for any student </h2>
  160. <p className='mt-auto mb-auto'>
  161. We offer help for all high school students
  162. </p>
  163. <p className='mt-auto mb-auto'>
  164. Users get categorized so they don't mix up
  165. </p>
  166. <p className='mt-auto mb-auto'>Blah blah blah</p>
  167. <p className='mt-auto mb-auto'>
  168. Another advantage idk ¯\_(ツ)_/¯
  169. </p>
  170. </div>
  171. </Col>
  172. <Col sm={4}>
  173. <div className='card-fill'>
  174. <h2> Great for any student </h2>
  175. <p className='mt-auto mb-auto'>
  176. We offer help for all high school students
  177. </p>
  178. <p className='mt-auto mb-auto'>
  179. Users get categorized so they don't mix up
  180. </p>
  181. <p className='mt-auto mb-auto'>Blah blah blah</p>
  182. <p className='mt-auto mb-auto'>
  183. Another advantage idk ¯\_(ツ)_/¯
  184. </p>
  185. </div>
  186. </Col>
  187. <Col sm={4}>
  188. <div className='card-fill'>
  189. <h2> Great for any student </h2>
  190. <p className='mt-auto mb-auto'>
  191. We offer help for all high school students
  192. </p>
  193. <p className='mt-auto mb-auto'>
  194. Users get categorized so they don't mix up
  195. </p>
  196. <p className='mt-auto mb-auto'>Blah blah blah</p>
  197. <p className='mt-auto mb-auto'>
  198. Another advantage idk ¯\_(ツ)_/¯
  199. </p>
  200. </div>
  201. </Col>
  202. </Row>
  203.  
  204. <Row className='justify-content-center'>
  205. <Col md={4} className='mt-5'>
  206. <CountUp end={data.users} duration={3.75}>
  207. {({ countUpRef, start }) => (
  208. <VisibilitySensor onChange={start} delayedCall>
  209. <p
  210. ref={countUpRef}
  211. className='ml-auto mr-auto text-center countdown-label'
  212. />
  213. </VisibilitySensor>
  214. )}
  215. </CountUp>
  216. <h3 className='ml-auto mr-auto text-center'>Registered Users</h3>
  217. </Col>
  218. <Col md={4} className='mt-5'>
  219. <CountUp end={data.messages} duration={3.75}>
  220. {({ countUpRef, start }) => (
  221. <VisibilitySensor onChange={start} delayedCall>
  222. <p
  223. ref={countUpRef}
  224. className='ml-auto mr-auto text-center countdown-label'
  225. />
  226. </VisibilitySensor>
  227. )}
  228. </CountUp>
  229. <h3 className='ml-auto mr-auto text-center'>
  230. Total Messages Sent
  231. </h3>
  232. </Col>
  233. </Row>
  234.  
  235. <h1 className='heading'>The Team</h1>
  236. <Row className='justify-content-center'>
  237. <Col sm={6} md={4}>
  238. <div className='card card-people'>
  239. <div>
  240. <img className='user-img' src='default-avatar.png' alt='' />
  241. </div>
  242. <div>
  243. <h3>John Doe</h3>
  244. <h5>Dummy</h5>
  245. </div>
  246. <div>
  247. Extremity sweetness difficult behaviour he of. On disposal of
  248. as landlord horrible. Children me laughing we prospect
  249. answered followed. At it went is song that held help face. Led
  250. ask possible mistress relation elegance eat likewise debating.
  251. By message or am nothing amongst chiefly address.
  252. </div>
  253. <div className='bottom'></div>
  254. </div>
  255. </Col>
  256. <Col sm={6} md={4}>
  257. <div className='card card-people'>
  258. <div>
  259. <img className='user-img' src='default-avatar.png' alt='' />
  260. </div>
  261. <div>
  262. <h3>John Doe</h3>
  263. <h5>Dummy</h5>
  264. </div>
  265. <div>
  266. Extremity sweetness difficult behaviour he of. On disposal of
  267. as landlord horrible. Children me laughing we prospect
  268. answered followed. At it went is song that held help face. Led
  269. ask possible mistress relation elegance eat likewise debating.
  270. By message or am nothing amongst chiefly address.
  271. </div>
  272. <div className='bottom'></div>
  273. </div>
  274. </Col>
  275. <Col sm={6} md={4}>
  276. <div className='card card-people'>
  277. <div>
  278. <img className='user-img' src='default-avatar.png' alt='' />
  279. </div>
  280. <div>
  281. <h3>John Doe</h3>
  282. <h5>Dummy</h5>
  283. </div>
  284. <div>
  285. Extremity sweetness difficult behaviour he of. On disposal of
  286. as landlord horrible. Children me laughing we prospect
  287. answered followed. At it went is song that held help face. Led
  288. ask possible mistress relation elegance eat likewise debating.
  289. By message or am nothing amongst chiefly address.
  290. </div>
  291. <div className='bottom'></div>
  292. </div>
  293. </Col>
  294. <Col sm={6} md={4}>
  295. <div className='card card-people'>
  296. <div>
  297. <img className='user-img' src='default-avatar.png' alt='' />
  298. </div>
  299. <div>
  300. <h3>John Doe</h3>
  301. <h5>Dummy</h5>
  302. </div>
  303. <div>
  304. Extremity sweetness difficult behaviour he of. On disposal of
  305. as landlord horrible. Children me laughing we prospect
  306. answered followed. At it went is song that held help face. Led
  307. ask possible mistress relation elegance eat likewise debating.
  308. By message or am nothing amongst chiefly address.
  309. </div>
  310. <div className='bottom'></div>
  311. </div>
  312. </Col>
  313. <Col sm={6} md={4}>
  314. <div className='card card-people'>
  315. <div>
  316. <img className='user-img' src='default-avatar.png' alt='' />
  317. </div>
  318. <div>
  319. <h3>John Doe</h3>
  320. <h5>Dummy</h5>
  321. </div>
  322. <div>
  323. Extremity sweetness difficult behaviour he of. On disposal of
  324. as landlord horrible. Children me laughing we prospect
  325. answered followed. At it went is song that held help face. Led
  326. ask possible mistress relation elegance eat likewise debating.
  327. By message or am nothing amongst chiefly address.
  328. </div>
  329. <div className='bottom'></div>
  330. </div>
  331. </Col>
  332. </Row>
  333.  
  334. {jwt ? (
  335. ''
  336. ) : (
  337. <Row className='justify-content-center mt-4'>
  338. <Col md={12} lg={5}>
  339. <h2 className='text-act-now text-center'>
  340. So, what do you think? Join us today!
  341. </h2>
  342. </Col>
  343. <Col md={12} lg={1} className='text-center'>
  344. <button
  345. className='button button-green button-act-now'
  346. onClick={gotoRegister}>
  347. Register
  348. </button>
  349. </Col>
  350. </Row>
  351. )}
  352.  
  353. <h1 className='heading'>Contact us</h1>
  354. <div className='contacts'>
  355. <a href='mailto:[email protected]'>
  356. <FontAwesomeIcon icon={fa.faEnvelope} />
  357. Mail Us
  358. </a>
  359. <a href='https://instagram.com'>
  360. <FontAwesomeIcon icon={fab.faInstagram} />
  361. @studyrooms
  362. </a>
  363. <a href='https://facebook.com'>
  364. <FontAwesomeIcon icon={fab.faFacebook} />
  365. @studyrooms
  366. </a>
  367. </div>
  368. </div>
  369. ) : (
  370. <Spinner animation='border' />
  371. )}
  372. </div>
  373. )
  374. }
  375.  
  376. export default Landing
  377.  
Advertisement
Add Comment
Please, Sign In to add comment