Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 60 additions & 51 deletions app/components/device/new/device-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,25 @@ import { cn } from '~/lib/utils'
const devices = [
{
name: 'senseBox:Home',
image:
'https://sensebox.kaufen/api//public/uploads/thumbs/thumb--1525013086964-mcu_one_top.png',
image: '/device_images/senseBox_Home.jpg',
isIcon: false,
},
{
name: 'senseBox:Edu',
image:
'https://sensebox.kaufen/api//public/uploads/thumbs/thumb--1524084284270-mcu%20top.png',
image: '/device_images/senseBox_edu.jpg',
isIcon: false,
},
{
name: 'luftdaten.info',
image:
'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXdpbmQiPjxwYXRoIGQ9Ik0xMi44IDE5LjZBMiAyIDAgMSAwIDE0IDE2SDIiLz48cGF0aCBkPSJNMTcuNSA4YTIuNSAyLjUgMCAxIDEgMiA0SDIiLz48cGF0aCBkPSJNOS44IDQuNEEyIDIgMCAxIDEgMTEgOEgyIi8+PC9zdmc+',
isIcon: true,
},
{
name: 'custom',
image:
'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXdyZW5jaCI+PHBhdGggZD0iTTE0LjcgNi4zYTEgMSAwIDAgMCAwIDEuNGwxLjYgMS42YTEgMSAwIDAgMCAxLjQgMGwzLjc3LTMuNzdhNiA2IDAgMCAxLTcuOTQgNy45NGwtNi45MSA2LjkxYTIuMTIgMi4xMiAwIDAgMS0zLTNsNi45MS02LjkxYTYgNiAwIDAgMSA3Ljk0LTcuOTRsLTMuNzYgMy43NnoiLz48L3N2Zz4=',
isIcon: true,
},
]

