-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
463 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"appId": "com.example.app", | ||
"appName": "senseBox:Bike X SIMPORT", | ||
"webDir": "out", | ||
"server": { | ||
"url": "http://192.168.0.220:3000" | ||
} | ||
"appId": "com.example.app", | ||
"appName": "senseBox:Bike X SIMPORT", | ||
"webDir": "out", | ||
"server": { | ||
"url": "http://192.168.0.220:3000" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,34 @@ | ||
PODS: | ||
- Capacitor (5.3.0): | ||
- CapacitorCordova | ||
- CapacitorCommunityBackgroundGeolocation (0.0.1): | ||
- Capacitor | ||
- CapacitorCommunityBluetoothLe (3.0.1): | ||
- Capacitor | ||
- CapacitorCordova (5.3.0) | ||
|
||
DEPENDENCIES: | ||
- "Capacitor (from `../../node_modules/@capacitor/ios`)" | ||
- "CapacitorCommunityBackgroundGeolocation (from `../../node_modules/@capacitor-community/background-geolocation`)" | ||
- "CapacitorCommunityBluetoothLe (from `../../node_modules/@capacitor-community/bluetooth-le`)" | ||
- "CapacitorCordova (from `../../node_modules/@capacitor/ios`)" | ||
|
||
EXTERNAL SOURCES: | ||
Capacitor: | ||
:path: "../../node_modules/@capacitor/ios" | ||
CapacitorCommunityBackgroundGeolocation: | ||
:path: "../../node_modules/@capacitor-community/background-geolocation" | ||
CapacitorCommunityBluetoothLe: | ||
:path: "../../node_modules/@capacitor-community/bluetooth-le" | ||
CapacitorCordova: | ||
:path: "../../node_modules/@capacitor/ios" | ||
|
||
SPEC CHECKSUMS: | ||
Capacitor: 1ac9165943bc4f2137642d218c5ba05df811de69 | ||
CapacitorCommunityBackgroundGeolocation: 6f26f4290377dbd1d6dec21e62cb66f008f61ec7 | ||
CapacitorCommunityBluetoothLe: 308770c1ee9499c216776159326bc2b9a49076b4 | ||
CapacitorCordova: b9374d68e63ce29e96ab5db994cf14fbefd722c9 | ||
|
||
PODFILE CHECKSUM: 209b88b5339b30dc7f4dfccad65ac57cc69b251e | ||
PODFILE CHECKSUM: 6e41747aee00f59e1e4a8249f9aa31ede26dcdf5 | ||
|
||
COCOAPODS: 1.11.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
import { Navbar } from '@/components/ui/Navbar' | ||
import { TopBar } from '@/components/ui/TopBar' | ||
import { Button } from '@/components/ui/button' | ||
import { | ||
AcademicCapIcon, | ||
BellIcon, | ||
ExclamationTriangleIcon, | ||
} from '@heroicons/react/24/outline' | ||
import Image from 'next/image' | ||
import Logo from '../../public/bike.png' | ||
import Geolocation from '@/components/Geolocation' | ||
|
||
export default function Home() { | ||
return <div className="flex h-full w-full flex-col">des</div> | ||
return ( | ||
<div className="flex h-full w-full flex-col"> | ||
<Geolocation /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,77 @@ | ||
"use client"; | ||
import MapComponent from "@/components/Map/Map"; | ||
import { | ||
BeakerIcon, | ||
ChartBarIcon, | ||
CloudIcon, | ||
PauseIcon, | ||
PlayIcon, | ||
RssIcon, | ||
SignalIcon, | ||
SunIcon, | ||
TruckIcon, | ||
} from "@heroicons/react/24/outline"; | ||
import { | ||
Dialog, | ||
DialogContent, | ||
DialogDescription, | ||
DialogHeader, | ||
DialogTitle, | ||
} from "@/components/ui/dialog"; | ||
import { cx } from "class-variance-authority"; | ||
import { Settings2Icon, SettingsIcon } from "lucide-react"; | ||
import { useState } from "react"; | ||
import { DialogTrigger } from "@radix-ui/react-dialog"; | ||
import SettingsModal from "@/components/Map/Settings"; | ||
import RecordButton from "@/components/Map/RecordButton"; | ||
import MeasurementsOverview from "@/components/Map/MeasurementsOverview"; | ||
import ControlBar from "@/components/Map/ControlBar"; | ||
'use client' | ||
|
||
import MapComponent from '@/components/Map/Map' | ||
import { useEffect, useState } from 'react' | ||
import MeasurementsOverview from '@/components/Map/MeasurementsOverview' | ||
import ControlBar from '@/components/Map/ControlBar' | ||
import useSenseBox from '@/lib/useSenseBox' | ||
import { Source, Layer } from 'react-map-gl/maplibre' | ||
|
||
export default function Home() { | ||
const [recording, setRecording] = useState(false); | ||
const [recording, setRecording] = useState(false) | ||
|
||
const [data, setData] = useState({ | ||
temperature: 0, | ||
humidity: 0, | ||
pm1: 0, | ||
pm25: 0, | ||
pm4: 0, | ||
pm10: 0, | ||
accelerationX: 0, | ||
accelerationY: 0, | ||
accelerationZ: 0, | ||
speed: 0, | ||
}); | ||
const toggleRecording = () => { | ||
setRecording(!recording); | ||
}; | ||
const { values, connect, isConnected, disconnect } = useSenseBox() | ||
|
||
useEffect(() => { | ||
if (recording && !isConnected) { | ||
connect() | ||
return | ||
} | ||
if (!recording && isConnected) { | ||
disconnect() | ||
return | ||
} | ||
}) | ||
|
||
return ( | ||
<div className="h-full w-full"> | ||
<MapComponent /> | ||
<div className="flex flex-col"> | ||
<div className="absolute left-5 top-20"> | ||
<MeasurementsOverview data={data} /> | ||
</div> | ||
<div className="absolute top-20 right-5 "> | ||
<RecordButton recording={recording} /> | ||
</div> | ||
<div className="absolute bottom-20 right-5 "> | ||
<ControlBar recording={recording} toggleRecording={toggleRecording} /> | ||
</div> | ||
</div> | ||
<div className="relative h-full w-full"> | ||
<MapComponent> | ||
<Source | ||
id="location" | ||
type="geojson" | ||
data={{ | ||
type: 'Point', | ||
coordinates: [ | ||
values.at(-1)?.gps_lat || 0, | ||
values.at(-1)?.gps_lng || 0, | ||
], | ||
}} | ||
> | ||
<Layer | ||
id="point" | ||
type="circle" | ||
paint={{ | ||
'circle-radius': 10, | ||
'circle-color': '#007cbf', | ||
}} | ||
/> | ||
</Source> | ||
<Source | ||
id="location-history" | ||
type="geojson" | ||
data={{ | ||
features: values.map(v => ({ | ||
type: 'Feature', | ||
properties: {}, | ||
geometry: { | ||
type: 'Point', | ||
coordinates: [v.gps_lat || 0, v.gps_lng || 0], | ||
}, | ||
})), | ||
type: 'FeatureCollection', | ||
}} | ||
> | ||
<Layer id="point" type="line" /> | ||
</Source> | ||
</MapComponent> | ||
<div className="pointer-events-none absolute inset-0 left-0 top-0 flex h-full w-full flex-col items-center justify-between gap-2 p-4"> | ||
<MeasurementsOverview data={values.at(-1)} isConnected={isConnected} /> | ||
|
||
<ControlBar | ||
recording={recording} | ||
toggleRecording={() => setRecording(!recording)} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.