I am raw html block. Możesz załadować grafikę z numerami miejsc – np. tę z załącznika.
Click edit button to change timport React, { useEffect, useMemo, useRef, useState } from "react";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Switch } from "@/components/ui/switch";
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
import { Trash2, Save, Upload, Download, ZoomIn, ZoomOut, Move, Undo2, Redo2, ImageUp, Import, FileDown } from "lucide-react";
import html2canvas from "html2canvas";
// Typy
type MarkerStatus = "zajęte" | "wolne";
type Marker = {
id: string;
xPct: number; // 0..100 w % szerokości obrazu
yPct: number; // 0..100 w % wysokości obrazu
etykieta?: string; // np. numer miejsca z obrazka
status: MarkerStatus;
};
// Pomoc – proste ID
const uid = () => Math.random().toString(36).slice(2, 10);
export default function PlanSaliApp() {
// Obraz tła (plan widowni)
const [imgSrc, setImgSrc] = useState
) : (
{markers.map((m)=> (
Etykieta
Status
Pozycja
Akcje
))}
{m.etykieta || (brak)}
{m.status}
{m.xPct.toFixed(1)}%, {m.yPct.toFixed(1)}%
{/* Panel boczny */}
Ustawienia
{/* Główna scena */}
Plan sali – kliknij, aby oznaczać miejsca
{/* Lista znaczników */}
)}
{/* Stopka */}
{ const f=e.target.files?.[0]; if (f) onUpload(f); }} />
Zapytaj o etykietę przy dodawaniu
Pokazuj etykiety na markerach
Legenda:
zajęte
wolne
Szybkie akcje: kliknij na planie, aby dodać marker (domyślnie „zajęte”). Klik na markerze przełącza status, Shift+klik usuwa, Alt+klik edytuje etykietę.
Zajęte: {liczZajete} / Wszystkie: {markers.length}
{imgSrc ? (
)}
{/* Markery */}
{imgSrc && markers.map((m) => (
Wczytaj grafikę planu sali, aby rozpocząć.
{
e.stopPropagation();
if (e.nativeEvent instanceof MouseEvent && e.nativeEvent.shiftKey) return deleteMarker(m.id);
if (e.nativeEvent instanceof MouseEvent && (e.nativeEvent.altKey || e.nativeEvent.metaKey)) return editLabel(m.id);
toggleStatus(m.id);
}}
title={m.etykieta || "(bez etykiety)"}
>
))}
{pokazNumery && (m.etykieta?.slice(0,3) || "")}
Lista zaznaczonych miejsc
{markers.length === 0 ? (
Brak – kliknij na planie, aby dodać.
) : (
Dwuklik na planie dodaje marker. Przeciągaj, aby przesuwać. Rolka – powiększenie.