Skip to content

Commit

Permalink
pakcage.json
Browse files Browse the repository at this point in the history
  • Loading branch information
hazyuval committed Aug 16, 2023
1 parent d2d5477 commit 452499d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 22 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@babel/eslint-parser": "^7.14.7",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.61",
Expand Down Expand Up @@ -33,6 +34,7 @@
"react-leaflet": "3.1.0",
"react-leaflet-google-layer": "^2.0.4",
"react-router-dom": "^6.15.0",
"react-scripts": "^5.0.1",
"react-share": "^4.4.0",
"recharts": "^2.0.9",
"tinycolor2": "^1.4.2",
Expand Down
54 changes: 32 additions & 22 deletions src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useCallback, useEffect, useState } from 'react';
import { Box, Button, makeStyles, Theme, Typography } from '@material-ui/core';
import { observer } from 'mobx-react-lite';
import MapDialog from 'components/molecules/MapDialog';
Expand All @@ -12,6 +12,17 @@ import StreetCard, { StreetCardProps } from 'components/StreetCard';
import ResponsiveDrawer from 'components/molecules/infoDrawer/Drawer';
import SectionInfo from 'components/molecules/sectionInfo';

enum LocationType {
cityAndStreet,
sagment
}

type Location = {
type: LocationType,
location: string,
id?: string
}

const HomePage = () => {
const classes = useStyles();
const navigate = useNavigate();
Expand All @@ -22,7 +33,7 @@ const HomePage = () => {

const [open, setOpen] = useState(false);

const [currentLocation, setCurrentLocation] = useState<string>('תל אביב, אלנבי')
const [currentLocation, setCurrentLocation] = useState<Location>({ type: LocationType.cityAndStreet, location: 'תל אביב, אלנבי' })

const [isDrawerOpen, setIsDrawerOpen] = useState(false);
const [selectedSection, setSelectedSection] = useState({});
Expand All @@ -31,7 +42,6 @@ const HomePage = () => {
setIsDrawerOpen(!isDrawerOpen);
};


const [cards, setCards] = useState<StreetCardProps[]>([
{ streetName: 'בוגרשוב', city: 'תל אביב', handleClick: handleDrawerToggle },
{ streetName: 'בוגרשוב', city: 'תל אביב', handleClick: handleDrawerToggle },
Expand All @@ -56,7 +66,7 @@ const HomePage = () => {
const onLocationSearch = () => {
if (roadSegmentLocation) {
//navigate(`${settingsStore.currentLanguageRouteString}/location/${roadSegmentLocation?.road_segment_id}`);
setCurrentLocation(roadSegmentLocation?.road_segment_id.toString())
setCurrentLocation({ type: LocationType.sagment, location: roadSegmentLocation.road_segment_name, id: roadSegmentLocation.road_segment_id.toString() })
setOpen(false);
store.setGpsLocationData(null);
}
Expand All @@ -67,35 +77,35 @@ const HomePage = () => {
console.log('city is', city);
console.log('street is', street);
//navigate(`${settingsStore.currentLanguageRouteString}/cityAndStreet/${street}/${city}`);
setCurrentLocation(`${street},${city}`)
setCurrentLocation({ type: LocationType.cityAndStreet, location: `${street}, ${city}` })
setOpen(false);
};


return (
<Box className={classes.container}>
<Box className={classes.columnContainer}>
{cards.map((streetData, index) => (
</Typography>
{cards.map((streetData: StreetCardProps, index: number) => (
<Typography>
{currentLocation.location} - <Button onClick={() => setOpen(true)}>שינוי כתובת</Button>
</Typography>
{cards.map((streetData: StreetCardProps, index: number) => (
<StreetCard key={index} {...streetData} />
))}

<MapDialog
open={open}
section={roadSegmentLocation?.road_segment_name}
roadNumber={roadSegmentLocation?.road1}
onLocationChange={onLocationChange}
onClose={() => {
setOpen(false);
store.setGpsLocationData(null);
}}
onSearch={onLocationSearch}
onStreetAndCitySearch={onStreetAndCitySearch}
/>
<MapDialog
open={open}
section={roadSegmentLocation?.road_segment_name}
roadNumber={roadSegmentLocation?.road1}
onLocationChange={onLocationChange}
onClose={() => {
setOpen(false);
store.setGpsLocationData(null);
}}
onSearch={onLocationSearch}
onStreetAndCitySearch={onStreetAndCitySearch}
/>
</Box>
<Box className={classes.columnContainer}>
<SectionInfo section={selectedSection}/>
<SectionInfo section={selectedSection} />
</Box>
{/* <ResponsiveDrawer isDrawerOpen={isDrawerOpen}>
Expand Down

0 comments on commit 452499d

Please sign in to comment.