Files
MSE-PI-E2EEDA-Plein-de-eeee…/ui/src/app/config/rooms-layout.config.ts
khalil-bot 3b803da147 fix(ui): address code review feedback
- Fix CI: remove redundant push trigger, keep only pull_request on main
- Fix CI: remove continue-on-error on lint and test steps
- Fix accessibility: wrap h1 routerLink in <a> element in header
- Fix reactivity: use paramMap observable instead of route.snapshot
- Extract CO2 thresholds to co2-levels.config.ts
- Fix environment.template.ts comment to English
- Fix wsUrl in environment.ts to include /ws path
- Fix production URLs: hes-so.ch -> ui.e.kb28.ch
- Fix README: align Models convention with kebab-case .model.ts suffix
- Remove redundant .gitkeep files from directories with README.md
2026-04-15 19:51:44 +02:00

239 lines
4.0 KiB
TypeScript

/**
* Room Layout Configuration
* Defines all rooms in Espace A and Espace B with their SVG positions and metadata
*/
export interface RoomLayout {
id: string;
name: string;
espace: 'A' | 'B';
floor: number;
type: string;
x: number;
y: number;
width: number;
height: number;
capacity?: number;
hasSensor: boolean;
}
export const ROOM_LAYOUTS: RoomLayout[] = [
// ========================================
// ESPACE B (Left side - 4 rooms)
// ========================================
{
id: 'B1',
name: 'B1 - Meeting Room',
espace: 'B',
floor: 1,
type: 'meeting',
x: 50,
y: 80,
width: 220,
height: 140,
capacity: 12,
hasSensor: true,
},
{
id: 'B2',
name: 'B2 - Lab',
espace: 'B',
floor: 1,
type: 'lab',
x: 50,
y: 240,
width: 220,
height: 140,
capacity: 20,
hasSensor: true,
},
{
id: 'B3',
name: 'B3 - Office',
espace: 'B',
floor: 1,
type: 'office',
x: 50,
y: 400,
width: 220,
height: 140,
capacity: 8,
hasSensor: true,
},
{
id: 'B4',
name: 'B4 - Storage',
espace: 'B',
floor: 1,
type: 'storage',
x: 50,
y: 560,
width: 220,
height: 140,
capacity: 0,
hasSensor: false,
},
// ========================================
// ESPACE A (Right side - 9 rooms)
// ========================================
{
id: 'A1',
name: 'A1 - Auditorium',
espace: 'A',
floor: 1,
type: 'auditorium',
x: 410,
y: 240,
width: 220,
height: 300,
capacity: 150,
hasSensor: true,
},
{
id: 'A2',
name: 'A2 - Lecture Hall',
espace: 'A',
floor: 1,
type: 'classroom',
x: 670,
y: 80,
width: 220,
height: 140,
capacity: 60,
hasSensor: true,
},
{
id: 'A3',
name: 'A3 - Workshop',
espace: 'A',
floor: 1,
type: 'workshop',
x: 410,
y: 80,
width: 220,
height: 140,
capacity: 25,
hasSensor: true,
},
{
id: 'A4',
name: 'A4 - Open Space',
espace: 'A',
floor: 1,
type: 'openspace',
x: 930,
y: 80,
width: 220,
height: 140,
capacity: 30,
hasSensor: true,
},
{
id: 'A5',
name: 'A5 - Conference',
espace: 'A',
floor: 1,
type: 'conference',
x: 670,
y: 400,
width: 220,
height: 140,
capacity: 20,
hasSensor: true,
},
{
id: 'A6',
name: 'A6 - Study Room',
espace: 'A',
floor: 1,
type: 'study',
x: 930,
y: 240,
width: 220,
height: 140,
capacity: 15,
hasSensor: true,
},
{
id: 'A7',
name: 'A7 - Lab',
espace: 'A',
floor: 1,
type: 'lab',
x: 670,
y: 560,
width: 220,
height: 140,
capacity: 18,
hasSensor: true,
},
{
id: 'A8',
name: 'A8 - Classroom',
espace: 'A',
floor: 1,
type: 'classroom',
x: 930,
y: 560,
width: 220,
height: 140,
capacity: 40,
hasSensor: true,
},
{
id: 'A9',
name: 'A9 - Office',
espace: 'A',
floor: 1,
type: 'office',
x: 930,
y: 400,
width: 220,
height: 140,
capacity: 10,
hasSensor: true,
},
];
/**
* Get room layout by ID
*/
export function getRoomById(roomId: string): RoomLayout | undefined {
return ROOM_LAYOUTS.find((room) => room.id === roomId);
}
/**
* Get rooms by espace (A or B)
*/
export function getRoomsByEspace(espace: 'A' | 'B'): RoomLayout[] {
return ROOM_LAYOUTS.filter((room) => room.espace === espace);
}
/**
* Get all rooms with sensors
*/
export function getRoomsWithSensors(): RoomLayout[] {
return ROOM_LAYOUTS.filter((room) => room.hasSensor);
}
/**
* Get total number of rooms
*/
export function getTotalRooms(): number {
return ROOM_LAYOUTS.length;
}
/**
* Get room center point (for tooltip positioning)
*/
export function getRoomCenter(roomId: string): { x: number; y: number } | null {
const room = getRoomById(roomId);
if (!room) return null;
return {
x: room.x + room.width / 2,
y: room.y + room.height / 2,
};
}