Expand Down Expand Up @@ -104,7 +106,9 @@ export function DeviceSelectionStep() {
<div
className={cn(
'grid gap-6',
selectedDevice === 'senseBox:Home' ? 'grid-cols-1' : 'grid-cols-2',
selectedDevice === 'senseBox:Home'
? 'grid-cols-1'
: 'grid-cols-1 lg:grid-cols-2',
)}
>
{devices.map((device) => {
Expand All @@ -118,7 +122,7 @@ export function DeviceSelectionStep() {
<Card
key={device.name}
className={cn(
'transform cursor-pointer transition-all duration-300 ease-in-out hover:scale-105',
'relative transform cursor-pointer overflow-hidden transition-all duration-300 ease-in-out hover:scale-105',
selectedDevice === device.name
? 'bg-primary/10 ring-2 ring-primary'
: 'hover:bg-gray-50',
Expand All @@ -130,56 +134,61 @@ export function DeviceSelectionStep() {
handleDeviceChange(device.name)
}}
>
<CardContent className="flex flex-col items-center space-y-4 p-2">
{selectedDevice === 'senseBox:Home' && (
<Button
variant="ghost"
size="icon"
className="absolute right-2 top-2"
onClick={(e) => {
e.stopPropagation()
handleClose()
}}
>
<X className="h-4 w-4" />
</Button>
)}
<CardContent className="flex flex-row p-0">
<img
src={device.image}
alt={device.name}
className="h-24 w-24"
className={cn(
'w-24 self-stretch',
device.isIcon ? 'object-contain p-4' : 'object-cover',
)}
/>
<h3 className="text-lg font-semibold">{device.name}</h3>
{device.name === 'senseBox:Home' &&
selectedDevice === 'senseBox:Home' && (
<>
<Separator className="my-2" />
<div className="w-full max-w-xs">
<h4 className="mb-2 text-sm font-medium">
{t('connection_type')}
</h4>
<RadioGroup
value={selectedConnectionType}
onValueChange={(value) =>
handleConnectionTypeChange(value)
}
className="flex flex-col space-y-1"
>
{connectionTypes.map((type) => (
<div
key={type}
className="flex items-center space-x-2"
>
<RadioGroupItem value={type} id={type} />
<Label htmlFor={type} className="text-sm">
{type}
</Label>
</div>
))}
</RadioGroup>
</div>
</>
<div className="flex flex-1 flex-col justify-center p-3">
{selectedDevice === 'senseBox:Home' && (
<Button
variant="ghost"
size="icon"
className="absolute right-2 top-2"
onClick={(e) => {
e.stopPropagation()
handleClose()
}}
>
<X className="h-4 w-4" />
</Button>
)}
<h3 className="text-lg font-semibold">{device.name}</h3>
{device.name === 'senseBox:Home' &&
selectedDevice === 'senseBox:Home' && (
<>
<Separator className="my-2" />
<div className="w-full max-w-xs">
<h4 className="mb-2 text-sm font-medium">
{t('connection_type')}
</h4>
<RadioGroup
value={selectedConnectionType}
onValueChange={(value) =>
handleConnectionTypeChange(value)
}
className="flex flex-col space-y-1"
>
{connectionTypes.map((type) => (
<div
key={type}
className="flex items-center space-x-2"
>
<RadioGroupItem value={type} id={type} />
<Label htmlFor={type} className="text-sm">
{type}
</Label>
</div>
))}
</RadioGroup>
</div>
</>
)}
</div>
</CardContent>
</Card>
)
Expand Down
60 changes: 24 additions & 36 deletions app/utils/sensor-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const sensorDefinitions = {
unit: 'm/s',
sensorType: 'WINDSPEED',
icon: 'osem-particulate-matter',
image: '',
},
dht22_temperature: {
title: 'Temperatur',
Expand All @@ -16,16 +17,14 @@ export const sensorDefinitions = {
unit: '°C',
sensorType: 'BME680',
icon: 'osem-thermometer',
image:
'https://sensebox.kaufen/api/public/uploads/1559804795009-bme_v2_top.png',
image: '/sensor_images/BME680.jpg',
},
smt50_soilmoisture: {
title: 'Bodenfeuchte',
unit: '%',
sensorType: 'SMT50',
icon: 'osem-thermometer',
image:
'https://sensebox.kaufen/api/public/uploads/1572259222502-SMT50_freigestellt_02.png',
image: '/sensor_images/SMT50.jpg',
},
sht3x_temperature: {
title: 'Temperatur',
Expand Down Expand Up @@ -56,8 +55,7 @@ export const sensorDefinitions = {
unit: '%',
sensorType: 'BME680',
icon: 'osem-humidity',
image:
'https://sensebox.kaufen/api/public/uploads/1559804795009-bme_v2_top.png',
image: '/sensor_images/BME680.jpg',
},
bme280_humidity: {
title: 'rel. Luftfeuchte',
Expand All @@ -82,8 +80,7 @@ export const sensorDefinitions = {
unit: 'μW/cm²',
sensorType: 'VEML6070',
icon: 'osem-brightness',
image:
'https://sensebox.kaufen/api/public/uploads/1525169435852-v+uv%20bottom.png',
image: '/sensor_images/VEML6070.jpg',
},
sht3x_humidity: {
title: 'rel. Luftfeuchte',
Expand All @@ -96,14 +93,14 @@ export const sensorDefinitions = {
unit: 'hPa',
sensorType: 'BME680',
icon: 'osem-barometer',
image:
'https://sensebox.kaufen/api/public/uploads/1559804795009-bme_v2_top.png',
image: '/sensor_images/BME680.jpg',
},
tsl45315_lightintensity: {
title: 'Beleuchtungsstärke',
unit: 'lx',
sensorType: 'TSL45315',
icon: 'osem-brightness',
image: '',
},
bmp180_temperature: {
title: 'Temperatur',
Expand All @@ -116,22 +113,21 @@ export const sensorDefinitions = {
unit: 'µg/m³',
sensorType: 'SDS 011',
icon: 'osem-cloud',
image:
'https://sensebox.kaufen/api/public/uploads/1526395407421-nova_sensor_top.png',
image: '/sensor_images/SDS011.png',
},
sps30_pm10: {
title: 'PM10',
unit: 'µg/m³',
sensorType: 'SPS30',
icon: 'osem-cloud',
image:
'https://sensebox.kaufen/api/public/uploads/1692346699679-feinstaub1-frei.png',
image: '/sensor_images/SPS30.jpg',
},
soundlevelmeter: {
title: 'Lautstärke',
unit: 'dB (A)',
sensorType: 'SOUNDLEVELMETER',
icon: 'osem-thermometer',
image: '/sensor_images/SoundLevelSensor.jpg',
},
pms7003_pm25: {
title: 'PM2.5',
Expand All @@ -144,8 +140,7 @@ export const sensorDefinitions = {
unit: 'kOhm',
sensorType: 'BME680',
icon: 'osem-thermometer',
image:
'https://sensebox.kaufen/api/public/uploads/1559804795009-bme_v2_top.png',
image: '/sensor_images/BME680.jpg',
},
dnms_la_min: {
title: 'Schalldruckpegel (Min)',
Expand All @@ -170,8 +165,7 @@ export const sensorDefinitions = {
unit: '°C',
sensorType: 'DPS310',
icon: 'osem-thermometer',
image:
'https://sensebox.kaufen/api/public/uploads/1646750298501-1646737282568-sensebox-dps310_1.png',
image: '/sensor_images/DPS310.jpg',
},
pms7003_pm10: {
title: 'PM10',
Expand All @@ -184,16 +178,14 @@ export const sensorDefinitions = {
unit: 'µg/m³',
sensorType: 'SPS30',
icon: 'osem-cloud',
image:
'https://sensebox.kaufen/api/public/uploads/1692346699679-feinstaub1-frei.png',
image: '/sensor_images/SPS30.jpg',
},
dps310_pressure: {
title: 'Luftdruck',
unit: 'hPa',
sensorType: 'DPS310',
icon: 'osem-barometer',
image:
'https://sensebox.kaufen/api/public/uploads/1646750298501-1646737282568-sensebox-dps310_1.png',
image: '/sensor_images/DPS310.jpg',
},
bme280_pressure_hpa: {
title: 'Luftdruck',
Expand All @@ -212,16 +204,14 @@ export const sensorDefinitions = {
unit: 'µg/m³',
sensorType: 'SDS 011',
icon: 'osem-cloud',
image:
'https://sensebox.kaufen/api/public/uploads/1526395407421-nova_sensor_top.png',
image: '/sensor_images/SDS011.png',
},
sps30_pm1: {
title: 'PM1',
unit: 'µg/m³',
sensorType: 'SPS30',
icon: 'osem-cloud',
image:
'https://sensebox.kaufen/api/public/uploads/1692346699679-feinstaub1-frei.png',
image: '/sensor_images/SPS30.jpg',
},
pms1003_pm01: {
title: 'PM01',
Expand All @@ -234,8 +224,7 @@ export const sensorDefinitions = {
unit: '°C',
sensorType: 'HDC1080',
icon: 'osem-thermometer',
image:
'https://sensebox.kaufen/api/public/uploads/1524084036826-hds%20top.png',
image: '/sensor_images/HDC1080.jpg',
},
pms1003_pm25: {
title: 'PM2.5',
Expand All @@ -248,22 +237,21 @@ export const sensorDefinitions = {
unit: 'ppm',
sensorType: 'SCD30',
icon: 'osem-co2',
image:
'https://docs.sensebox.de/assets/images/scd30-973734bd98521f41d3dae483191456aa.png',
image: '/sensor_images/SCD30.jpg',
},
hdc1008_temperature: {
title: 'Temperatur',
unit: '°C',
sensorType: 'HDC1008',
icon: 'osem-thermometer',
image: '/sensor_images/HDC1008.png',
},
sps30_pm4: {
title: 'PM4',
unit: 'µg/m³',
sensorType: 'SPS30',
icon: 'osem-cloud',
image:
'https://sensebox.kaufen/api/public/uploads/1692346699679-feinstaub1-frei.png',
image: '/sensor_images/SPS30.jpg',
},
pms1003_pm10: {
title: 'PM10',
Expand Down Expand Up @@ -294,8 +282,7 @@ export const sensorDefinitions = {
unit: '%',
sensorType: 'HDC1080',
icon: 'osem-humidity',
image:
'https://sensebox.kaufen/api/public/uploads/1524084036826-hds%20top.png',
image: '/sensor_images/HDC1080.jpg',
},
pms3003_pm01: {
title: 'PM01',
Expand All @@ -314,8 +301,7 @@ export const sensorDefinitions = {
unit: '°C',
sensorType: 'SMT50',
icon: 'osem-thermometer',
image:
'https://sensebox.kaufen/api/public/uploads/1572259222502-SMT50_freigestellt_02.png',
image: '/sensor_images/SMT50.jpg',
},
dht11_humidity: {
title: 'rel. Luftfeuchte',
Expand All @@ -340,11 +326,13 @@ export const sensorDefinitions = {
unit: 'hPa',
sensorType: 'BMP280',
icon: 'osem-barometer',
image: '/sensor_images/BMP280.png',
},
hdc1008_humidity: {
title: 'rel. Luftfeuchte',
unit: '%',
sensorType: 'HDC1008',
icon: 'osem-humidity',
image: '/sensor_images/HDC1008.png',
},
}
Binary file added public/device_images/senseBox_Home.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/device_images/senseBox_edu.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/sensor_images/BME680.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/sensor_images/BMP280.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/sensor_images/DPS310.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/sensor_images/HDC1008.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/sensor_images/HDC1080.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/sensor_images/SCD30.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/sensor_images/SDS011.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/sensor_images/SDS011.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/sensor_images/SMT50.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/sensor_images/SPS30.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/sensor_images/SoundLevelSensor.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/sensor_images/VEML6070.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading