"use client"; import { useState } from "react"; import { Search, Filter, Lightbulb, Projector, Wind } from "lucide-react"; // --- Tipe Data Mock --- type Room = { id: number; name: string; category: "Teori" | "Laboratorium"; capacity: number; status: "Available" | "In Use" | "Maintenance"; devices: { ac: boolean; lamp: boolean; projector: boolean; }; floor: string; }; // --- Data Dummy Ruangan (Mock Data) --- const initialRooms: Room[] = [ { id: 1, name: "Ruang T-301", category: "Teori", capacity: 40, status: "Available", devices: { ac: false, lamp: false, projector: false }, floor: "Lantai 3", }, { id: 2, name: "Ruang T-302", category: "Teori", capacity: 40, status: "In Use", devices: { ac: true, lamp: true, projector: true }, // Sedang dipakai floor: "Lantai 3", }, { id: 3, name: "Lab. Sistem Kendali", category: "Laboratorium", capacity: 20, status: "Available", devices: { ac: false, lamp: true, projector: false }, // Mungkin lampunya lupa dimatikan? floor: "Lantai 2", }, { id: 4, name: "Lab. IoT & Embedded", category: "Laboratorium", capacity: 25, status: "In Use", devices: { ac: true, lamp: true, projector: false }, floor: "Lantai 2", }, { id: 5, name: "Ruang Sidang TA", category: "Teori", capacity: 15, status: "Maintenance", devices: { ac: false, lamp: false, projector: false }, floor: "Lantai 1", }, ]; export default function RoomsPage() { const [rooms] = useState(initialRooms); const [filterStatus, setFilterStatus] = useState("All"); const [searchQuery, setSearchQuery] = useState(""); // --- Logika Filtering --- const filteredRooms = rooms.filter((room) => { // Filter berdasarkan Tab Status (All / Available / In Use) const matchStatus = filterStatus === "All" || room.status === filterStatus; // Filter berdasarkan Search Box (Nama Ruangan) const matchSearch = room.name .toLowerCase() .includes(searchQuery.toLowerCase()); return matchStatus && matchSearch; }); return (
{/* --- HEADER & CONTROLS --- */}

Daftar Ruangan

Monitoring status ruangan dan perangkat IoT.

{/* Search Box */}
setSearchQuery(e.target.value)} className="pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-yellow-400 w-full sm:w-64" />
{/* Filter Dropdown (Sederhana) */}
{/* --- ROOM GRID --- */}
{filteredRooms.map((room) => (
{/* Status Badge di Pojok Kanan Atas */} {room.status} {/* Info Utama Ruangan */}

{room.name}

{room.category} • {room.floor}

Kapasitas: {room.capacity} Org
{/* Status Perangkat IoT (Visualisasi) */}

STATUS PERANGKAT

{/* AC Status */}
AC {room.devices.ac ? "ON" : "OFF"}
{/* Lampu Status */}
Light {room.devices.lamp ? "ON" : "OFF"}
{/* Proyektor Status */}
LCD {room.devices.projector ? "ON" : "OFF"}
))}
{/* Empty State jika filter tidak menemukan hasil */} {filteredRooms.length === 0 && (

Tidak ada ruangan yang cocok dengan filter Anda.

)}
); }