remove unused imports

This commit is contained in:
David Senoner 2025-06-15 14:23:16 +02:00
parent b57d9b7875
commit b8b0f2d6a1
Signed by: kada49
GPG key ID: 92BABE6B7E63C6CA
8 changed files with 15 additions and 98 deletions

View file

@ -5,16 +5,13 @@ import { fail } from "@sveltejs/kit";
import { eq } from "drizzle-orm";
export const load = async (event) => {
// Fetch all available floors
const floors = await db
.select({ floor: table.floors.floor })
.from(table.floors)
.orderBy(table.floors.floor);
// Get real connected devices from MQTT
let devices = getCurrentDevices();
// If no real devices, provide fallback mock devices
if (devices.length === 0) {
devices = [
{
@ -85,7 +82,6 @@ export const actions = {
await db.insert(table.sensors).values({ id: dev.id, user: event.locals.session.userId });
});
// Check if floor exists
const exists = await db
.select({ floor: table.floors.floor })
.from(table.floors)
@ -95,9 +91,6 @@ export const actions = {
return fail(400, { message: `Floor ${n} does not exist! Please create it first.` });
}
// Update floor with configuration
// Note: In a real implementation, you would store this data properly
// For now, we'll just update the url field as a JSON string
const floorConfig = {
image: floorPlanImage,
devices: deviceData,

View file

@ -31,13 +31,11 @@
});
$effect(() => {
// Update devices when data changes
if (data.devices) {
availableDevices = data.devices;
}
});
// Set up real-time updates via SSE
onMount(() => {
console.log("Settings: Attempting to connect to MQTT SSE...");
eventSource = new EventSource("/mqtt");
@ -56,13 +54,10 @@
const messageData = JSON.parse(event.data);
console.log("Settings page received SSE data:", messageData);
// Update device sensor data and device list from real-time updates
if (messageData.devices) {
console.log("Updating available devices with:", messageData.devices);
// Update available devices with latest data
availableDevices = messageData.devices;
// Update sensor data map
const newData = new Map();
messageData.devices.forEach((device) => {
if (device.sensorData) {
@ -116,14 +111,11 @@
const x = ((event.clientX - rect.left) / rect.width) * 100;
const y = ((event.clientY - rect.top) / rect.height) * 100;
// Check if device is already placed
const existingIndex = placedDevices.findIndex((d) => d.id === draggedDevice.id);
if (existingIndex >= 0) {
// Update position
placedDevices[existingIndex] = { ...placedDevices[existingIndex], x, y };
} else {
// Add new device
placedDevices = [...placedDevices, { ...draggedDevice, x, y }];
}
@ -244,7 +236,6 @@
return async ({ result }) => {
if (result.type === "success") {
saveMessage = { type: "success", text: result.data.message };
// Clear form after successful save
selectedFloorNumber = "";
} else if (result.type === "failure") {
saveMessage = {