Skip to content

Commit

Permalink
- Updated the users data
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Svirsky committed Nov 16, 2023
1 parent fb6dddc commit 0012b39
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 12 deletions.
27 changes: 16 additions & 11 deletions src/components/header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {Link} from 'react-router-dom';
import {initSdkQr, SDK, sendEvent} from '../../service/cere-integration-service';
import {getApplicantId, setApplicantId} from '../../service/local-storage-service';
import {CopyToClipboard} from 'react-copy-to-clipboard';
import user1Json from './../../data/user1.json';
import user2Json from './../../data/user2.json';

const Header = () => {
var settings = {
Expand Down Expand Up @@ -148,16 +150,19 @@ const Header = () => {
}

function discoverDivClicked() {
sendEvent(SDK.it, 'AI_DEMO_EVENT', SDK.keyPair, {
"session_id": "754aba9225558c3ec38376e21f25fd24",
"wallet_id": "0x19eDB0CA6AA0Ab4FDEe9556A29a574C031b7BF31",
"game_id": "b7a56873cd771f2c446d369b649430b65a756ba278ff97ec81bb6f55b2e73569",
"start_time": "2023-11-08T15:26:00.796Z",
"duration_seconds": 227,
"score": 12000,
"latitude": 38.01,
"longitude": -122.2
});
const userPayloads = [{
userId: 'user1',
pubKey: '0x59A6a098e57114D512c3e77060F8a64264Ef57BD',
payload: user1Json,
}, {
userId: 'user2',
pubKey: '0x6Df737a290e821D67C9206BF745da11E78E6c06B',
payload: user2Json,
}];

const userPayload = userPayloads.find(payload => payload.pubKey.toLowerCase() === userId.toLowerCase())

sendEvent(SDK.it, 'AI_DEMO_EVENT', SDK.keyPair, userPayload?.payload || {});
}

const [applicantId, applicantIdInput] = useInput({type: 'text'});
Expand All @@ -167,7 +172,7 @@ const Header = () => {
<div className="modal">
<div className="modal-content2">
<div className="close-button" onClick={hide}>
&times;
&times;
</div>
<div style={{height: '90%', paddingTop: '40px'}}>
<iframe id="contentIFrame" width={"100%"} height={"100%"} frameBorder={0}></iframe>
Expand Down
39 changes: 39 additions & 0 deletions src/data/user1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"location_observations": [
{
"latitude": 38.15449548076718,
"longitude": -122.5329655585224,
"time": "2023-11-08T10:12:00Z"
},
{
"latitude": 37.77664361078221,
"longitude": -122.70289434290864,
"time": "2023-11-08T10:18:00Z"
},
{
"latitude": 38.13911017207356,
"longitude": -122.48818341474036,
"time": "2023-11-08T10:24:00Z"
},
{
"latitude": 38.13116168559493,
"longitude": -122.79302246875,
"time": "2023-11-08T10:30:00Z"
},
{
"latitude": 37.782801435809205,
"longitude": -122.38292346999424,
"time": "2023-11-08T10:36:00Z"
},
{
"latitude": 38.11449509458794,
"longitude": -122.0784899075185,
"time": "2023-11-08T10:42:00Z"
},
{
"latitude": 37.86438862905752,
"longitude": -122.82234766522456,
"time": "2023-11-08T10:48:00Z"
}
]
}
49 changes: 49 additions & 0 deletions src/data/user2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"location_observations": [
{
"latitude": 41.0217274512395,
"longitude": -73.5785121537183,
"time": "2023-11-08T20:08:24Z"
},
{
"latitude": 40.72061601637857,
"longitude": -73.5356015090423,
"time": "2023-11-08T20:14:06Z"
},
{
"latitude": 40.61653370645968,
"longitude": -73.80633614239518,
"time": "2023-11-08T20:19:48Z"
},
{
"latitude": 40.68616039128104,
"longitude": -73.60325544359148,
"time": "2023-11-08T20:25:30Z"
},
{
"latitude": 40.37209590379633,
"longitude": -73.88912082916036,
"time": "2023-11-08T20:31:12Z"
},
{
"latitude": 40.9128260893737,
"longitude": -74.08973591215195,
"time": "2023-11-08T20:36:54Z"
},
{
"latitude": 40.52207775315681,
"longitude": -73.92031392638638,
"time": "2023-11-08T20:42:36Z"
},
{
"latitude": 40.60728423358229,
"longitude": -73.66037084528787,
"time": "2023-11-08T20:48:18Z"
},
{
"latitude": 37.86438862905752,
"longitude": -122.82234766522456,
"time": "2023-11-08T21:48:00Z"
}
]
}
2 changes: 1 addition & 1 deletion src/service/cere-integration-service.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const CERE_SDK_URL = 'https://sdk.dev.cere.io/v5.7.4/web.js';
export const SDK = {};

function initCereSdk() {
return window.CereSDK.web.cereWebSDK(applicationId, userId, {
return window.CereSDK.web.cereWebSDK(applicationId, window.localStorage.getItem('applicantId') || userId, {
deployment: 'dev',
});
}
Expand Down

0 comments on commit 0012b39

Please sign in to comment.