resources.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876
  1. import React, { useState, useEffect, useCallback } from 'react';
  2. import ResourceTable from './resourcetable';
  3. import axios from 'axios';
  4. import FormControl from '@material-ui/core/FormControl';
  5. import Popover from '@material-ui/core/Popover';
  6. import Select from '@material-ui/core/Select';
  7. import { makeStyles } from '@material-ui/core/styles';
  8. import InputLabel from '@material-ui/core/InputLabel';
  9. import ErrorOutlineOutlinedIcon from '@material-ui/icons/ErrorOutlineOutlined';
  10. import Fab from '@material-ui/core/Fab';
  11. import NavigationOutlinedIcon from '@material-ui/icons/NavigationOutlined';
  12. export const useFormControlStyles = makeStyles((isDesktop) => {
  13. if (isDesktop === true)
  14. return {
  15. root: {
  16. margin: '1rem',
  17. flexGrow: '1',
  18. },
  19. };
  20. else
  21. return {
  22. root: {
  23. margin: '0.4rem',
  24. flexGrow: '1',
  25. width: '100%',
  26. },
  27. };
  28. });
  29. export const useInputLabelStyles = makeStyles(() => ({
  30. root: {
  31. fontSize: '11px !important',
  32. fontWeight: 600,
  33. textTransform: 'uppercase',
  34. },
  35. }));
  36. export const useMenuItemStyles = makeStyles(() => ({
  37. root: {
  38. fontSize: '11px !important',
  39. fontWeight: 600,
  40. textTransform: 'uppercase',
  41. },
  42. }));
  43. export const usePopOverStyles = makeStyles(() => ({
  44. root: {
  45. backgroundColor: '#201aa220',
  46. zIndex: '1000',
  47. },
  48. }));
  49. export const useTextInputStyles = makeStyles(() => ({
  50. root: {
  51. height: '0.5rem',
  52. },
  53. }));
  54. function Resources(props) {
  55. const [data, setData] = useState([]);
  56. const [partData, setPartData] = useState([]);
  57. const [fetched, setFetched] = useState(false);
  58. const [city, setCity] = useState('all');
  59. const [category, setCategory] = useState('all');
  60. const [indianstate, setIndianState] = useState('all');
  61. const [resourcedict, setResourceDict] = useState({});
  62. const [showTable, setShowTable] = useState(false);
  63. const [isDesktop, setIsDesktop] = useState(false);
  64. const classesFormControl = useFormControlStyles();
  65. const classesInputLabel = useInputLabelStyles();
  66. const classesMenuItem = useMenuItemStyles();
  67. const classesPopOver = usePopOverStyles();
  68. const [anchorEl, setAnchorEl] = React.useState(null);
  69. useEffect(() => {
  70. if (fetched === false) {
  71. getResources();
  72. }
  73. }, [fetched, data, resourcedict]);
  74. const checkForResizeEvent = useCallback((event) => {
  75. if (window.innerWidth > 639) setIsDesktop(true);
  76. else setIsDesktop(false);
  77. // console.log(isDesktop);
  78. }, []);
  79. useEffect(() => {
  80. if (window.innerWidth > 639) setIsDesktop(true);
  81. else setIsDesktop(false);
  82. window.addEventListener('resize', checkForResizeEvent);
  83. return () => {
  84. window.removeEventListener('resize', checkForResizeEvent);
  85. };
  86. }, [isDesktop, checkForResizeEvent]);
  87. const getResources = async () => {
  88. try {
  89. const [response] = await Promise.all([
  90. axios.get('https://api.covid19india.org/resources/resources.json'),
  91. ]);
  92. // console.log(response)
  93. // console.log("Column names are")
  94. // console.log(columns)
  95. // setData(response.data.resources);
  96. const hashmap = {};
  97. response.data.resources.forEach((x) => {
  98. // console.log(x)
  99. if (typeof hashmap[x['state']] === 'undefined')
  100. hashmap[x['state']] = {};
  101. if (typeof hashmap[x['state']][x['city']] === 'undefined')
  102. hashmap[x['state']][x['city']] = {};
  103. if (
  104. typeof hashmap[x['state']][x['city']][x['category']] === 'undefined'
  105. )
  106. hashmap[x['state']][x['city']][x['category']] = [];
  107. if (Array.isArray(hashmap[x['state']][x['city']][x['category']]))
  108. hashmap[x['state']][x['city']][x['category']].push(x);
  109. });
  110. setResourceDict(hashmap);
  111. // setIndianState(Object.keys()[0]);
  112. setFetched(true);
  113. // console.log(resourcedict);
  114. } catch (err) {
  115. // console.log(err);
  116. }
  117. };
  118. const handleDisclaimerClick = (event) => {
  119. setAnchorEl(event.currentTarget);
  120. };
  121. const handleDisclaimerClose = () => {
  122. setAnchorEl(null);
  123. };
  124. const isDisclaimerOpen = Boolean(anchorEl);
  125. const id = isDisclaimerOpen ? 'simple-popover' : undefined;
  126. function topFunction() {
  127. document.body.scrollTop = 0; // For Safari
  128. document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
  129. }
  130. const memocols = React.useMemo(
  131. () => [
  132. {
  133. Header: 'City',
  134. accessor: 'city',
  135. },
  136. {
  137. Header: 'Category',
  138. accessor: 'category',
  139. },
  140. {
  141. Header: 'Organisation',
  142. accessor: 'nameoftheorganisation',
  143. },
  144. {
  145. Header: 'Description',
  146. accessor: 'descriptionandorserviceprovided',
  147. },
  148. {
  149. Header: 'Phone',
  150. accessor: 'phonenumber',
  151. },
  152. {
  153. Header: 'Source',
  154. accessor: 'contact',
  155. isVisible: false,
  156. },
  157. ],
  158. []
  159. );
  160. // const memodata = React.useMemo(() => data, [data])
  161. const getCityOptions = function () {
  162. if (indianstate) {
  163. if (indianstate === 'all') return [];
  164. else {
  165. return Object.keys(resourcedict[indianstate])
  166. .sort()
  167. .map((x) => (
  168. <option
  169. key={x.id}
  170. value={x}
  171. style={{
  172. fontSize: '11px !important',
  173. fontWeight: 600,
  174. textTransform: 'uppercase',
  175. }}
  176. >
  177. {x}
  178. </option>
  179. ));
  180. }
  181. } else return [];
  182. // return getCityList().map((x) => <option value={x}>{x}</option>)
  183. };
  184. const getIndianStateOptions = function () {
  185. // let defaultOption = ['Please select']
  186. return Object.keys(resourcedict)
  187. .sort()
  188. .map((x) => (
  189. <option
  190. key={x.id}
  191. value={x}
  192. style={{
  193. fontSize: '11px !important',
  194. fontWeight: 600,
  195. textTransform: 'uppercase',
  196. }}
  197. >
  198. {x}
  199. </option>
  200. ));
  201. };
  202. const getCategoryOptions = function () {
  203. if (indianstate && city) {
  204. if (indianstate === 'all') {
  205. const array = [];
  206. Object.values(resourcedict).forEach((state) => {
  207. Object.values(state).forEach((citydata) => {
  208. Object.keys(citydata).forEach((x) => {
  209. if (array.indexOf(x) === -1) array.push(x);
  210. });
  211. });
  212. });
  213. return array.map((x) => (
  214. <option
  215. key={x.id}
  216. value={x}
  217. style={{
  218. fontSize: '11px !important',
  219. fontWeight: 600,
  220. textTransform: 'uppercase',
  221. }}
  222. >
  223. {x}
  224. </option>
  225. ));
  226. } else {
  227. if (city === 'all') {
  228. const array = [];
  229. Object.values(resourcedict[indianstate]).forEach((citydata) => {
  230. Object.keys(citydata).forEach((x) => {
  231. if (array.indexOf(x) === -1) array.push(x);
  232. });
  233. });
  234. return array.map((x) => (
  235. <option
  236. key={x.id}
  237. value={x}
  238. style={{
  239. fontSize: '11px !important',
  240. fontWeight: 600,
  241. textTransform: 'uppercase',
  242. }}
  243. >
  244. {x}
  245. </option>
  246. ));
  247. } else {
  248. return Object.keys(resourcedict[indianstate][city])
  249. .sort()
  250. .map((x) => (
  251. <option
  252. key={x.id}
  253. value={x}
  254. style={{
  255. fontSize: '11px !important',
  256. fontWeight: 600,
  257. textTransform: 'uppercase',
  258. }}
  259. >
  260. {x}
  261. </option>
  262. ));
  263. }
  264. }
  265. } else return [];
  266. };
  267. const filterTable = function () {
  268. // console.log('Search Button Pressed');
  269. // console.log(`Filters are: ${indianstate} ---> ${city} ----> ${category}`);
  270. let a = [];
  271. if (category === 'all') {
  272. // console.log("All category selected");
  273. if (city === 'all') {
  274. if (indianstate === 'all') {
  275. Object.values(resourcedict).forEach((state) => {
  276. Object.values(state).forEach((citydata) => {
  277. Object.values(citydata).forEach((category) => {
  278. category.forEach((x) => a.push(x));
  279. });
  280. });
  281. });
  282. } else {
  283. Object.values(resourcedict[indianstate]).forEach((citydata) => {
  284. Object.values(citydata).forEach((category) => {
  285. category.forEach((x) => a.push(x));
  286. });
  287. });
  288. }
  289. } else {
  290. Object.values(resourcedict[indianstate][city]).forEach((x) => {
  291. x.forEach((y) => a.push(y));
  292. });
  293. }
  294. } else {
  295. // console.log(`Category chosen ${category}`);
  296. // a = resourcedict[indianstate][city][category];
  297. if (indianstate === 'all' && city === 'all') {
  298. Object.values(resourcedict).forEach((state) => {
  299. Object.values(state).forEach((citydata) => {
  300. Object.values(citydata).forEach((categorydata) => {
  301. categorydata.forEach((x) => {
  302. if (x.category === category) a.push(x);
  303. });
  304. });
  305. });
  306. });
  307. } else if (indianstate !== 'all' && city === 'all') {
  308. Object.values(resourcedict[indianstate]).forEach((citydata) => {
  309. if (category in citydata) {
  310. citydata[category].forEach((x) => {
  311. a.push(x);
  312. });
  313. }
  314. });
  315. } else {
  316. a = resourcedict[indianstate][city][category];
  317. }
  318. }
  319. try {
  320. if ('PAN India' in resourcedict) {
  321. resourcedict['PAN India']['Multiple']['CoVID-19 Testing Lab'].forEach(
  322. (element) => {
  323. a.push(element);
  324. }
  325. );
  326. }
  327. } catch (err) {
  328. // console.log('No PAN India row found');
  329. }
  330. setData(a);
  331. setPartData(a.slice(0, 30));
  332. // console.log(resourcedict[indianstate][city][category]);
  333. // console.log(data);
  334. setShowTable(true);
  335. };
  336. const changeIndianState = function (changedstateevent) {
  337. setIndianState(changedstateevent.target.value);
  338. // setCity(
  339. // Object.keys(resourcedict[changedstateevent.target.value]).sort()[0]
  340. // );
  341. if (changedstateevent.target.value === '') {
  342. setCity('');
  343. document.getElementById('cityselect1').selectedIndex = 0;
  344. setCategory('');
  345. document.getElementById('categoryselect').selectedIndex = 0;
  346. } else {
  347. setCity('all');
  348. document.getElementById('cityselect1').selectedIndex = 1;
  349. setCategory('all');
  350. document.getElementById('categoryselect').selectedIndex = 1;
  351. }
  352. };
  353. const changeCity = function (changedcityevent) {
  354. setCity(changedcityevent.target.value);
  355. setCategory('all');
  356. document.getElementById('categoryselect').selectedIndex = 1;
  357. };
  358. const changeCategory = function (changedcategoryevent) {
  359. setCategory(changedcategoryevent.target.value);
  360. // console.log(changedcategoryevent.target.value);
  361. };
  362. const appendData = function () {
  363. const tempArr = partData.concat(
  364. data.slice(partData.length, partData.length + 30)
  365. );
  366. setPartData(tempArr);
  367. };
  368. const openSharingLink = function (message) {
  369. const shareUri = `https://www.addtoany.com/share#url=${encodeURI(
  370. 'https://www.covid19india.org/essentials'
  371. )}&title=${encodeURI(message)}`;
  372. const h = 500;
  373. const w = 500;
  374. const left = window.screen.width / 2 - w / 2;
  375. const top = window.screen.height / 2 - h / 2;
  376. return window.open(
  377. shareUri,
  378. document.title,
  379. 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' +
  380. w +
  381. ', height=' +
  382. h +
  383. ', top=' +
  384. top +
  385. ', left=' +
  386. left
  387. );
  388. };
  389. const openSharingTray = function () {
  390. const message =
  391. 'Discover nearest coronavirus support and essential service providers such as testing lab centres, accommodation shelters and vegetable vendors at ';
  392. if (navigator.share !== undefined) {
  393. navigator
  394. .share({
  395. title: document.title,
  396. text: message,
  397. url: 'https://www.covid19india.org/essentials',
  398. })
  399. .then()
  400. .catch((error) => console.log(error));
  401. } else {
  402. openSharingLink(message);
  403. }
  404. };
  405. return (
  406. <div className="Resources">
  407. <div className="filtersection">
  408. <div className="filtertitle">
  409. <h3>Service Before Self</h3>
  410. </div>
  411. {!isDesktop && (
  412. <React.Fragment>
  413. <div
  414. className="disclaimercontainer"
  415. style={{
  416. display: 'flex',
  417. flexDirection: 'row-reverse',
  418. width: '100%',
  419. justifyContent: 'space-between',
  420. alignItems: 'center',
  421. }}
  422. >
  423. <div
  424. className="button is-purple mobile-disclaimer-button"
  425. style={{
  426. margin: '0.2rem',
  427. padding: '0.5rem',
  428. alignItems: 'center',
  429. }}
  430. onClick={handleDisclaimerClick}
  431. >
  432. Disclaimer
  433. <ErrorOutlineOutlinedIcon
  434. htmlColor="#6c757d"
  435. fontSize="0.1rem"
  436. />
  437. </div>
  438. <Popover
  439. id={id}
  440. open={isDisclaimerOpen}
  441. classes={{ root: classesPopOver.root }}
  442. anchorEl={anchorEl}
  443. onClose={handleDisclaimerClose}
  444. anchorOrigin={{
  445. vertical: 'bottom',
  446. horizontal: 'right',
  447. }}
  448. transformOrigin={{
  449. vertical: 'top',
  450. horizontal: 'right',
  451. }}
  452. >
  453. <h6
  454. style={{
  455. paddingLeft: '0.5rem',
  456. color: '#343a40',
  457. margin: '0.3rem 0rem',
  458. }}
  459. >
  460. <p>
  461. We are a community sourced listing platform and are not
  462. associated with any of the organisations listed below.
  463. </p>
  464. <p>
  465. Although we verify all our listings, we request you to
  466. follow all the guidelines and take necessary precautions.
  467. </p>
  468. <p>
  469. We encourage you to report any error or suspicious activity
  470. so we can take immediate action.
  471. </p>
  472. </h6>
  473. </Popover>
  474. <a
  475. href="https://docs.google.com/forms/d/e/1FAIpQLSfquevp7_rdgdEoDgTdimWwTXO3B9TjFEAm3DbrMDXxCiuwuA/viewform"
  476. className="button add-entry is-purple"
  477. target="_blank"
  478. rel="noopener noreferrer"
  479. style={{ margin: '0.2rem 0.2rem', padding: '0.5rem 0.5rem' }}
  480. >
  481. <span>Add</span>
  482. </a>
  483. <a
  484. href="https://forms.gle/AG5hmYxyhto3NjU46"
  485. className="button add-entry is-purple"
  486. target="_blank"
  487. rel="noopener noreferrer"
  488. style={{ margin: '0.2rem 0.2rem', padding: '0.5rem 0.5rem' }}
  489. >
  490. <span>Feedback</span>
  491. </a>
  492. </div>
  493. <div className="resourcefilters">
  494. <FormControl
  495. variant="outlined"
  496. size="small"
  497. className="resourcefilterMobile"
  498. classes={{ root: classesFormControl.root }}
  499. >
  500. <InputLabel
  501. id="demo-simple-select-outlined-label"
  502. classes={{ root: classesInputLabel.root }}
  503. >
  504. State/UT
  505. </InputLabel>
  506. <Select
  507. native
  508. labelId="demo-simple-select-outlined-label"
  509. id="stateselect"
  510. value={indianstate}
  511. onChange={changeIndianState}
  512. defaultValue="all"
  513. label="State/UT"
  514. classes={{ root: classesMenuItem.root }}
  515. >
  516. <option value="all" classes={{ root: classesMenuItem.root }}>
  517. All states
  518. </option>
  519. {getIndianStateOptions()}
  520. </Select>
  521. </FormControl>
  522. <FormControl
  523. variant="outlined"
  524. size="small"
  525. className="resourcefilterMobile"
  526. classes={{ root: classesFormControl.root }}
  527. >
  528. <InputLabel
  529. id="demo-simple-select-outlined-label"
  530. classes={{ root: classesInputLabel.root }}
  531. >
  532. City
  533. </InputLabel>
  534. <Select
  535. native
  536. labelId="demo-simple-select-outlined-label"
  537. id="cityselect1"
  538. value={city}
  539. onChange={changeCity}
  540. defaultValue="all"
  541. label="City"
  542. classes={{ root: classesMenuItem.root }}
  543. >
  544. <option value="all" classes={{ root: classesMenuItem.root }}>
  545. All Cities
  546. </option>
  547. {getCityOptions()}
  548. </Select>
  549. </FormControl>
  550. <FormControl
  551. variant="outlined"
  552. size="small"
  553. className="resourcefilterMobile"
  554. classes={{ root: classesFormControl.root }}
  555. >
  556. <InputLabel
  557. id="demo-simple-select-outlined-label"
  558. classes={{ root: classesInputLabel.root }}
  559. >
  560. Services
  561. </InputLabel>
  562. <Select
  563. native
  564. labelId="demo-simple-select-outlined-label"
  565. id="categoryselect"
  566. value={category}
  567. onChange={changeCategory}
  568. defaultValue="all"
  569. label="Services"
  570. classes={{ root: classesMenuItem.root }}
  571. >
  572. <option value="all" classes={{ root: classesMenuItem.root }}>
  573. All Categories
  574. </option>
  575. {getCategoryOptions()}
  576. </Select>
  577. </FormControl>
  578. <div
  579. className="search-share"
  580. style={{
  581. display: 'flex',
  582. flexDirection: 'row',
  583. justifyContent: 'space-between',
  584. width: '100%',
  585. }}
  586. >
  587. <button
  588. className="button is-purple"
  589. disabled={!indianstate}
  590. onClick={filterTable}
  591. style={{
  592. margin: '0.2rem 0.2rem',
  593. padding: '0.5rem 0.5rem',
  594. width: '50%',
  595. justifyContent: 'center',
  596. }}
  597. >
  598. Search
  599. </button>
  600. <button
  601. onClick={openSharingTray}
  602. className="button add-entry is-purple"
  603. style={{
  604. margin: '0.2rem 0.2rem',
  605. padding: '0.5rem 0.5rem',
  606. width: '50%',
  607. justifyContent: 'center',
  608. }}
  609. >
  610. <span>Share</span>
  611. </button>
  612. </div>
  613. </div>
  614. </React.Fragment>
  615. )}
  616. {isDesktop && (
  617. <React.Fragment>
  618. <div
  619. className="disclaimercontainer"
  620. style={{
  621. display: 'flex',
  622. flexDirection: 'row-reverse',
  623. width: '100%',
  624. justifyContent: 'space-between',
  625. alignItems: 'center',
  626. }}
  627. >
  628. <div
  629. className="button disclaimer-button"
  630. style={{
  631. margin: '0rem',
  632. padding: '0.3rem',
  633. alignItems: 'center',
  634. justifyContent: 'space-around',
  635. }}
  636. onClick={handleDisclaimerClick}
  637. >
  638. Disclaimer
  639. <ErrorOutlineOutlinedIcon
  640. htmlColor="#6c757d"
  641. fontSize="small"
  642. />
  643. </div>
  644. <Popover
  645. id={id}
  646. open={isDisclaimerOpen}
  647. classes={{ root: classesPopOver.root }}
  648. anchorEl={anchorEl}
  649. onClose={handleDisclaimerClose}
  650. anchorOrigin={{
  651. vertical: 'bottom',
  652. horizontal: 'right',
  653. }}
  654. transformOrigin={{
  655. vertical: 'top',
  656. horizontal: 'right',
  657. }}
  658. >
  659. <h6
  660. style={{
  661. paddingLeft: '0.5rem',
  662. color: '#343a40',
  663. margin: '0.3rem 0rem',
  664. }}
  665. >
  666. <p>
  667. We are a community sourced listing platform and are not
  668. associated with any of the organisations listed below.
  669. </p>
  670. <p>
  671. Although we verify all our listings, we request you to
  672. follow all the guidelines and take necessary precautions.
  673. </p>
  674. <p>
  675. We encourage you to report any error or suspicious activity
  676. so we can take immediate action.
  677. </p>
  678. </h6>
  679. </Popover>
  680. </div>
  681. <div className="resourcefilters">
  682. <FormControl
  683. variant="outlined"
  684. size="small"
  685. className="resourcefilterMobile"
  686. classes={{ root: classesFormControl.root }}
  687. >
  688. <InputLabel
  689. id="demo-simple-select-outlined-label"
  690. classes={{ root: classesInputLabel.root }}
  691. >
  692. State/UT
  693. </InputLabel>
  694. <Select
  695. native
  696. labelId="demo-simple-select-outlined-label"
  697. id="stateselect"
  698. value={indianstate}
  699. onChange={changeIndianState}
  700. defaultValue="all"
  701. label="State/UT"
  702. classes={{ root: classesMenuItem.root }}
  703. >
  704. <option value="all" classes={{ root: classesMenuItem.root }}>
  705. All states
  706. </option>
  707. {getIndianStateOptions()}
  708. </Select>
  709. </FormControl>
  710. <FormControl
  711. variant="outlined"
  712. size="small"
  713. className="resourcefilterMobile"
  714. classes={{ root: classesFormControl.root }}
  715. >
  716. <InputLabel
  717. id="demo-simple-select-outlined-label"
  718. classes={{ root: classesInputLabel.root }}
  719. >
  720. City
  721. </InputLabel>
  722. <Select
  723. native
  724. labelId="demo-simple-select-outlined-label"
  725. id="cityselect1"
  726. value={city}
  727. onChange={changeCity}
  728. defaultValue="all"
  729. label="City"
  730. classes={{ root: classesMenuItem.root }}
  731. >
  732. <option value="all" classes={{ root: classesMenuItem.root }}>
  733. All cities
  734. </option>
  735. {getCityOptions()}
  736. </Select>
  737. </FormControl>
  738. <FormControl
  739. variant="outlined"
  740. size="small"
  741. className="resourcefilterMobile"
  742. classes={{ root: classesFormControl.root }}
  743. >
  744. <InputLabel
  745. id="demo-simple-select-outlined-label"
  746. classes={{ root: classesInputLabel.root }}
  747. >
  748. Services
  749. </InputLabel>
  750. <Select
  751. native
  752. labelId="demo-simple-select-outlined-label"
  753. id="categoryselect"
  754. value={category}
  755. onChange={changeCategory}
  756. defaultValue="all"
  757. label="Services"
  758. classes={{ root: classesMenuItem.root }}
  759. >
  760. <option value="all" classes={{ root: classesMenuItem.root }}>
  761. All categories
  762. </option>
  763. {getCategoryOptions()}
  764. </Select>
  765. </FormControl>
  766. <button
  767. className="button is-purple"
  768. disabled={!indianstate}
  769. onClick={filterTable}
  770. style={!indianstate ? { pointerEvents: 'none' } : null}
  771. >
  772. Search
  773. </button>
  774. </div>
  775. <div
  776. className="misclinkscontainer"
  777. style={{
  778. display: 'flex',
  779. flexDirection: 'row',
  780. width: '100%',
  781. justifyContent: 'center',
  782. marginTop: '0.2rem',
  783. marginBottom: '0.6rem',
  784. }}
  785. >
  786. <a
  787. href="https://docs.google.com/forms/d/e/1FAIpQLSfquevp7_rdgdEoDgTdimWwTXO3B9TjFEAm3DbrMDXxCiuwuA/viewform"
  788. className="button add-entry is-purple"
  789. target="_blank"
  790. rel="noopener noreferrer"
  791. style={{ margin: '0rem 0.2rem', padding: '0.1rem 0.5rem' }}
  792. >
  793. <span>Add Entry</span>
  794. </a>
  795. <a
  796. href="https://forms.gle/AG5hmYxyhto3NjU46"
  797. className="button add-entry is-purple"
  798. target="_blank"
  799. rel="noopener noreferrer"
  800. style={{ margin: '0rem 0.2rem', padding: '0.1rem 0.5rem' }}
  801. >
  802. <span>Feedback</span>
  803. </a>
  804. <button
  805. onClick={openSharingTray}
  806. className="button add-entry is-purple"
  807. style={{ margin: '0rem 0.2rem', padding: '0.4rem' }}
  808. >
  809. <span>Share</span>
  810. </button>
  811. </div>
  812. </React.Fragment>
  813. )}
  814. </div>
  815. {showTable && (
  816. <React.Fragment>
  817. <ResourceTable
  818. columns={memocols}
  819. data={partData}
  820. totalCount={data.length}
  821. isDesktop={isDesktop}
  822. onScrollUpdate={appendData}
  823. city={city}
  824. category={category}
  825. indianstate={indianstate}
  826. />
  827. <div>
  828. <Fab
  829. color="inherit"
  830. aria-label="gototop"
  831. id="gototopbtn"
  832. onClick={topFunction}
  833. size="small"
  834. style={{
  835. position: 'fixed',
  836. bottom: '1rem',
  837. right: '1rem',
  838. zIndex: '1000',
  839. }}
  840. >
  841. <NavigationOutlinedIcon htmlColor="#201aa299" />
  842. </Fab>
  843. </div>
  844. </React.Fragment>
  845. )}
  846. </div>
  847. );
  848. }
  849. export default Resources;