Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
thecybernanny-webapp
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
asranov0003
thecybernanny-webapp
Commits
12a8d101
Commit
12a8d101
authored
Jul 30, 2025
by
asranov0003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add cmarker and center map in routes page
parent
b5b97bf4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
8 deletions
+26
-8
Routes.tsx
src/pages/Routes/Routes.tsx
+26
-6
accountSlice.ts
src/stores/slices/accountSlice.ts
+0
-2
No files found.
src/pages/Routes/Routes.tsx
View file @
12a8d101
...
@@ -10,12 +10,17 @@ import {
...
@@ -10,12 +10,17 @@ import {
type
RootState
,
type
RootState
,
}
from
"../../stores/store"
;
}
from
"../../stores/store"
;
import
{
getRouteHistory
}
from
"../../stores/slices/dataSlice"
;
import
{
getRouteHistory
}
from
"../../stores/slices/dataSlice"
;
import
CMarker
from
"../../components/CMarker"
;
const
Routes
:
React
.
FC
=
()
=>
{
const
Routes
:
React
.
FC
=
()
=>
{
const
[
fromDate
,
setFromDate
]
=
useState
(
""
);
const
[
fromDate
,
setFromDate
]
=
useState
(
""
);
const
[
fromTime
,
setFromTime
]
=
useState
(
""
);
const
[
fromTime
,
setFromTime
]
=
useState
(
""
);
const
[
toDate
,
setToDate
]
=
useState
(
""
);
const
[
toDate
,
setToDate
]
=
useState
(
""
);
const
[
toTime
,
setToTime
]
=
useState
(
""
);
const
[
toTime
,
setToTime
]
=
useState
(
""
);
const
[
mapCenter
,
setMapCenter
]
=
useState
({
lat
:
37.33
,
lng
:
-
122
,
});
const
{
selectedDevice
}
=
useAppSelector
((
state
:
RootState
)
=>
state
.
device
);
const
{
selectedDevice
}
=
useAppSelector
((
state
:
RootState
)
=>
state
.
device
);
const
{
routeHistory
,
isRouteHistoryLoading
}
=
useAppSelector
(
const
{
routeHistory
,
isRouteHistoryLoading
}
=
useAppSelector
(
...
@@ -47,6 +52,18 @@ const Routes: React.FC = () => {
...
@@ -47,6 +52,18 @@ const Routes: React.FC = () => {
}
}
},
[
dispatch
,
selectedDevice
]);
},
[
dispatch
,
selectedDevice
]);
useEffect
(()
=>
{
if
(
routeHistory
.
length
>
0
)
{
const
lat
=
Number
(
routeHistory
[
0
]?.
location
.
lat
);
const
lng
=
Number
(
routeHistory
[
0
]?.
location
.
lon
);
if
(
!
isNaN
(
lat
)
&&
!
isNaN
(
lng
))
{
setMapCenter
({
lat
,
lng
});
}
}
else
{
setMapCenter
({
lat
:
37.33
,
lng
:
-
122
});
}
},
[
routeHistory
]);
const
handleSearch
=
()
=>
{
const
handleSearch
=
()
=>
{
if
(
!
selectedDevice
)
return
;
if
(
!
selectedDevice
)
return
;
...
@@ -64,10 +81,6 @@ const Routes: React.FC = () => {
...
@@ -64,10 +81,6 @@ const Routes: React.FC = () => {
);
);
};
};
useEffect
(()
=>
{
console
.
log
(
"routeHistory"
,
routeHistory
);
},
[
routeHistory
]);
return
(
return
(
<
div
className=
"routes wrapper"
>
<
div
className=
"routes wrapper"
>
<
SectionHeader
to=
"/home"
/>
<
SectionHeader
to=
"/home"
/>
...
@@ -75,10 +88,17 @@ const Routes: React.FC = () => {
...
@@ -75,10 +88,17 @@ const Routes: React.FC = () => {
<
div
className=
"routes__content"
>
<
div
className=
"routes__content"
>
<
div
style=
{
{
height
:
"67vh"
,
width
:
"100%"
}
}
>
<
div
style=
{
{
height
:
"67vh"
,
width
:
"100%"
}
}
>
<
GoogleMapReact
<
GoogleMapReact
defaultCenter=
{
{
lat
:
40.7128
,
lng
:
-
74.006
}
}
center=
{
mapCenter
}
defaultZoom=
{
12
}
defaultZoom=
{
12
}
options=
{
{
disableDefaultUI
:
true
}
}
options=
{
{
disableDefaultUI
:
true
}
}
></
GoogleMapReact
>
>
{
routeHistory
.
length
>
0
&&
(
<
CMarker
lat=
{
Number
(
routeHistory
[
0
]?.
location
.
lat
)
}
lng=
{
Number
(
routeHistory
[
0
]?.
location
.
lon
)
}
/>
)
}
</
GoogleMapReact
>
</
div
>
</
div
>
<
div
className=
"routes__filter"
>
<
div
className=
"routes__filter"
>
...
...
src/stores/slices/accountSlice.ts
View file @
12a8d101
...
@@ -54,8 +54,6 @@ export const checkPassword = createAsyncThunk(
...
@@ -54,8 +54,6 @@ export const checkPassword = createAsyncThunk(
password
,
password
,
});
});
console
.
log
(
"response"
,
response
);
if
(
response
?.
message
===
"valid"
)
{
if
(
response
?.
message
===
"valid"
)
{
const
deleteAccountResponse
=
await
sendRpcRequest
<
{
const
deleteAccountResponse
=
await
sendRpcRequest
<
{
message
:
string
;
message
:
string
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment